<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] # 1. 關于 ECMAScript 6 (ES6) 雖然花了很長時間才完成,但是 ECMAScript 6(下一個版本的JavaScript)規范,終于標準化了: - 它在[2015年6月17日成為了標準](http://www.ecma-international.org/news/Publication%20of%20ECMA-262%206th%20edition.htm). - 它的大多數特性已經廣泛可用(如 kangax 的 [ES6兼容性表](http://kangax.github.io/compat-table/es6/))。 - 轉譯器(Transpilers)(如 [Babel](https://babeljs.io/))可以將 ES6 編譯為 ES5語法。 下一節將解釋在 ES6 世界中重要的概念。 ## 1.1 TC39 (Ecma技術委員會 39) [TC39 (Ecma Technical Committee 39)](http://www.ecma-international.org/memento/TC39.htm)是發展JavaScript的委員會。Its members are companies (among others, all major browser vendors). [TC39 meets regularly](http://www.ecma-international.org/memento/TC39-M.htm), its meetings are attended by delegates that members send and by invited experts. Minutes of the meetings are [available online](https://github.com/tc39/tc39-notes) and give you a good idea of how TC39 works. ## 1.2 ECMAScript 6是如何設計的 The ECMAScript 6 design process centers on *proposals* for features. Proposals are often triggered by suggestions from the developer community. To avoid design by committee, proposals are maintained by *champions* (1–2 committee delegates). A proposal goes through the following steps before it becomes a standard: - Sketch (informally: “strawman proposal”): A first description of the proposed feature. - Proposal: If TC39 agrees that a feature is important, it gets promoted to official proposal status. That does not guarantee it will become a standard, but it considerably increases its chances. The deadline for ES6 proposals was May 2011. No major new proposals were considered after that. - Implementations: Proposed features must be implemented. Ideally in two JavaScript engines. Implementations and feedback from the community shape the proposal as it evolves. - Standard: If the proposal continues to prove itself and is accepted by TC39, it will eventually be included in an edition of the ECMAScript standard. At this point, it is a standard feature. \[Source of this section: “[The Harmony Process](http://tc39wiki.calculist.org/about/harmony/)” by David Herman.\] ### 1.2.1 在ES6之后的設計過程 Starting with ECMAScript 2016 (ES7), TC39 will time-box releases. A new version of ECMAScript will be released every year, with whatever features are ready at that time. That means that from now on, ECMAScript versions will be relatively small upgrades. For more information on the new process, including finished and upcoming feature proposals, consult [the GitHub repository `ecma262`](https://github.com/tc39/ecma262). ## 1.3 JavaScript 對比 ECMAScript JavaScript is what everyone calls the language, but that name is trademarked (by Oracle, which inherited the trademark from Sun). Therefore, the official name of JavaScript is *ECMAScript*. That name comes from the standards organization Ecma, which manages the language standard. Since ECMAScript’s inception, the name of the organization has changed from the acronym “ECMA” to the proper name “Ecma”. Versions of JavaScript are defined by specifications that carry the official name of the language. Hence, the first standard version of JavaScript is ECMAScript 1 which is short for “ECMAScript Language Specification, Edition 1”. ECMAScript x is often abbreviated ESx. ## 1.4 升級到ES6 The stake holders on the web are: - Implementors of JavaScript engines - Developers of web applications - Users These groups have remarkably little control over each other. That’s why upgrading a web language is so challenging. On one hand, upgrading engines is challenging, because they are confronted with all kinds of code on the web, some of which is very old. You also want engine upgrades to be automatic and unnoticeable for users. Therefore, ES6 is a superset of ES5, nothing is removed[1](leanpub-endnotes.html#fn-introduction_1). ES6 upgrades the language without introducing versions or modes. It even manages to make strict mode the de-facto default (via modules), without increasing the rift between it and sloppy mode. The approach that was taken is called “One JavaScript” and explained in [a separate chapter](ch_one-javascript.html#ch_one-javascript). On the other hand, upgrading code is challenging, because your code must run on all JavaScript engines that are used by your target audience. Therefore, if you want to use ES6 in your code, you only have two choices: You can either wait until no one in your target audience uses a non-ES6 engine, anymore. That will take years; mainstream audiences were at that point w.r.t. ES5 when ES6 became a standard in June 2015. And ES5 was standardized in December 2009! Or you can compile ES6 to ES5 and use it now. More information on how to do that is given in the book “[Setting up ES6](https://leanpub.com/setting-up-es6)”, which is free to read online. Goals and requirements clash in the design of ES6: - Goals are fixing JavaScript’s pitfalls and adding new features. - Requirements are that both need to be done without breaking existing code and without changing the lightweight nature of the language. ## 1.5 Goals for ES6 [The original project page for Harmony/ES6](http://wiki.ecmascript.org/doku.php?id=harmony:harmony) mentions several goals. In the following subsections, I’m taking a look at some of them. ### 1.5.1 目標:成為更好的語言 The goal is: Be a better language for writing: 1. complex applications; 2. libraries (possibly including the DOM) shared by those applications; 3. code generators targeting the new edition. Sub-goal (i) acknowledges that applications written in JavaScript have grown huge. A key ES6 feature fulfilling this goal is built-in modules. Modules are also an answer to goal (ii). As an aside, the DOM is notoriously difficult to implement in JavaScript. [ES6 Proxies](ch_proxies.html#ch_proxies) should help here. Several features were mainly added to make it easier to compile to JavaScript. Two examples are: - `Math.fround()` – rounding Numbers to 32 bit floats - `Math.imul()` – multiplying two 32 bit ints They are both useful for, e.g., compiling C/C++ to JavaScript via [Emscripten](https://github.com/kripken/emscripten). ### 1.5.2 目標:提高交互性 The goal is: Improve interoperation, adopting de facto standards where possible. Examples are: - Classes: are based on how constructor functions are currently used. - Modules: picked up design ideas from the CommonJS module format. - Arrow functions: have syntax that is borrowed from CoffeeScript. - Named function parameters: There is no built-in support for named parameters. Instead, the existing practice of naming parameters via object literals is supported via [destructuring in parameter definitions](ch_parameter-handling.html#sec_named-parameters). ### 1.5.3 目標:版本控制 The goal is: Keep versioning as simple and linear as possible. As mentioned previously, ES6 avoids versioning via “[One JavaScript](ch_one-javascript.html#ch_one-javascript)”: In an ES6 code base, everything is ES6, there are no parts that are ES5-specific. ## 1.6 ES6 特性的類別 The introduction of the ES6 specification lists all new features: > Some of \[ECMAScript 6’s\] major enhancements include modules, class declarations, lexical block scoping, iterators and generators, promises for asynchronous programming, destructuring patterns, and proper tail calls. The ECMAScript library of built-ins has been expanded to support additional data abstractions including maps, sets, and arrays of binary numeric values as well as additional support for Unicode supplemental characters in strings and regular expressions. The built-ins are now extensible via subclassing. 在特性上主要有三大類別: - Better syntax for features that already exist (e.g. via libraries). For example: - [Classes](ch_classes.html#ch_classes) - [Modules](ch_modules.html#ch_modules) - New functionality in the standard library. For example: - New methods for [strings](ch_strings.html#ch_strings) and [Arrays](ch_arrays.html#ch_arrays) - [Promises](ch_promises.html#ch_promises) - [Maps, Sets](ch_maps-sets.html#ch_maps-sets) - Completely new features. For example: - [Generators](ch_generators.html#ch_generators) - [Proxies](ch_proxies.html#ch_proxies) - [WeakMaps](ch_maps-sets.html#sec_weakmap) ## 1.7 ECMAScript簡史 本節描述在ECMAScript 6 發展史。 ### 1.7.1 早期:ECMAScript 1-3 - **ECMAScript 1 (June 1997)** 是JavaScript語言標準的第一個版本。 - **ECMAScript 2 (June 1998)** 包含了一些小的變化,以保持規范與單獨的 JavaScript ISO 標準同步。 - **ECMAScript 3 (December 1999)** 引入了許多已經成為該語言流行部分的特性,如 ES6 規范的介紹中所述:“`[…]`、正則表達式、更好的字符串處理、新的控制語句、`try/catch`異常處理、更嚴格的錯誤定義、數值輸出的格式化和其他增強。” ### 1.7.2 ECMAScript 4 (2008年7月被遺棄) 在 1999 年 ES3 發布之后,就開始了 ES4 的制定工作。在 2003 年,發布了一份臨時報告,在這之后 ES4 的制定工作就暫停了。 Adobe 的 ActionScript 和微軟的 JScript.NET 實現了臨時報告中所描述語言的子級。 在 2005 年 2 月, Jesse James Garrett 發現新技術變得流行起來,被用于實現動態的使用 JavaScript 的前端 app 。[他稱呼這些技術為 Ajax](http://www.adaptivepath.com/ideas/ajax-new-approach-web-applications/)。 Ajax 開啟了 web app 的全新世界,并使人們對 JavaScript 產生了濃厚的興趣。 這使得 TC39 在 2005 年秋天重啟 ES4 的制定工作。他們基于 ES3 來制定 ES4 ,臨時的 ES4 在 ActionScript 和 JScript.NET 中實現。 當時有兩個組從事制定未來 ECMAScript 版本的工作: * ECMAScript 4 由 Adobe , Mozilla , Opera 和 Google 設計,是一個很大的升級。它包含的特性集如下: * 大型編程(類,接口,命名空間,包,程序單元,可選的類型注釋,可選的靜態類型檢測和驗證) * 編程和腳本的進化(結構類型,鴨子類型,類型定義,和方法重載) * 數據結構完善(參數化類型, getter 和 setter ,和元級的方法) * 控制抽象(恰當的尾遞歸,迭代器,和生成器) * 反思(類型元對象和堆棧標記) * ECMAScript 3.1 由微軟和 Yahoo 設計。計劃成為 ES4 的子集,并且是 ECMAScript 3 的增量化升級,沒有 bug 修復和小的新特性。 ECMAScript 3.1 最終成為了 ECMAScript 5 。 這兩個組關于 JavaScript 未來產生了分歧,他們之間的緊張局勢也逐漸升級。 > 本節來源: > - [《 Proposed ECMAScript 4th Edition – Language Overview 》](http://www.ecmascript.org/es4/spec/overview.pdf),2007-10-23 > - [《 ECMAScript Harmony 》](http://ejohn.org/blog/ecmascript-harmony/),作者 John Resig ,2008-08-13 ### 1.7.3 ECMAScript Harmony 2008 年 7 月底,TC39 在 Oslo 開了個會, Brendan Eich[描述](https://mail.mozilla.org/pipermail/es-discuss/2008-August/006837.html)會議結果如下: > JavaScript 標準正文不是秘密, Ecma 的技術委員會 39 已經分裂超過一年了,一些成員喜歡 ES4 [...] ,一些成員倡導 ES3.1 [...] 。現在,我很高興地說,分裂結束了。 會議就四點上達成了一致: * 1、開發一個增量升級的 ECMAScript (就是 ECMAScript 5 )。 * 2、開發一個主要的新版本,相對于 ES4 更加現代化,但是在范圍上比 ECMAScript 3 之后的版本大得多。這個版本代號為*Harmony*,名字源于會議要達成的消除分歧的目標。 * 3、來自于 ECMAScript 4 的特性被取消了一部分:包,命名空間,早綁定。 * 4、其他想法在 TC39 達成一致后才開發。 因此: ES4 小組同意不讓 Harmony 像 ES4 那么激進,剩下的 TC39 成員贊成繼續推進。 接下來的 ECMAScript 版本是:接下來的 ECMAScript 版本是: * ECMAScript 5 (2009 年 12 月)。這是目前大多數瀏覽器實現的 ECMAScript 版本。它給標準庫引入了幾處增強,并且通過*嚴格模式*升級了語言的語義。 * ECMAScript 6 (2015 年 6 月)。該版本經歷了幾次名字修改: * ECMAScript Harmony : 是最初的代號,用于 ECMAScript 5 之后的 JavaScript 的改進。 * ECMAScript.next : 很明顯, Harmony 的計劃對于一次版本升級來說顯得太雄心勃勃了,因此它的特性分成了兩組:第一組有很高的優先級,成為繼 ES5 之后的版本。為了避免過早地涉及到版本號,這個版本的代號就是 ECMAScript.next , ES4 就因為這個產生了很多問題。第二組特性直到 ECMAScript.next 之后才有時間了。 * ECMAScript 6 : 當 ECMAScript.next 成熟之后,它的代號就棄用了,大家都開始稱其為 ECMAScript 6 。 * ECMAScript 2015 : 在 2014 年底, TC39 決定將官方的 ECMAScript 6 名字修改為 ECMAScript 2015 ,根據接下來的每年發布規范的策略。 * ECMAScript 2016 之前被叫做 ECMAScript 7 。開始于 ES2016 ,語言標準將會每年發布一個小的版本。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看