let name = 'window';
let obj = {
name: '1',
sayName1: function (fn) {
console.log(this); // obj
fn();
},
}
obj.sayName1(() => {
console.log(this); // window
console.log(this.name); // window
})
请问箭头函数的 this 为什么指向 window 而不是 obj?
等同于