Skip to content

Instantly share code, notes, and snippets.

@adriennetacke
Created August 3, 2016 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriennetacke/cc5b8f43103209b4b75dae4a9f7f1cb7 to your computer and use it in GitHub Desktop.
Save adriennetacke/cc5b8f43103209b4b75dae4a9f7f1cb7 to your computer and use it in GitHub Desktop.
Factorial function in Javascript.
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