function to find factorial in javascript code example
Example 1: factorial javascript function
function factorialize(num) {
if(num < 2) return 1;
return num *= factorialize(num - 1);
}
Example 2: factorial javascript
// Simple arrow function solution
var factorial = n => (n <= 0) ? 1: n * factorial(n - 1);