更新时间:2022-06-14 23:28:39
浏览器无法处理那么多参数。例如,请参阅此代码段:
Browsers can't handle that many arguments. See this snippet for example:
alert.apply(window, new Array(1000000000));
这会产生 RangeError:超出最大调用堆栈大小
这与你的问题相同。
This yields RangeError: Maximum call stack size exceeded
which is the same as in your problem.
要解决这个问题,请执行:
To solve that, do:
var arr = [];
for(var i = 0; i < 1000000; i++){
arr.push(Math.random());
}