Created
August 3, 2016 20:04
-
-
Save adriennetacke/cc5b8f43103209b4b75dae4a9f7f1cb7 to your computer and use it in GitHub Desktop.
Factorial function in Javascript.
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 factorial(number) { | |
var temp = number; | |
for (var i = 1; i < number; i++){ | |
temp *= i; | |
} | |
console.log(`${number}! is ${temp}.`); | |
} | |
return(factorial(process.argv[2])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment