Home  >  Article  >  Web Front-end  >  What is ECMAScript6?

What is ECMAScript6?

零下一度
零下一度Original
2017-06-23 09:33:051749browse

ECMAScript 6.0 (hereinafter referred to as ES6) is the next generation standard of the JavaScript language and was officially released in June 2015. Its goal is to enable the JavaScript language to be used to write complex large-scale applications and become an enterprise-level development language.


1. The relationship between ECMAScript and JavaScript


A common question is, ECMAScript What's the relationship with JavaScript?

To clarify this issue, we need to review history. In November 1996, Netscape, the creator of JavaScript, decided to submit JavaScript to ECMA, the international standardization organization, hoping that this language could become an international standard. The following year, ECMA released the first version of Standard Document No. 262 (ECMA-262), which stipulated the standard for browser scripting language and called this language ECMAScript. This version is version 1.0.

This standard has been developed for the JavaScript language from the beginning, but there are two reasons why it is not called JavaScript. One is trademark. Java is a trademark of Sun. According to the licensing agreement, only Netscape can legally use the name JavaScript, and JavaScript itself has been registered as a trademark by Netscape. Second, I want to show that the developer of this language is ECMA, not Netscape, which will help ensure the openness and neutrality of this language.

Therefore, the relationship between ECMAScript and JavaScript is that the former is a specification of the latter, and the latter is an implementation of the former (other ECMAScript dialects include Jscript and ActionScript). In everyday situations, these two words are interchangeable.


2. The relationship between ES6 and ECMAScript 2015


The word ECMAScript 2015 (referred to as ES2015) is also often seen. How does it relate to ES6?

In 2011, after ECMAScript version 5.1 was released, the development of version 6.0 began. Therefore, the original meaning of the word ES6 refers to the next version of the JavaScript language.

However, because this version introduces too many grammatical features, and during the formulation process, many organizations and individuals continue to submit new features. It quickly became clear that it would not be possible to include all the features that would be introduced in one release. The conventional approach is to release version 6.0 first, then version 6.1 after a while, then version 6.2, version 6.3 and so on.

However, the standard setters did not want to do this. They want to make standard upgrades a regular process: anyone, at any time, can submit proposals for new syntax to the standards committee, which then meets monthly to evaluate whether the proposals are acceptable and what improvements are needed. If after many meetings, a proposal is mature enough, it can officially enter the standard. This means that standard version upgrades become a rolling process, with changes every month.

The Standards Committee finally decided that the standard would be officially released in June every year as the official version of that year. In the following time, changes will be made based on this version. Until June of the next year, the draft will naturally become the new year's version. This way, the previous version number is not needed, just the year stamp.

The first version of ES6 was released in June 2015, and its official name is "ECMAScript 2015 Standard" (ES2015 for short). In June 2016, the slightly revised "ECMAScript 2016 Standard" (ES2016 for short) was released as scheduled. This version can be regarded as the ES6.1 version, because the difference between the two is very small (only the includes of array instances are added method and exponentiation operator), basically the same standard. According to the plan, the ES2017 standard will be released in June 2017.

Therefore, ES6 is both a historical term and a general term. It means the next generation standard of JavaScript after version 5.1, covering ES2015, ES2016, ES2017, etc., while ES2015 is the official name, specifically referring to The official version of the language standard released that year. When ES6 is mentioned in this book, it usually refers to the ES2015 standard, but sometimes it also refers to the "next generation JavaScript language" in general.


3. Approval process for grammar proposals


Anyone can submit a proposal to the Standards Committee (also known as the TC39 Committee) Proposal to revise language standards.

A new grammar needs to go through five stages from being a proposal to becoming a formal standard. Changes at each stage require approval by the TC39 committee.

  • Stage 0 - Strawman (presentation stage)

  • Stage 1 - Proposal (comment solicitation stage)

  • Stage 2 - Draft

  • Stage 3 - Candidate

  • Stage 4 - Finished Stage)

As long as a proposal can enter Stage 2, it will almost certainly be included in future formal standards. All current proposals for ECMAScript can be viewed at TC39’s official website Github.com/tc39/ecma262.

One of the writing goals of this book is to track the latest progress of the ECMAScript language and introduce all new syntax after version 5.1. New syntaxes that are clearly or promisingly destined for inclusion in the standard will be introduced.


4. History of ECMAScript


ES6 from the beginning to the end It took 15 years for it to be released.

As mentioned earlier, ECMAScript 1.0 was released in 1997. In the next two years, ECMAScript 2.0 (June 1998) and ECMAScript 3.0 (December 1999) were released continuously. Version 3.0 was a huge success. It was widely supported in the industry and became a common standard. It established the basic syntax of the JavaScript language and is fully inherited by subsequent versions. To this day, when beginners start learning JavaScript, they are actually learning version 3.0 syntax.

In 2000, ECMAScript 4.0 began to be brewed. This version ultimately failed, but most of its content was inherited by ES6. Therefore, the starting point for the formulation of ES6 is actually 2000.

Why didn’t ES4 pass? Because this version was too radical and a complete upgrade to ES3, some members of the standards committee were unwilling to accept it. ECMA's Technical Committee 39 (TC39) is responsible for formulating the ECMAScript standard, and its members include major companies such as Microsoft, Mozilla, and Google.

In October 2007, the draft version 4.0 of ECMAScript was released, and the official version was originally expected to be released in August of the following year. However, there are serious differences between the parties on whether to adopt this standard. Large companies, led by Yahoo, Microsoft, and Google, oppose major upgrades to JavaScript and advocate minor changes; Mozilla, headed by JavaScript creator Brendan Eich, insists on the current draft.

In July 2008, due to the great differences between the parties and the fierce debate on which functions should be included in the next version, ECMA decided to suspend the development of ECMAScript 4.0 and remove some of the aspects related to the improvement of existing functions. A small part was released as ECMAScript 3.1, while other radical ideas were expanded and put into later versions. Due to the atmosphere of the conference, the project codename of this version was Harmony. Shortly after the meeting, ECMAScript 3.1 was renamed ECMAScript 5.

In December 2009, ECMAScript version 5.0 was officially released. The Harmony project was divided into two. Some more feasible ideas were named JavaScript.next and continued to be developed, and later evolved into ECMAScript 6; some less mature ideas were regarded as JavaScript.next.next and will be developed in the further future. Consider launching again. The overall consideration of the TC39 committee is that ES5 will remain basically compatible with ES3, and major syntax corrections and new features will be completed by JavaScript.next. At that time, JavaScript.next referred to ES6, and after the sixth version was released, it referred to ES7. TC39’s judgment is that ES5 will become the mainstream standard for JavaScript development in mid-2013 and will maintain this position for the next five years.

In June 2011, ECMAscript version 5.1 was released and became an ISO international standard (ISO/IEC 16262:2011).

In March 2013, the ECMAScript 6 draft was frozen and no new features will be added. New functionality is envisioned to be put into ECMAScript 7.

In December 2013, the ECMAScript 6 draft was released. This will then be followed by a 12-month discussion period to hear feedback from all parties.

In June 2015, ECMAScript 6 was officially adopted and became an international standard. Counting from 2000, 15 years have passed.


6.Babel transcoder


Babel is a widely used ES6 transcoder The coder can convert ES6 code into ES5 code so that it can be executed in the existing environment. This means that you can write programs in ES6 without worrying about whether your existing environment supports it. The following is an example

1 // 转码前2 input.map(item => item + 1);3 4 // 转码后5 input.map(function (item) {6   return item + 1;7 });

The original code above uses arrow functions. Babel converts it into a normal function, which can be executed in a JavaScript environment that does not support arrow functions.

The above is the detailed content of What is ECMAScript6?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn