Javascript examples for Function:Arrow Function
Create factorial using arrow function operator
// 8./*from www . j a v a 2s . com*/ let factorial = x => { if (IsNaN(x) || x < 0 || x > 100) return; if (x % 1 !== 0) { x = parseInt(x); } if (x === 0) return 1; if (x === 1) return 1; return x * factorial(x - 1); } console.log(`Factorial of 5 is ${factorial(5)}`);