javascript factorial built-in method code example
Example 1: factorial javascript function
function factorialize(num) {
if(num < 2) return 1;
return num *= factorialize(num - 1);
}
Example 2: factorial function javascript
function factorial(n) {
if (n > 1) {
return n * factorial(n - 1);
}
return 1;
}