箭头函数中的 this

JS 每一个 function 都有自己独立的运行上下文,但箭头函数不属于普通的 function,所以没有独立的上下文。
所以在箭头函数里写的 this 其实是包含该箭头函数最近的一个 function 上下文中的 this(如果没有最近的 function,就是全局)。

posted on 2017-06-29 17:11  cag2050  阅读(182)  评论(0编辑  收藏  举报

导航