Skip to content Skip to sidebar Skip to footer

Why Does Apply With Too Many Arguments Throw "maximum Call Stack Size Exceeded"?

In Chrome and Node, the following code throws an error: function noop() {} var a = new Array(1e6) // Array[1000000] noop.apply(null, a) // Uncaught RangeError: Maximum call stack s

Solution 1:

Function arguments are put on the stack. You're trying to put a million arguments onto the stack, and that's more than the maximum stack size. So the error message is very relevant to the reason for the error.


Post a Comment for "Why Does Apply With Too Many Arguments Throw "maximum Call Stack Size Exceeded"?"