"Too much recursion" but there isn't?

Hi, I’m trying the Factorialize a Number challenge using recursion, and freeCodeCamp tells me “too much recursion”, but how can there be any less?

function factorialize(num) {
  if (num === 1) return 1;
  return num * factorialize(num-1);
}

factorialize(5);

Firefox 61.0.1, Windows

Link to challenge

0 is why. What happens when you input 0? In this case the browser is preventing your computer crashing by erroring with that message

1 Like

Great, thanks very much.
I’ve changed the if to:

if (num === 1 || num === 0) return 1;

1 Like