参考博文:https://www.cnblogs.com/fanzhanxiang/p/8888963.html
箭头函数本身没有this,所以它内部的this是继承自父执行上下文
中的this。所以以下调用obj调用func0()的时候,this是window,父级执行上下文是window
name = "window";
var obj = {
name: "obj",
func0: () => {
console.log(this)
console.log(this.name);
},
func1: function() {
console.log(this)
console.log(this.name);
},
}
obj.func0()