这里是bluebird article ,据说:
The arguments object must not be passed or leaked anywhere.
它有一些不好的例子如下:
function leaksArguments1() {
return arguments;
}
function leaksArguments2() {
var args = [].slice.call(arguments);
}
我不明白为什么这会导致无法优化。谢谢。
最佳答案
现代浏览器中的 JavaScript 解释器正在进行大量优化,如果 arguments
泄漏到函数外部,这些优化将被关闭。在 mdn documentation 中提到
我在这个问题 here 中找到了完美的解释
关于javascript - 为什么改变参数会导致无法优化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47844265/