Skip to content

Instantly share code, notes, and snippets.

@shtakai
Created May 9, 2016 19:58
Show Gist options
  • Save shtakai/2ec6adcc64c8b20573621e911cd4b1ff to your computer and use it in GitHub Desktop.
Save shtakai/2ec6adcc64c8b20573621e911cd4b1ff to your computer and use it in GitHub Desktop.
var fact = function (n) {
return (n == 1) ? 1 : n * fact(n-1);
}
console.log( fact(7));
console.log( fact(10) == 10*9*8*7*6*5*4*3*2*1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment