ECMAScript is a standardized scripting language developed by Brendan Eich of Netscape, initially named Mocha, then LiveScript, and finally JavaScript. It is a multi-paradigm language that supports prototype-based, functional, and imperative programming. ECMAScript is widely used for client-side scripting on the web, and it is increasingly being used for server-side applications and services using runtime environments like Node.js, Deno, and Bun.
Key Points
ECMAScript Paradigm and History
- ECMAScript is a multi-paradigm language, supporting prototype-based, functional, and imperative programming.
- The ECMAScript specification was first developed by Brendan Eich of Netscape in 1997.
- The name "ECMAScript" was a compromise between Netscape and Microsoft, who were the main organizations involved in standardizing the language.
- The first edition of the ECMA-262 standard was adopted by the Ecma General Assembly in June 1997.
- Several editions of the language standard have been published since then.
ECMAScript Language Features
- ECMAScript supports C-style structured programming, with control flow done using statements like
while
,for
,if/else
, andswitch
.
- ECMAScript is a weakly typed language, with certain types being assigned implicitly based on the operation being performed.
- ECMAScript is dynamically typed, with a type associated with a value rather than an expression.
- ECMAScript supports various ways to test the type of objects, including duck typing.
Conformance and Standardization
- Ecma International started developing a standards test for ECMA 262 ECMAScript in 2010, called Test262.
- The Test262 test suite consists of 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), with contributions from member organizations like Google and Microsoft.
- ECMAScript specifications through ES7 are well-supported in major web browsers, with varying levels of conformance for more recent editions.
Transpiling and Polyfills
- Since ES 2015, transpiling JavaScript has become very common. Transpilation is a source-to-source compilation where newer versions of JavaScript are used, and a transpiler rewrites the source code to be supported by older browsers. [[23]] [[24]] [[25]] [[26]]
- Transpiling adds an extra step to the build process and is sometimes done to avoid needing polyfills. [[27]]
- Polyfills create new features for older environments that lack them, at runtime in the interpreter, such as the user's browser or on the server. [[28]] [[29]] [[30]]
Scripting Engine | ES5 | ES6 (2015) | ES7 (2016) |
V8 (Chrome 127, Edge 127, Opera 98) | 100% | 98% | 98% |
SpiderMonkey (Firefox 130) | 100% | 98% | 98% |
JavaScriptCore (Safari 17.5) | 99% | 100% | 98% |
Node.js 22 | 100% | 98% | 97% |
Hermes 0.12.0 | 92% | 74% | 56% |
React-Native 0.70.3 (Hermes+Babel) | 92% | 85% | 61% |
Β