JavaScript program to find the factorial of a number using recursion:

python tutorials and learn python

Created with Sketch.

JavaScript program to find the factorial of a number using recursion:

function factorial(n) {
  if (n === 0) return 1;
  return n * factorial(n - 1);
}

console.log(factorial(5));

Leave a Reply

Your email address will not be published. Required fields are marked *