Skip to content

Instantly share code, notes, and snippets.

@designviacode
Created May 5, 2015 16:55
Show Gist options
  • Save designviacode/afbeb64b4972667d285c to your computer and use it in GitHub Desktop.
Save designviacode/afbeb64b4972667d285c to your computer and use it in GitHub Desktop.
Fetch
/*
Get Factorial for specified argument to the function
TODO:
check whether the Num is positive, if not;
use another method.
*/
function getFactorial(myNum) {
var factorial = 1;
for(var i=parseInt(myNum); i>0; --i) {
factorial *= i;
}
return factorial;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment