Skip to content

Instantly share code, notes, and snippets.

@jiggzson
Last active April 21, 2019 02:12
Show Gist options
  • Save jiggzson/55386d7e1d593c679ed3511445874e70 to your computer and use it in GitHub Desktop.
Save jiggzson/55386d7e1d593c679ed3511445874e70 to your computer and use it in GitHub Desktop.
A fast factorial function
var factorial = function(n) {
if(n === 0)
return 1;
var f = n;
while(n > 1) {
f *= --n;
}
return f;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment