Answers for "javascript math.factorial"

19

javascript factorial

function factorial(n) {
  if (n < 0) return;
  if (n < 2) return 1;
  return n * factorial(n - 1);
}
Posted by: Guest on May-24-2020
1

factorial javascript

// Simple arrow function solution
var factorial = n => (n <= 0) ? 1: n * factorial(n - 1);
Posted by: Guest on June-29-2020
0

factorial javascript function

function factorialize(num) {
  if(num < 2) return 1;
  return num *= factorialize(num - 1);
}
Posted by: Guest on July-24-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language