Answers for "javascript factorial word"

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
0

javascript factorial with closure

function calcularFatorial(num) {
  return num > 1 ? num * calcularFatorial(num - 1) : 1;
}
Posted by: Guest on October-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language