Created
January 30, 2017 16:59
-
-
Save tiberiur/a58cfc92f5407ce4e7cbfde3a0b73973 to your computer and use it in GitHub Desktop.
[JS] Factorialize 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 answer = 1; | |
for (var i = 2; i <= num; i++) { | |
answer *= i; | |
} | |
return answer; | |
} | |
var answer = factorialize(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment