Created
October 7, 2017 19:45
-
-
Save DawTaylor/a169ef6e1d8106e0247cfee9db2cb738 to your computer and use it in GitHub Desktop.
Simple JS factorial implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const factorial = n => (n <= 1) ? 1 : n * factorial(n - 1); | |
let n = process.argv[2]; | |
console.log(`Factorial of ${n} = ${factorial(n)}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment