Last active
January 25, 2018 05:15
-
-
Save warpgate3/944208de3d8fee2fe388e09777bc6082 to your computer and use it in GitHub Desktop.
factorial.js
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
var factorial = function(n) { | |
if (n === 1) { | |
return 1; | |
} | |
return n * factorial(n -1); | |
} | |
console.log(factorial(5)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment