ES6(es2015)

  • 1.类(class)
  • 2.模块化(Module)
    • 导出(export)
    • 导入(import)
  • 3.箭头(Arrow)函数
    • 箭头函数的结构
    • 卸载监听器时的陷阱
  • 4.函数参数默认值
  • 5.模板字符串
  • 6.解构赋值
    • 获取数组中的值
    • 获取对象中的值
  • 7.延展操作符(Spread operator)
  • 8.对象属性简写
  • 9.Promise
  • 10.支持let与const

    ES7(es2016)

  • Array.prototype.includes()

  • 指数操作符 **

    ES8(es2017)

  • async/await

  • Object.values()
  • Object.entries()
  • String padding: padStart()padEnd(),填充字符串达到当前长度
  • 函数参数列表结尾允许逗号
  • Object.getOwnPropertyDescriptors()
  • ShareArrayBufferAtomics对象,用于从共享内存位置读取和写入

    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