ECMAScript
- العربية
- Azərbaycanca
- বাংলা
- Български
- Català
- Čeština
- Dansk
- Deutsch
- Eesti
- Español
- Euskara
- فارسی
- Français
- 한국어
- Հայերեն
- Íslenska
- Italiano
- עברית
- Magyar
- മലയാളം
- Bahasa Melayu
- Nederlands
- 日本語
- Norsk bokmål
- Polski
- Português
- Русский
- Simple English
- Српски / srpski
- Svenska
- ไทย
- Türkçe
- Українська
- Tiếng Việt
- Yorùbá
- 粵語
- 中文
| ECMAScript | |
|---|---|
| Paradigm | Multi-paradigm: prototype-based, functional, imperative |
| Designed by | Brendan Eich, Ecma International |
| First appeared | 1997; 29 years ago (1997) |
| Typing discipline | weak, dynamic |
| Website | www |
| Major implementations | |
| JavaScript, ActionScript, JScript, QtScript, InScript, Google Apps Script | |
| Influenced by | |
| Self, HyperTalk, AWK, C, CoffeeScript, Perl, Python, Java, Scheme | |
| ECMAScript (file format) | |
|---|---|
| Filename extensions |
.es |
| Internet media type |
application/ecmascript |
| Developed by | Sun Microsystems, Ecma International |
| Initial release | June 1997; 28 years ago (1997-06) |
| Latest release | Edition 15 June 2024; 1 year ago (2024-06) |
| Type of format | Scripting language |
| Website | Standards |
ECMAScript (/ˈɛkməskrɪpt/ ; ES)[1] is a standard for scripting languages including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers.[2] It is standardized by Ecma International in the document ECMA-262.
ECMAScript is commonly used for client-side scripting on the World Wide Web, and is increasingly being used for server-side scripting and services using runtime environments such as Node.js,[3] Deno [4] and Bun.[5]
ECMAScript, ECMA-262, JavaScript
[edit ]ECMA-262, or the ECMAScript Language Specification, defines the ECMAScript Language, or just ECMAScript.[6] ECMA-262 specifies only language syntax and the semantics of the core application programming interface (API), such as Array, Function, and globalThis, while valid implementations of JavaScript add their own functionality such as input/output and file system handling.
History
[edit ]The ECMAScript specification is a standardized specification of a scripting language developed by Brendan Eich of Netscape; initially named Mocha, then LiveScript, and finally JavaScript.[7] In December 1995, Sun Microsystems and Netscape announced JavaScript in a press release.[8] In November 1996, Netscape announced a meeting of the Ecma International standards organization to advance the standardization of JavaScript.[9] The first edition of ECMA-262 was adopted by the Ecma General Assembly in June 1997. Several editions of the language standard have been published since then. The name "ECMAScript" was a compromise between the organizations involved in standardizing the language, especially Netscape and Microsoft, whose disputes dominated the early standards sessions. Eich commented that "ECMAScript was always an unwanted trade name that sounds like a skin disease."[10] ECMAScript has been formalized through operational semantics by work at Stanford University and the Department of Computing, Imperial College London for security analysis and standardization.[11] "ECMA" stood for "European Computer Manufacturers Association" until 1994.
Evolution
[edit ]Ecma's Technical Committee 39 (TC39) is responsible for the maintenance of ECMAScript.[12] New proposals to the language go through a staged process, with each stage representing the completeness of the proposal's specification. Consensus must be reached within the committee to advance a proposal to the next stage. Proposals that reach stage 4, the final stage, will be included into the next version of the standard.[13] Since the release of version 6 in June 2015, new major versions have been finalized and published every June.[14]
Features
[edit ]The ECMAScript language includes structured, dynamic, functional, and prototype-based features.[15]
Imperative and structured
[edit ]ECMAScript JavaScript supports C-style structured programming. Previously, JavaScript only supported function scoping using the keyword var, but ECMAScript 2015 added the keywords let and const, allowing JavaScript to support both block scoping and function scoping. JavaScript supports automatic semicolon insertion, meaning that semicolons that normally terminate a statement in C may be omitted in JavaScript.[16]
Like C-style languages, control flow is done with the while, for, do / while, if / else, and switch statements. Functions are weakly typed and may accept and return any type. Arguments not provided default to undefined.
Weakly typed
[edit ]ECMAScript is weakly typed. This means that certain types are assigned implicitly based on the operation being performed. However, there are several quirks in JavaScript's implementation of the conversion of a variable from one type to another.
Dynamic
[edit ]ECMAScript is dynamically typed. Thus, a type is associated with a value rather than an expression. ECMAScript supports various ways to test the type of objects, including duck typing.[17]
Transpiling
[edit ]Since ES 2015, transpiling JavaScript has become very common. Transpilation is a source-to-source compilation in which newer versions of JavaScript are used, and a transpiler rewrites the source code so that it is supported by older browsers. Usually, transpilers transpile down to ES3 to maintain compatibility with all versions of browsers. The settings to transpile to a specific version can be configured according to need. Transpiling adds an extra step to the build process and is sometimes done to avoid needing polyfills. Polyfills create new features for older environments that lack them. Polyfills do this at runtime in the interpreter, such as the user's browser or on the server. Instead, transpiling rewrites the ECMA code itself during the build phase of development before it reaches the interpreter.
Conformance
[edit ]In 2010, Ecma International started developing a standards test for Ecma 262 ECMAScript.[18] Test262 is an ECMAScript conformance test suite that can be used to check how closely a JavaScript implementation follows the ECMAScript Specification. The test suite contains thousands of individual tests, each of which tests some specific requirement(s) of the ECMAScript specification. The development of Test262 is a project of the Ecma Technical Committee 39 (TC39). The testing framework and the individual tests are contributed to Ecma by member organizations of TC39.
Important contributions were made by Google (Sputnik test suite) and Microsoft, who both contributed thousands of tests. The Test262 test suite consisted of 38014 tests as of January 2020[update] .[19] ECMAScript specifications through ES7 are well-supported in major web browsers. The table below shows the conformance rate for current versions of software with respect to the most recent editions of ECMAScript.
| Scripting engine | Reference application(s) | Conformance[20] | |||
|---|---|---|---|---|---|
| ES5[21] | ES6 (2015)[22] | ES2016+[23] | Next[24] [25] | ||
| SpiderMonkey | Firefox 120 | 100% | 98% | 98% | 5% |
| V8 | Google Chrome 117, Microsoft Edge 113, Opera 98 | 100% | 98% | 98% | 5% |
| JavaScriptCore | Safari 17 | 99% | 100% | 98% | 11% |
See also
[edit ]References
[edit ]- ^ Stefanov, Stoyan (2010). JavaScript Patterns. O'Reilly Media, Inc. p. 5. ISBN 9781449396947. Archived from the original on 2016年06月10日. Retrieved 2016年01月12日.
The core JavaScript programming language [...] is based on the ECMAScript standard, or ES for short.
- ^ Wirfs-Brock, Allen; Eich, Brendan (2020年05月02日). "JavaScript: The First 20 Years". Proceedings of the ACM on Programming Languages. 4 (HOPL): 1–189. doi:10.1145/3386327 . S2CID 219603695.
- ^ Wunder, C. "Node.js — ECMAScript 2015 (ES6) and beyond". Node.js.
- ^ "Deno joins JavaScript standards effort". 14 December 2021.
- ^ https://bun.sh/docs#:~:text=or%2C%20more%20formally%2C-,ECMAScript,-)%20is%20just%20a bun
- ^ Guo, Shu-yu (2022年02月14日). "ECMAScriptÂŽ 2022 Language Specification". tc39.es. Archived from the original on 2020年05月08日. Retrieved 2022年02月14日.
- ^ Krill, Paul (2008年06月23日). "JavaScript creator ponders past, future". infoworld.com. InfoWorld. Archived from the original on 2014年09月20日. Retrieved 2013年10月31日.
- ^ "Netscape and Sun announce JavaScript, the Open, Cross-platform Object Scripting Language for Enterprise Networks and the Internet". Netscape.com. Netscape. 1995年12月04日. Archived from the original on 2002年06月06日. Retrieved 2019年11月04日.
- ^ Press Release (November 15, 1996). "Industry Leaders to Advance Standardization of Netscape's JavaScript at Standards Body Meeting". Netscape.com. Netscape. Archived from the original on 1998年12月03日. Retrieved 2013年10月31日.
- ^ Eich, Brendan (2006年10月03日). "Will there be a suggested file suffix for es4?". mozilla.org. Mail.mozilla.org. Archived from the original on 2020年06月21日. Retrieved 2021年05月05日.
- ^ Maffeis, Sergio; Mitchell, John C.; Taly, Ankur (2020年01月03日). "An Operational Semantics for JavaScript" (PDF). stanford.edu. Association for Computing Machinery. Archived (PDF) from the original on 2020年01月03日. Retrieved 2020年01月03日.
- ^ "TC39", Technical Committees, Ecma International, retrieved 2024年08月11日
- ^ "The TC39 Process", TC39, Ecma International, retrieved 2024年08月11日
- ^ "ECMAScript, TC39, and the History of JavaScript", ui.dev, retrieved 2024年08月11日
- ^ "About". ECMAScript. Archived from the original on 2012年08月02日. Retrieved 2009年12月17日.
- ^ Flanagan, David (17 August 2006). JavaScript: The Definitive Guide (5th ed.). O'Reilly. p. 16. ISBN 978-0-596-10199-2.
- ^ "JavaScript data types and data structures – JavaScript | MDN". Developer.mozilla.org. 2017年02月16日. Archived from the original on 2017年03月14日. Retrieved 2017年02月24日.
- ^ "ECMAScript Language – test262". Test262.ecmascript.org. Archived from the original on 2011年05月14日. Retrieved 2013年10月31日.
- ^ "tc39/test262". GitHub. January 24, 2020. Archived from the original on October 1, 2019. Retrieved January 29, 2020.
- ^ ES5 is the baseline for this test suite. The conformance rate for other editions reflects support for new features only, not a comprehensive score.
- ^ "ECMAScript 5 compatibility table". compat-table.github.io. 2024年04月14日. Archived from the original on 2024年01月14日. Retrieved 2024年04月14日.
- ^ "ECMAScript 6 compatibility table". compat-table.github.io. 2024年04月14日. Archived from the original on 2024年04月04日. Retrieved 2024年04月14日.
- ^ "ECMAScript 2016+ compatibility table". compat-table.github.io. 2024年04月14日. Archived from the original on 2024年01月14日. Retrieved 2024年04月14日.
- ^ "ECMAScript Next compatibility table". compat-table.github.io. 2024年04月14日. Archived from the original on 2024年01月14日. Retrieved 2024年04月14日.
- ^ Composite score that includes new features from ES7 through next edition drafts