- 箭头函数 this指向其上下文,普通函数的 this 指向调用它的对象
- 箭头函数相当于匿名函数,简化了函数定义,不能作为构造函数,也不能创建实例。
var fun = (x,y) => {
return x*y
};
var a = new fun(); //报错:fun is not a constructor
- 箭头函数不能绑定 arguments,
- 箭头函数通过 call(), apply() 调用函数时,只传参,不改变this 指向
- 箭头函数没有原型属性。
var fun = (x,y) => {
return x*y
};
var a = new fun(); //报错:fun is not a constructor