1企蹭,constructor && super
圖片.png
圖片.png
圖片.png
圖片.png
2,箭頭函數(shù) => 拯救 => setTimeout里面的this
圖片.png
圖片.png
第三種方法箭頭函數(shù)
class Animal {
constructor(){
this.type = 'animal'
}
says(say){
setTimeout( () => {
console.log(this.type + ' says ' + say)
}, 1000)
}
}
var animal = new Animal()
animal.says('hi') //animal says hi
圖片.png
3挖诸,模板字符串 &&模板變量
圖片.png
4汁尺,解構(gòu)
圖片.png