var length = 10; function fn(){
console.log(this.length);
} var obj = {
length:5,
method:function(fn){
fn();
arguments[0]();
}
} obj.method(fn,1);
结果为10 2
arguments[0]() => fn() =>this指向arguments所以输出arguments.length
var length = 10; function fn(){
console.log(this.length);
} var obj = {
length:5,
method:function(fn){
fn();
arguments[0]();
}
} obj.method(fn,1);
结果为10 2
arguments[0]() => fn() =>this指向arguments所以输出arguments.length