- 继承外层作用域,没有独立作用域
var obj={
commonFn:function(){
console.log(this)
},
arrowFn:()=>{
console.log(this)
}
}
obj.commonFn() //this指向的是obj作用域
obj.arrowFn() //this指向的是obj所在的作用域window
- 不能用在构造函数
let Ger=function(){
}
let Aer=new Ger() //输出undefined
let Ger=()=>{
}
let Aer=new Ger() //报错
- 没有prototype属性
let Func1=function(){
}
let Func2=()=>{
}
console.log(Func1.prototype) //__proto__:Object
console.log(Func2.prototype) //undefined