Last active
November 13, 2016 15:27
-
-
Save AnasAboreeda/5b93a505cb53c043b17a to your computer and use it in GitHub Desktop.
Factorialize a Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bonfire: Factorialize a Number | |
// Author: @anasfullstack | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function factorialize(num) { | |
var factorial = 1; | |
if (num > 1){ | |
factorial = num * factorialize(num - 1); | |
return factorial; | |
} | |
else { | |
return factorial; | |
} | |
} | |
factorialize(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment