没有独立作用域
var obj = {
commonFn : function() {
console.log(this)
},
arrowFn : () => {
console.log(this)
}
}
第一个打印 obj 本身
第二个打印出 window 的作用域
obj.commonFn();
obj.arrowFn();
不能用作构造函数
let Animal = function (){
}
let animal = new Animal()
console.log(animal)
打印出大的 Animal 对象
就是调用了大 Animal 构造函数
----------------
换成箭头函数
let Animal = () => {
}
let animal = new Animal()
说明箭头函数没有构造方法
没有 prototype
let commonFn = function() {
};
let arrowFn = () => {
};
console.log(commonFn.prototype)
console.log(arrowFn.prototype)