ES6(es2015)
- 1.类(class)
- 2.模块化(Module)
- 导出(export)
- 导入(import)
- 3.箭头(Arrow)函数
- 箭头函数的结构
- 卸载监听器时的陷阱
- 4.函数参数默认值
- 5.模板字符串
- 6.解构赋值
- 获取数组中的值
- 获取对象中的值
- 7.延展操作符(Spread operator)
- 8.对象属性简写
- 9.Promise
-
ES7(es2016)
Array.prototype.includes()
-
ES8(es2017)
async/await
Object.values()
Object.entries()
- String padding:
padStart()
和padEnd()
,填充字符串达到当前长度 - 函数参数列表结尾允许逗号
Object.getOwnPropertyDescriptors()
ShareArrayBuffer
和Atomics
对象,用于从共享内存位置读取和写入ES9(es2018)
异步迭代
- Promise.finally()
- Rest/Spread 属性
- 正则表达式命名捕获组(Regular Expression Named Capture Groups)
- 正则表达式反向断言(lookbehind)
- 正则表达式dotAll模式
- 正则表达式 Unicode 转义
- 非转义序列的模板字符串
ES10(es2019)
- 行分隔符(U + 2028)和段分隔符(U + 2029)符号现在允许在字符串文字中,与JSON匹配
- 更加友好的 JSON.stringify
- 新增了Array的
flat()
方法和flatMap()
方法 - 新增了String的
trimStart()
方法和trimEnd()
方法 Object.fromEntries()
Symbol.prototype.description
String.prototype.matchAll
Function.prototype.toString()
现在返回精确字符,包括空格和注释- 简化
try {} catch {}
,修改catch
绑定 - 新的基本数据类型
BigInt
- globalThis
- import()
- Legacy RegEx
- 私有的实例方法和访问器
空值合并运算符(Nullish coalescing Operator)
ES11(es2020)
Promise.allSettled
- 可选链(Optional chaining)
import.meta
Promise.any
- WeakRefs
String.prototype.replaceAll