Skip to content

Instantly share code, notes, and snippets.

@gabrieljmj
Created October 23, 2015 18:42
Show Gist options
  • Save gabrieljmj/1d68de4917bc3a67a852 to your computer and use it in GitHub Desktop.
Save gabrieljmj/1d68de4917bc3a67a852 to your computer and use it in GitHub Desktop.
factorial implementation in JS
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