New features of ES7



ECMAScript 2015 (ES6) adds a lot of new content, which was standardized nearly six years after ES5 was released (2009-11-2015-6). There are two main reasons for the time span between the two releases:

  • The features that are first completed than the new version must wait for the completion of the new version before they can be released.
  • Those features that take a long time to complete are also under great pressure to be included in this release, because if postponing to the next release means waiting a long time, this feature will also postpone the new release.

Therefore, starting with ECMAScript 2016 (ES7), versions will be released more frequently, with a new version released every year, so that new content will be smaller. The new version will include all features completed before the annual deadline.

How to Design ECMAScript

TC39 (Committee to Promote JavaScript Development) Design Process

Recommendations for each ECMAScript feature will start at Phase 0 and then go through the following maturation stages. From one stage to the next, it must be approved by TC39.

Stage 0: Strawman draft

What is Strawman?

A free-form idea to advance the development of ECMAScript. The idea must be submitted by members of TC39, and if it is a non-member, it must be registered as a contributor to TC39 before it can be submitted.


Documents must be considered at the TC39 meeting before they can be added to the Stage 0 recommendation page.

What is Draft?The draft is the first version of the specification. It does not differ much from the features contained in the final standard.

Requirements:It is suggested that formal descriptions of the grammar and semantics of this feature (using the formal language of the ECMAScript standard) should be added at this time. The instructions should be as complete as possible, but they can include to-do items and placeholders. This feature requires two experimental implementations, one of which can be implemented in a Babel-like transpiler.

Next step:Only incremental adjustments are accepted from this stage.

Phase 3: Candidate candidates

What is Candidate?At the candidate stage, the proposal is basically completed, and feedback will be obtained from both the implementation process and user usage to further improve the proposal.

Requirements:The specification document must be complete. The designated reviewer (designated by TC39 rather than the leader) and the editor of the ECMAScript specification must sign the specification. There are at least two conforming implementations (no default implementations need to be specified).

Next step:Thereafter, the recommendations will only be revised if major problems arise in the process of implementation and use.

Stage 4: Finished Completion

What is Finished?Suggestions are ready to be added to the standard.

Requirements:It is suggested that the following points should be met before entering the completion stage:

  • Test 262 acceptance tests (basically unit tests written in JavaScript to validate language features).
  • Two conforming implementations that passed the test.
  • Important practical experience related to feature implementation.
  • ECMAScript Specification Editor’s Signature on Specification Text.

Next step:It is suggested that the ECMAScript specification be added as soon as possible. When the norm passes the annual review as a standard, the proposal formally becomes part of the standard.

New features of ECMAScript 2016

Features included in ES2016

  • Array.prototype.includes
  • Exponential operator


The Array. prototype. includes method returns a Boolean value indicating whether an array contains a given value, similar to the includes method of a string.

[1, 2, 3].includes(2)     // true
[1, 2, 3].includes(4)     // false

If the incoming value is in the current array (this), return true, otherwise return false

The includes method is very similar to the indexOf method. The following two expressions are equivalent:

arr.indexOf(x) >= 0

The only difference is that the include () method can find NaN, but indexOf () can’t:


Incudes does not distinguish between + 0 and – 0 (which is also consistent with other JavaScript features):

  • Why is the method named?includesInstead ofcontains? The latter is the initial choice, but it will destroy the existing code on the web (MooTools in theArray.prototypeContains method was added.
  • Why is the method named?includesInstead ofhas? Has is usually used for keys (Map. prototype. has), and includes for elements (String. prototype. includes). Elements in a set can be treated as eitherkeyIt can also be regarded asvalueSo Set. prototype. has (not included).
  • ES6String.prototype.includesMethod can be used for strings, not for characters. Is this harmony?Array.prototype.includesAtypism? If the includes method of arrays and strings works the same way, then the includes method of arrays should accept arrays instead of array elements. However, both include methods refer to the indexOf method; characters are usually special cases, and strings of arbitrary length are more common.

2. Exponential Operator

The newly proposed feature is to use ** as the infix operator for exponential operations:

2 ** 2 // 4
2 ** 3 // 8

One of the characteristics of this operator is that it combines right rather than left. When multiple exponential operators are used together, they are calculated from the rightmost side.

// Equivalent to 2 ** (3 ** 2)
2 ** 3 ** 2
// 512

In the above code, the second exponential operator is calculated first, not the first.

The exponential operator can be combined with the equal sign to form a new assignment operator (**=).

let a = 1.5;
a **= 2;
// Equivalent to a = a * a;

let b = 4;
b **= 3;
// Equivalent to B = b * b * b;

Note that the exponential operators of the V8 engine andMath.powThe implementation is different, and there will be slight differences between the two for very large results.


Recommended Today

The construction tool of C ා

What’s the motivation for writing this article? Why do you want to study the build tool (see. Csproj), create a new C project with visual studio IDE, and click build to run it? A: please refer to this_minutes_before_coding. I call it “engineering.”. Engineering development is not just about opening IDE and creating new projects. It […]