Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Iterative process couched in terms of recursive procedure
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
You can’t perform that action at this time.