Created
December 11, 2015 18:42
-
-
Save mtroiani/893bb2b42a32e9f36069 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/mtroiani 's solution for Bonfire: 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: @mtroiani | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function factorialize(num) { | |
var i = 1 | |
var product = 1 | |
while (i <= num) { | |
product = product * i; | |
i ++; | |
} | |
return product; | |
} | |
factorialize(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment