箭头函数this指向还是有些不太懂
来源:2-21 Arrow Functions(箭头函数)

hotPink
2020-03-11
这里的箭头函数this指向还是有些不太懂,这里如果想用箭头函数取到我这里面的name该怎么做,是不是在这种情况下就只能使用普通函数的this去取
let test = {
name:‘test’,
say: () => {
console.log(this.name)
}
}
写回答
1回答
-
快乐动起来呀
2020-03-13
箭头函数 this 的是指向书写函数的时候 this 的指向,在这里是 window,如果在 class 里的 this 指的就是 class 的实例
00
相似问题