Skip to content

Instantly share code, notes, and snippets.

@alexandrebvd
Last active August 29, 2015 14:25
Show Gist options
  • Save alexandrebvd/d76803dce96861c199a3 to your computer and use it in GitHub Desktop.
Save alexandrebvd/d76803dce96861c199a3 to your computer and use it in GitHub Desktop.
4.Bonfire: Factorialize a Number
function factorialize(num) {
if (num === 0) {
return 1;
} else {
for (var i = num; i > 1; i--) {
num *= (i-1);
}
return num;
}
}
factorialize(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment