ECMAScript 6(以下簡稱ES6)是JavaScript語言的下一代標(biāo)準(zhǔn)寻拂。因為當(dāng)前版本的ES6是在2015年發(fā)布的征字,所以又稱ECMAScript 2015防症。
最常用的ES6特性
let, const, class, extends, super, arrow functions, template string, destructuring, default, rest arguments
3) class, extends, super
這三個特性涉及了ES5中最令人頭疼的的幾個部分:原型赌结、構(gòu)造函數(shù)吃环,繼承...你還在為它們復(fù)雜難懂的語法而煩惱嗎羹饰?你還在為指針到底指向哪里而糾結(jié)萬分嗎伊滋?? ?有了ES6我們不再煩惱!
classAnimal{ constructor(){this.type='animal' } says(say){ console.log(this.type+ ' says ' + say) }}let animal =newAnimal()animal.says('hello')//animal says helloclassCatextendsAnimal{ constructor(){super()this.type='cat' }}let cat =newCat()cat.says('hello')//cat says hello