Skip to content

Instantly share code, notes, and snippets.

@alegut
Created January 13, 2019 17:37
Show Gist options
  • Save alegut/112984a7eaaff902bbc989f261af5c3f to your computer and use it in GitHub Desktop.
Save alegut/112984a7eaaff902bbc989f261af5c3f to your computer and use it in GitHub Desktop.
Factorial riddle
function FirstFactorial(num) {
if (num === 0 || num === 1) {
return 1;
}
else {
var d = FirstFactorial(num - 1);
return num * d;
}
}
console.log(FirstFactorial(9));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment