Created
September 23, 2019 16:42
-
-
Save jbmilgrom/f57f8c28917419d6e1c4d23ea9ab88af to your computer and use it in GitHub Desktop.
Iterative process couched in terms of recursive procedure
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
const factorial = n => { | |
if (n === 0) return 1; | |
return n * factorial(n - 1); | |
}; | |
factorial(1); // => 1 | |
factorial(2); // => 2 | |
factorial(3); // => 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment