Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Return the factorial of the provided integer.
// Bonfire: Factorialize a Number
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function factorialize(num) {
var fac=1;
if (num ===0){
return fac;
}
for(var i=1; i<=num; i++)
{
fac = i*fac;
}
return fac;
}
factorialize(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.