Skip to content

[js] 第172天 ES5和ES6、ES7有什么区别? #1298

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

第172天 ES5和ES6、ES7有什么区别?

Activity

wwqin

wwqin commented on Oct 5, 2019

@wwqin

首先就是版本不同(显而易见),每个版本都有新特性也可以说是这几个版本的区别吧
ES5

  • 严格模式
  • JSON API
  • object API
  • Array API

ES6

  • class 类
  • 模块化 import export
  • 箭头函数
  • 模板字符串
  • Promise
  • async/await
  • 解构赋值
  • let和const
  • 函数参数默认值

ES7

  • Array.prototype.includes
  • 指数运算符**
LeiDeMing

LeiDeMing commented on Dec 18, 2019

@LeiDeMing

参考博客

ES6

请参考阮一峰ES6

ES7

1. Array.prototype.includes

2. 指数操作符

在ES7中引入了指数运算符**,**具有与Math.pow(..)等效的计算结果。

ES8

1. async/await

2. Object.values()

3. Object.entries()

4. String.prototype.padStart()/String.prototype.padEnd()

5. Object.getOwnPropertyDescriptors()

wind8866

wind8866 commented on Mar 21, 2022

@wind8866

这里其实是非标准叫法
ES5指ES2015(不包括)以前的标准版本
ES6指当前ES2015~至今已发布的版本
ES7指在草案中未正式发布的版本,更合理一点的说法应该是ESNEXT

xiaoqiangz

xiaoqiangz commented on Aug 4, 2022

@xiaoqiangz

ES6: 新增了箭头函数、块级作用域、class、promise、解构赋值、默认参数、模板字符串、async/await、剩余参数、展开运算符
ES7: 新增API Array.prototype.includes
ES5: 继承是原型链继承,ES6则引进了extend关键字,声明类 ES6新增了class关键字、ES6还可以设置默认参数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsJavaScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@LeiDeMing@xiaoqiangz@wwqin@wind8866

        Issue actions

          [js] 第172天 ES5和ES6、ES7有什么区别? · Issue #1298 · haizlin/fe-interview