- 在箭头函数内部打印this,会指向上一层 this,因为箭头函数没有 this。参考:JS 的 this 指向问题
- 没有arguments
let sum = (a, b) => {
console.log(arguments)
}
function word(word) {
console.log(arguments)
}
word("hihi")
sum(1,2)
- 不能对箭头函数进行 new 操作
let Sum = (a, b) => {
}
function Word(word) {
}
let w = new Word("1");
console.log(w);
let s = new Sum(1, 3);
console.log(s)
- 没有原型(prototype) 和super
let Sum = (a, b) => {
}
function Word(word) {
}
console.log(Word.prototype);
console.log(Sum.prototype);