It's a question that has more to do with curiosity, to understand how it works.
I know that if I call a function within itself indefinitely I get the error Uncaught RangeError: Maximum call stack size exceeded
.
Initially, I thought there was a programmed limit on how many times the function would be called, and then I made the following snippet to test how many times the function runs before it causes the error:
i = 0
function a() {
i++;
try{
return a()
} catch(e) {
console.log(i);
i = 0;
}
}
a();
multiple times, it prints me different numbers in each execution. And something I've noticed is that, running% c_de% multiple times quickly increases the number of attempts before reporting the error (from 20968 to 35945).
I tested on another machine, and the amount of attempts was different as well.
So here's the question: How do I set the number of times I run before I acknowledge the error?