Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active August 28, 2017 12:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/9842e49605a551e306d803c618749fa1 to your computer and use it in GitHub Desktop.
Save kunigami/9842e49605a551e306d803c618749fa1 to your computer and use it in GitHub Desktop.
function factorial(n) {
if (n == 0) {
return 1;
}
setTimeout(
function() {
console.log('enqueued', n);
},
0
)
return factorial(n - 1) * n;
}
console.log(factorial(10));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment