lxinr/interview-question

2021/03/01 - 箭头函数和普通函数的区别

lxinr opened this issue · 0 comments

lxinr commented

箭头函数表达式的语法比函数表达式更短,并且不绑定自己的this,arguments,super或 new.target。这些函数表达式最适合用于非方法函数(non-method functions),并且它们不能用作构造函数

  1. 箭头函数没有this,在箭头函数中访问的this实际来自于外部词法环境
  2. 箭头函数没有arguments
  3. 箭头函数不能使用new进行调用
  4. 箭头函数没有super
  5. 箭头函数没有原型