Skip to content

Instantly share code, notes, and snippets.

@jamc92
Created April 3, 2016 22:18
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 jamc92/cd1198b81ee01604cd8d72217e4229d5 to your computer and use it in GitHub Desktop.
Save jamc92/cd1198b81ee01604cd8d72217e4229d5 to your computer and use it in GitHub Desktop.
function factorialize(num) {
result = 1;
for (var i = 1; i <= num; i++) {
result *= i;
}
return result;
}
factorialize(10);
@jamc92
Copy link
Author

jamc92 commented Apr 3, 2016

  • factorialize(5) should return a number.
  • factorialize(5) should return 120.
  • factorialize(10) should return 3628800.
  • factorialize(20) should return 2432902008176640000.
  • factorialize(0) should return 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment