ECMAScript

Specification for Javascript and other programming languages From Wikipedia, the free encyclopedia

ECMAScript (/ˈɛkməskrɪpt/; ES)[1] is the standard for the JavaScript language, intended to ensure the interoperability of web pages across different web browsers.[a][2] It is standardized by Ecma International's TC39 technical committee in the document ECMA-262, with i18n ("Intl") APIs standardized in the document ECMA-402.[3]

Filename extensions
.es
Internet mediatype
application/ecmascript
Initial releaseJune 1997; 28 years ago (1997-06)
Quick facts Filename extensions, Internet media type ...
ECMAScript (file format)
Filename extensions
.es
Internet media type
application/ecmascript
Developed bySun Microsystems,
Ecma International
Initial releaseJune 1997; 28 years ago (1997-06)
Latest release
Edition 16
June 2025; 10 months ago (2025-06)
Type of formatScripting language
WebsiteStandards
Close

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,[4] Deno[5] and Bun.[6]

The ECMAScript standard does not include any input/output (I/O), such as networking, storage, or graphics facilities. In practice, the web browser or other runtime system provides JavaScript APIs for I/O.

Standards

Ecma International's Technical Committee 39 publishes multiple standards defining JavaScript, formally known as ECMAScript. These include the language syntax, semantics, libraries, and complementary technologies that support the language.[7][8] The standards are detailed below.

ECMA-262, or the ECMAScript Language Specification, defines the JavaScript language, formally known as ECMAScript.[9] ECMA-262 only specifies 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.

ECMA-402, or the ECMAScript Internationalization API Specification, defines the JavaScript i18n (Intl) APIs, and is a complement to ECMA-262.[10] Its functionality has been selected from that of internationalization APIs such as those of the International Components for Unicode (ICU) library of the .NET framework, or of the Java platform.

ECMA-404, or the JSON data interchange syntax, defines the JSON (JavaScript Object Notation) syntax, a human-readable open standard file format and data interchange format.[11] It was derived from JavaScript, but is a programming language-independent data format.

ECMA-426, or the Source Map Format Specification, defines the Source map format, used for mapping transpiled source code back to its original sources.[12] The original source map format was created by Joseph Schorr for use by Closure Inspector to enable source-level debugging of optimized JavaScript code. In 2024, the source map format was published as an Ecma standard.

History

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.[13] In December 1995, Sun Microsystems and Netscape announced JavaScript in a press release.[14] In November 1996, Netscape announced a meeting of the Ecma International standards organization to advance the standardization of JavaScript.[15] 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."[16] 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.[17] "ECMA" stood for "European Computer Manufacturers Association" until 1994.

Evolution

Ecma's Technical Committee 39 (TC39) is responsible for the maintenance of ECMAScript.[18] 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.[19] Since the release of version 6 in June 2015, new major versions have been finalized and published every June.[20]

Features

The ECMAScript language includes structured, dynamic, functional, and prototype-based features.[21]

Imperative and structured

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.[22]

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

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

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.[23]

Transpiling

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

In 2010, Ecma International started developing a standards test for Ecma 262 ECMAScript.[24] 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.[25] 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.

More information Scripting engine, Reference application(s) ...
Scripting engine conformance
Scripting engine Reference application(s) Conformance[26]
ES5[27] ES6 (2015)[28] ES2016+[29] ES.Next[30][31]
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%
Close

See also

Notes

  1. In the past, it was also used as a standard for JScript (Internet Explorer), and ActionScript (Adobe Flash).

References

Related Articles

Wikiwand AI