Last active
August 29, 2015 14:18
-
-
Save microbial/57657f3787cca749d558 to your computer and use it in GitHub Desktop.
Factorial
This file contains hidden or 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(n) { | |
var product = 1; | |
while(n > 1) { | |
product = product * n; | |
n--; | |
} | |
return product; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment