Created
January 13, 2019 17:37
-
-
Save alegut/112984a7eaaff902bbc989f261af5c3f to your computer and use it in GitHub Desktop.
Factorial riddle
This file contains hidden or 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
function FirstFactorial(num) { | |
if (num === 0 || num === 1) { | |
return 1; | |
} | |
else { | |
var d = FirstFactorial(num - 1); | |
return num * d; | |
} | |
} | |
console.log(FirstFactorial(9)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment