Created
February 25, 2018 19:40
-
-
Save BolajiOlajide/2e360db2294be46920dc32fdec272e48 to your computer and use it in GitHub Desktop.
Example of a recursive function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorial(number) { | |
if (number === 1) { | |
return 1; | |
} | |
return number * factorial(number - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment