Skip to content

Latest commit

 

History

History
3 lines (2 loc) · 414 Bytes

2.10.md

File metadata and controls

3 lines (2 loc) · 414 Bytes

2.10 为什么 ES6 有带 => 的箭头函数,而没有带 -> 的箭头函数?

ECMAScript 6 对于函数有词法 this 的语法,就是所谓的箭头函数。但是,对于函数没有动态 this 的箭头函数语法。这是故意的;方法定义覆盖了带 -> 箭头的函数的绝大多数使用场景。如果真的需要动态的 this ,你可以使用传统的函数表达式。