ES6 - ES12 都出现了哪些新特性?
参考答案
- ES6 (2015):let/const、箭头函数、class、模板字符串、解构、默认/rest 参数、模块、Promise、Symbol、Map/Set、Proxy/Reflect、生成器与迭代器
- ES7 (2016):
**指数、Array.prototype.includes - ES8 (2017):async/await、
Object.values/entries、字符串补白padStart/padEnd、Object.getOwnPropertyDescriptors、尾逗号 - ES9 (2018):异步迭代
for await...of、对象 rest/spread、Promise.prototype.finally、正则命名组/后行断言 - ES10 (2019):
flat/flatMap、Object.fromEntries、trimStart/End、Symbol.description、可选 catch 绑定、BigInt - ES11 (2020):
??、?.、Promise.allSettled、BigInt完善、import()、globalThis、matchAll - ES12 (2021):
&&= ||= ??=、数字分隔符_、Promise.any、WeakRef、FinalizationRegistry、replaceAll