Skip to content

Instantly share code, notes, and snippets.

@erictleung
Created November 17, 2015 02:06
Show Gist options
  • Save erictleung/8b3858d81a5d6dbad5ba to your computer and use it in GitHub Desktop.
Save erictleung/8b3858d81a5d6dbad5ba to your computer and use it in GitHub Desktop.
Return factorial of number, given a number
function factorialize(num) {
var final = 1;
if (num === 0) {
return 1;
}
else {
for (i = 1; i <= num; i++ ) {
final *= i;
}
return final;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment