function Person(){ this.age = 0; setInterval(() => { this.age++; // this refers to the person object }, 1000); }
但是如果我想访问setInterval函数的"this"而不是父对象呢?我知道箭头的功能没有词法这个属于自己的,但有什么办法来规避这一点,除了写一个非箭头功能?
javascript this ecmascript-6
ecmascript-6 ×1
javascript ×1
this ×1