Created
November 16, 2015 08:21
-
-
Save andytudhope/6d592a234e4fe1ea446d to your computer and use it in GitHub Desktop.
Free Code Camp Bonfire
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 factorialize(num) { | |
if (num === 0 || num === 1) { | |
return 1; | |
} | |
return num * factorialize(num-1); | |
} | |
factorialize(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet uses a recursive function to calculate the factorial of any number passed to it.