Last active
April 6, 2016 22:19
-
-
Save AntonisFK/7d31d623e0c4b3895458f5cd9daec93f to your computer and use it in GitHub Desktop.
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
//factorial(3) = 3*2*1 | |
var factorial = function(num){ | |
var factor =1; | |
if(num > 0){ | |
for(var i=1; i<=num; i++){ | |
factor *= i; | |
} | |
return factor; | |
} | |
}; | |
factorial(9); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment