2. Arrow function 的this指向
上篇回顾:
1. 默认绑定: console.log(this=== window) ==> true 2. 隐式绑定: (谁呼叫就指向谁) :3. 显式绑定: call, apply, bind4. new 绑定规则;
箭头函式的this
物件中的巢状函式
let a = 0 let obj = { a : 'obj', foo(){ let that = this; console.log(this); function test(){ console.log(this); // // window console.log(that); // obj } test() // 也可以通过这种方式使 this 指向 obj