Skip to content

Instantly share code, notes, and snippets.

@jbmilgrom
Created September 23, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbmilgrom/f57f8c28917419d6e1c4d23ea9ab88af to your computer and use it in GitHub Desktop.
Save jbmilgrom/f57f8c28917419d6e1c4d23ea9ab88af to your computer and use it in GitHub Desktop.
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