Contact: aviboots(AT)netvision.net.il
24,887 questions
32,502 answers
573 users
function factorial(x) { if (x == 0) { return 1; } else { return x * factorial(x - 1); } } const n = 7 const fact = factorial(n); console.log(fact); /* run: 5040 */
function factorial(x) { return (x == 1 || x == 0) ? 1 : x * factorial(x - 1); } const n = 7 const fact = factorial(n); console.log(fact); /* run: 5040 */