Created
May 9, 2020 20:55
-
-
Save baranovxyz/268326b2d3b406d84467d8ea4c9e5ac5 to your computer and use it in GitHub Desktop.
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 factorial(n) { | |
if (n <= 1) return 1; | |
return n * factorial(n - 1); | |
} | |
console.log(factorial(5)); // 120 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment