谁可以帮忙解释一哈 Leaking arguments 的概念
<script>
Benchmark.prototype.setup = function() {
function otherFunc(a, b) {
return a + b;
}
function withArguments(x) {
var a = arguments;
return otherFunc.apply(x, Array.prototype.slice.call(a, 1));
}
function withCopy(x) {
var a = [];
var i, len = arguments.length;
for (i = 1; i < len; i += 1) {
a[i - 1] = arguments[i];
}
return otherFunc.apply(x, a);
}
温温酱
相关分类