Created
October 23, 2015 18:42
-
-
Save gabrieljmj/1d68de4917bc3a67a852 to your computer and use it in GitHub Desktop.
factorial implementation in JS
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
var factorial = function (number) { | |
var n = 1; | |
while(number != 1) { | |
n = n * number; | |
number--; | |
} | |
return n; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment