New features of ECMAScript 2016 (ES7)


brief introduction

Since ES6 (ECMAScript 2015) was released in 2015, ECMAScript has been developing at the rate of one version per year. Now it’s ECMAScript 2020.

Each version has some new features. Today, this article will explain the new features in ES7.

TC39 and ECMAScript

First of all, let’s talk about the history of ECMA. ECMA was founded on April 27, 1960 as a manufacturer’s Association. Its purpose is to unify standards and facilitate transplantation among different manufacturers. So the association was named European Computer Manufacturers Association (ECMA).

In 1994, in order to reflect the global activities of ECMA, it was renamed European Association for standardizing information and communication systems. Although the name still retains the words of Europe, it is already an international association.

Let’s take a look at the members of ECMA. The members with the highest priority are called ordinary members, which are basically composed of large international companies

New features of ECMAScript 2016 (ES7)

Then the next level is called associate members

New features of ECMAScript 2016 (ES7)

We can see that there are several Chinese companies in it, which shows that China has a certain say in the world’s rule making.

TC39 is a special committee of ECMA association to specify ECMAScript standard. TC means technical committees.

There are many TCS under ECMA, and TC39 is specifically responsible for the development of ECMAScript.

TC39 is further divided into two task groups. namely:

  • TC39-TG1 — General ECMAScript ® Language is responsible for the development of ECMAScript
  • TC39-TG2 — ECMAScript ® Internationalization API specification is responsible for the formulation of ECMAScript internationalization API

We know that Es5 was formulated in 2009, while ECMAScript 2015 (ES6) was formulated in 2015. Because ES6 contains six years of changes, the changes of ES6 are very large.

In order to reduce the pressure of major manufacturers to upgrade and adapt to ECMA scripts, the ECMA association has decided to issue an ECMA version every year since ES6.

Let’s explain how ECMAScript is released. The release of ECMAScript is mainly divided into the following five stages:

  • Stage 0: strawman

This is the stage of Free submission, but the committer must be TC39 member or TC39 contributor.

  • Stage 1: proposal

After the strawman of stage 0 is reviewed by TC39, it comes to the proposal stage.

At this stage, we must know who is responsible for the proposal, and we need to submit examples of the proposal, API, semantics and algorithm implementation. It is also necessary to identify possible conflicts between the proposal and existing functions.

If this proposal is accepted by TC39. So TC39 will continue to follow up this proposal.

  • Stage 2: draft

This is the first version of the proposal, which must also have a formal description of the syntax and semantics of the function (using the formal language of the ECMAScript specification). The description needs to be as complete as possible, but can include to-do items and placeholders.

  • Stage 3: candidate

Most of the proposals at this stage have been completed, and we need to adjust them according to the feedback of users.

  • Stage 4: finished

Proposals for this phase are ready to be included in the next ECMAScript release.

New features of ECMAScript 2016 (ES7)

In fact, ECMAScript 2016 (ES7) has only two new features:

  • Array.prototype.includes
  • Exponentiation operator (**)

A new method of array include

ES7 adds a new method, includes, to array. Let’s take a look at the following examples:

> ['a', 'b', 'c'].includes('a')
> ['a', 'b', 'c'].includes('d')

Take a look at the definition of includes

Array.prototype.includes(value : any) : boolean

If the value is included in the array, it will return true. If it is not included, it will return false.

You can see that includes and indexof are similar


Equivalent to:

arr.indexOf(x) >= 0

The difference between them is that includes can find Nan, but indexof can’t:

> [NaN].includes(NaN)
> [NaN].indexOf(NaN)

In addition, include does not distinguish between + 0 and – 0

> [-0].includes(+0)

We know that in JS, besides array, there are also typed array, such as:

  • Int8Array
  • Uint8Array
  • Uint8ClampedArray
  • Int16Array
  • Uint16Array
  • Int32Array
  • Uint32Array
  • Float32Array
  • Float64Array
  • BigInt64Array
  • BigUint64Array

Therefore, the includes method is also applicable to typedarray:

let tarr = Uint8Array.of(12, 5, 3);
console.log(tarr.includes(5)); // true

Power operator**

ES7 introduces the power operator * *:

> 6 ** 2

The above example shows 6 to the power of 2.

The value of X * * y is equivalent to math. Pow (x, y).

Let’s look at the basic use of the power operator

const squared = 3 ** 2; // 9

let num = 3;
num **= 2;
console.log(num); // 9

function dist(x, y) {
  return Math.sqrt(x**2 + y**2);

The power operator has a very high priority,* > > +

> 2**2 * 2
> 2 ** (2*2)


There are only two new features of ES7, which are relatively simple. I will introduce them here today.

Author: what about the flydean program

Link to this article:

Source: flydean’s blog

Welcome to my official account: the most popular interpretation of “those things”, the most profound dry cargo, the most concise tutorial, and many small tricks you don’t know, etc. you’ll find them!