all-of-javascript icon indicating copy to clipboard operation
all-of-javascript copied to clipboard

箭头函数的 this 指向

Open cbbfcd opened this issue 6 years ago • 0 comments

这个问题本身就是一个错误的问题。

箭头函数中是没有 this、prototype、arguments 等!!只是单纯的在包裹函数中的词法作用域继承其 this 而已!!

所以并不是我们常用的 var self = this 之类的hack

参见: 阮一峰issue中的讨论 MDN

cbbfcd avatar Sep 05 '18 12:09 cbbfcd