# ES6-新增特性一览

ecma-263 (opens new window)是ES6规范的官网文档,该文档是英文版,而且里面洋洋洒洒写了每个特性的实现步骤,容易看晕。这里推荐@阮一峰老师的ECMAScript 6 入门 (opens new window)es6features (opens new window)项目,以下每个特性详细案例描述也是外链该项目内容。

以下默认陈述的是ES6标准,部分标注ES7、ES8标准是为了表明其最终发布时间(严谨)。其实大部分在2015年6月(ES6发布时间)都进入了草案阶段(Stage 2),故在babel等转译工具下,都可以使用这些特性在前端工程项目中。

# 1. let/const取代var (opens new window)

# 2. 字符串模板 (opens new window)

# 3. 对象解构 (opens new window)

  • Destructuring
  • enhanced object literals({foo} === {foo:foo})

# 4. 新数据类型Symbol (opens new window)

# 5. 新数据结构Map/Set/WeakMap/WeakSet (opens new window)

# 6. Proxy (opens new window)、Reflect

# 7. 扩展

  • Array
    • Array.from()
    • Array.of()
    • Array.copyWithin()
    • Array.find()
    • Array.findIndex()
    • Array.fill()
    • Array.includes()ES7
  • Object
    • Object.keys()
    • Object.values()ES8
    • Object.entries()ES8
    • Object.assign()
    • Object. is()
  • Function
  • Number
    • Number.isNuN()
    • Number.isFinite()
    • Number.parseInt()
    • Number.parseFloat()
    • Number.isInteger()
    • Number.isSafeInteger()
  • Math
    • Math.max(x, y)
    • Math.trunc(x)
    • Math.sign(x)
    • Math.acosh(x)
    • Math.asinh(x)
    • Math.atanh(x);
    • Math.cbrt(x)
    • Math.clz32(x)
    • Math.cosh(x)
    • Math.expm1(x)
    • Math.fround(x)
    • Math.hypot(...values)
    • Math.imul(x, y)
    • Math.log1p(x)
    • Math.log10(x)
    • Math.log2(x)
    • Math.tanh(x)

# 8. 异步

# 9. Class类 (opens new window)

  • class
  • extends
  • decoratorES7

# 10. Module (opens new window)

  • import
  • export

# 参考文档