Your misunderstanding might be resolved if you take the following as an example:
constarray=newArray();array.length=1/0;...
An extreme example, I concede, but as an exercise, you can try to figure out the call stack sizes for different JS engines (and AFAIK they're all smaller than the maximum number the 52bit mantissa of a Number can store).
Your misunderstanding might be resolved if you take the following as an example:
An extreme example, I concede, but as an exercise, you can try to figure out the call stack sizes for different JS engines (and AFAIK they're all smaller than the maximum number the 52bit mantissa of a Number can store).
Optimized tail calls don't grow the stack.
They're implemented with a goto, it's basically a loop.
On most browsers this will give you a number.
On Safari, Mobile Safari, and some embeddable runtimes like latest Duktape It will be an infinite loop.