求解 function arguments 里this 指向问题

1,363 阅读1分钟

最近看到一个 this 指向的问题:


arguments 是具有length 属性,但是我理解 arguments[0] 就是fn 函数。前面也没有调用 fn 的对象。 为什么 fn 的 this 指向了arguments ?

求 大佬解惑!


为了方便复制 验证,代码:

var length = 10;

function fn(){
    console.log(this.length);
}
var b = {
    length: 3,
    fn: function(){
              fn();
              arguments[0]();
              fn.call(b,5);
         }

};

b.fn(fn,7);