Created
November 17, 2015 02:06
-
-
Save erictleung/8b3858d81a5d6dbad5ba to your computer and use it in GitHub Desktop.
Return factorial of number, given a number
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) { | |
var final = 1; | |
if (num === 0) { | |
return 1; | |
} | |
else { | |
for (i = 1; i <= num; i++ ) { | |
final *= i; | |
} | |
return final; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment