{{Short description|Specification for Javascript and other programming languages}} {{Infobox programming language | name = ECMAScript | paradigm = Multi-paradigm: prototype-based, functional, imperative | designer = Brendan Eich, Ecma International | typing = Weak, dynamic | implementations = JavaScript, ActionScript, JScript, QtScript, InScript, Google Apps Script | website = {{URL|https://www.ecma-international.org/publications-and-standards/standards/ecma-262/}} | year = {{Start date and age|1997}} | influenced_by = Self, HyperTalk, AWK, C, CoffeeScript, Perl, Python, Java, Scheme }} {{Infobox file format | name = ECMAScript (file format) | icon = Crystal source.svg | logo = | screenshot = | caption = | extension = .es | mime = application/ecmascript | type code = | uniform type = | magic = | owner = Sun Microsystems,<br/>Ecma International | released = {{Start date and age|1997|06}} | latest release version = Edition 16 | latest release date = {{start date and age|2025|06}} | genre = Scripting language | container for = | contained by = | extensions = JavaScriptes | extended to = | standard = | url = [https://www.ecma-international.org/publications-and-standards/standards/ Standards] }}

'''ECMAScript''' ({{IPAc-en|'|ɛ|k|m|ə|s|k|r|ɪ|p|t}}; '''ES''')<ref>{{cite book |last1 = Stefanov |first1 = Stoyan |title = JavaScript Patterns |url = https://books.google.com/books?id=WTZqecc9olUC |publisher = O'Reilly Media, Inc. |date = 2010 |page = 5 |isbn = 9781449396947 |access-date = 2016-01-12 |quote = The core JavaScript programming language [...] is based on the ''ECMAScript'' standard, or ES for short. |archive-date = 2016-06-10 |archive-url = https://web.archive.org/web/20160610005241/https://books.google.com/books?id=WTZqecc9olUC |url-status = live }}</ref> is the standard for the JavaScript language, intended to ensure the interoperability of web pages across different web browsers.{{efn|In the past, it was also used as a standard for JScript (Internet Explorer), and ActionScript (Adobe Flash).}}<ref>{{cite journal |last1=Wirfs-Brock |first1=Allen |last2=Eich |first2=Brendan |date=2020-05-02 |title=JavaScript: The First 20 Years |journal=Proceedings of the ACM on Programming Languages |volume=4 |issue=HOPL |pages=1–189 |doi=10.1145/3386327 |doi-access=free |s2cid=219603695}}</ref> It is standardized by Ecma International's [https://tc39.es/ TC39] technical committee in the document [https://www.ecma-international.org/publications-and-standards/standards/ecma-262/ ECMA-262], with i18n ("Intl") APIs standardized in the document [https://ecma-international.org/publications-and-standards/standards/ecma-402/ ECMA-402].<ref>{{cite web |title=JavaScript technologies overview - JavaScript {{!}} MDN |url=https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/JavaScript_technologies_overview |website=MDN Web Docs |access-date=25 April 2026 |date=27 October 2025}}</ref>

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,<ref>{{cite web|last=Wunder|first=C.|url=https://nodejs.org/en/docs/es6 | title=Node.js — ECMAScript 2015 (ES6) and beyond|website=Node.js}}</ref> Deno<ref>{{cite web | url=https://www.infoworld.com/article/3644460/deno-joins-javascript-standards-effort.html | title=Deno joins JavaScript standards effort | date=14 December 2021 }}</ref> and Bun.<ref>https://bun.sh/docs#:~:text=or%2C%20more%20formally%2C-,ECMAScript,-)%20is%20just%20a bun</ref>

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.<ref>{{cite web |title=TC39 |url=https://ecma-international.org/technical-committees/tc39/ |website=Ecma International |access-date=25 April 2026}}</ref><ref>{{cite web |title=TC39 - Specifying JavaScript. |url=https://tc39.es/ |website=tc39.es}}</ref> The standards are detailed below.

=== ECMAScript Language Specification (ECMA-262) ===

Defines the JavaScript language, formally known as ECMAScript.<ref>{{cite web |last=Guo |first=Shu-yu |date=2022-02-14 |title=ECMAScript 2022 Language Specification |url=https://tc39.es/ecma262/ |url-status=live |archive-url=https://web.archive.org/web/20200508053013/https://tc39.es/ecma262/ |archive-date=2020-05-08 |website=tc39.es |accessdate=2022-02-14}}</ref> ECMA-262 only specifies language syntax and the semantics of the core application programming interface (API), such as {{code|Array}}, {{code|Function}}, and {{code|globalThis}}, while valid implementations of JavaScript add their own functionality such as input/output and file system handling.

=== ECMAScript Internationalization API Specification (ECMA-402) ===

Defines the JavaScript i18n ({{code|Intl}}) APIs, and is a complement to ECMA-262.<ref>{{cite web |date=April 17, 2026 |title=ECMAScript 2027 Internationalization API Specification |url=https://tc39.es/ecma402/ |url-status=live |archive-url=https://web.archive.org/web/20260424125838/https://tc39.es/ecma402/ |archive-date=April 24, 2026 |website=tc39.es |accessdate=April 26, 2026}}</ref> 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.

=== JSON Data Interchange Syntax (ECMA-404) ===

Defines the JSON (JavaScript Object Notation) syntax, a human-readable open standard file format and data interchange format.<ref>{{cite web |title=ECMA-404 |url=https://ecma-international.org/publications-and-standards/standards/ecma-404/ |website=Ecma International |access-date=25 April 2026}}</ref> It was derived from JavaScript, but is a programming language-independent data format.

=== Source Map Format Specification (ECMA-426) ===

Defines the Source map format, used for mapping transpiled source code back to its original sources.<ref>{{cite web |date=March 14, 2026 |title=Source map format specification |url=https://tc39.es/ecma426/ |url-status=live |archive-url=https://web.archive.org/web/20260424131942/https://tc39.es/ecma426/ |archive-date=April 24, 2026 |website=tc39.es |accessdate=April 26, 2026}}</ref> The original source map format was created by Joseph Schorr for use by the Closure Inspector minification project, 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.<ref>{{cite web |last=Krill |first=Paul |date=2008-06-23 |title=JavaScript creator ponders past, future |url=http://www.infoworld.com/article/2653798/application-development/javascript-creator-ponders-past--future.html |url-status=live |archive-url=https://web.archive.org/web/20140920141040/http://www.infoworld.com/article/2653798/application-development/javascript-creator-ponders-past--future.html |archive-date=2014-09-20 |access-date=2013-10-31 |website=infoworld.com |publisher=InfoWorld}}</ref> In December 1995, Sun Microsystems and Netscape announced JavaScript in a press release.<ref>{{cite web |date=1995-12-04 |title=Netscape and Sun announce JavaScript, the Open, Cross-platform Object Scripting Language for Enterprise Networks and the Internet |url=http://wp.netscape.com/newsref/pr/newsrelease67.html |url-status=dead |archive-url=https://web.archive.org/web/20020606002913/http://wp.netscape.com/newsref/pr/newsrelease67.html |archive-date=2002-06-06 |access-date=2019-11-04 |website=Netscape.com |publisher=Netscape}}</ref> In November 1996, Netscape announced a meeting of the Ecma International standards organization to advance the standardization of JavaScript.<ref>{{cite web |last=Press Release |date=November 15, 1996 |title=Industry Leaders to Advance Standardization of Netscape's JavaScript at Standards Body Meeting |url=http://cgi.netscape.com/newsref/pr/newsrelease289.html |url-status=dead |archive-url=https://web.archive.org/web/19981203070212/http://cgi.netscape.com/newsref/pr/newsrelease289.html |archive-date=1998-12-03 |access-date=2013-10-31 |website=Netscape.com |publisher=Netscape}}</ref> <!-- Should add that Jscript is also from EMCAScript -->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."<ref>{{cite web |last=Eich |first=Brendan |date=2006-10-03 |title=Will there be a suggested file suffix for es4? |url=https://mail.mozilla.org/pipermail/es-discuss/2006-October/000133.html |url-status=live |archive-url=https://web.archive.org/web/20200621202321/https://mail.mozilla.org/pipermail/es-discuss/2006-October/000133.html |archive-date=2020-06-21 |access-date=2021-05-05 |website=mozilla.org |publisher=Mail.mozilla.org}}</ref> 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.<ref>{{cite web |last1=Maffeis |first1=Sergio |last2=Mitchell |first2=John C. |last3=Taly |first3=Ankur |date=2020-01-03 |title=An Operational Semantics for JavaScript |url=http://theory.stanford.edu/people/jcm/papers/aplas08-camera-ready.pdf |url-status=live |archive-url=https://web.archive.org/web/20200103204704/http://theory.stanford.edu/people/jcm/papers/aplas08-camera-ready.pdf |archive-date=2020-01-03 |access-date=2020-01-03 |website=stanford.edu |publisher=Association for Computing Machinery}}</ref> "ECMA" stood for "European Computer Manufacturers Association" until 1994.

===Evolution=== {{Main|ECMAScript version history}} Ecma's Technical Committee 39 (TC39) is responsible for the maintenance of ECMAScript.<ref>{{Citation |title=TC39 |work=Technical Committees |url=https://ecma-international.org/technical-committees/tc39 |access-date=2024-08-11 |publisher=Ecma International |language=en-US}}</ref> 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.<ref>{{Citation |title=The TC39 Process |work=TC39 |url=https://tc39.es/process-document |access-date=2024-08-11 |publisher=Ecma International}}</ref> Since the release of version 6 in June 2015, new major versions have been finalized and published every June.<ref>{{Citation |title=ECMAScript, TC39, and the History of JavaScript |work=ui.dev |url=https://ui.dev/ecmascript |access-date=2024-08-11}}</ref>

== Features == {{main|ECMAScript syntax|JavaScript#Features}} {{expand section|date=February 2017}} The ECMAScript language includes structured, dynamic, functional, and prototype-based features.<ref>{{cite web |url=http://www.ecmascript.org/about.php |title=About |publisher=ECMAScript |access-date=2009-12-17 |url-status=dead |archive-url=https://archive.today/20120802115457/http://www.ecmascript.org/about.php |archive-date=2012-08-02 }}</ref>

=== Imperative and structured === ECMAScript JavaScript<!-- How to make clearer? --> supports C-style structured programming. Previously, JavaScript only supported function scoping using the keyword <code>var</code>, but ECMAScript 2015 added the keywords <code>let</code> and <code>const</code>, 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.<!-- Might imply EMCAScript doesn't support automatic semicolon insertion --><ref name="Flanagan2006">{{cite book|title=JavaScript: The Definitive Guide|first=David|last=Flanagan|edition=5th|date=17 August 2006|publisher=O'Reilly|isbn=978-0-596-10199-2|page=16|url=https://archive.org/details/javascriptdefini0000flan|url-access=registration}}</ref>

Like C-style languages, control flow is done with the {{Code|code=while}}, {{Code|code=for}}, {{Code|code=do}} / {{Code|code=while}}, {{Code|code=if}} / {{Code|code=else}}, and {{Code|code=switch}} statements.<!-- missing Labels / Functions --> Functions are weakly typed and may accept and return any type. Arguments not provided default to {{Code|code=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.<ref>{{cite web|url=https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures|title=JavaScript data types and data structures – JavaScript {{pipe}} MDN|date=2017-02-16|website=Developer.mozilla.org|access-date=2017-02-24|archive-date=2017-03-14|archive-url=https://web.archive.org/web/20170314230542/https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures|url-status=live}}</ref>

=== Transpiling === {{Main|JavaScript#transpilers}} 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.<!-- The polyfill article is much better --> 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.<ref>{{cite web |url=http://test262.ecmascript.org/ |title=ECMAScript Language – test262 |publisher=Test262.ecmascript.org |access-date=2013-10-31 |url-status=dead |archive-url=https://web.archive.org/web/20110514205704/http://test262.ecmascript.org/ |archive-date=2011-05-14 }}</ref> 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 {{val|38014}} tests {{as of|2020|01|lc=y}}.<ref name="GitHub 2020">{{cite web | title=tc39/test262 | website=GitHub | date=January 24, 2020 | url=https://github.com/tc39/test262 | access-date=January 29, 2020 | archive-date=October 1, 2019 | archive-url=https://web.archive.org/web/20191001032806/https://github.com/tc39/test262 | url-status=live }}</ref> 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.

{| class="wikitable sortable" |+Scripting engine conformance |- style="background:#ccf;" ! scope="col" rowspan="2" | Scripting engine ! scope="col" rowspan="2" | Reference application(s) ! scope="col" colspan="4" | Conformance<ref>ES5 is the baseline for this test suite. The conformance rate for other editions reflects support for new features only, not a comprehensive score.</ref> |- !scope="col" | ES5<ref name="kangax5">{{cite web |date=2024-04-14 |title=ECMAScript 5 compatibility table |url=https://compat-table.github.io/compat-table/es5/ |url-status=live |archive-url=https://web.archive.org/web/20240114035054/https://compat-table.github.io/compat-table/es5/ |archive-date=2024-01-14 |access-date=2024-04-14 |website=compat-table.github.io |language=en}}</ref> !scope="col" | ES6 (2015)<ref name="kangax6">{{cite web |date=2024-04-14 |title=ECMAScript 6 compatibility table |url=https://compat-table.github.io/compat-table/es6/ |url-status=live |archive-url=https://web.archive.org/web/20240404212624/https://compat-table.github.io/compat-table/es6/ |archive-date=2024-04-04 |access-date=2024-04-14 |website=compat-table.github.io |language=en}}</ref> !scope="col" | ES2016+<ref name="kangax2016plus">{{cite web |date=2024-04-14 |title=ECMAScript 2016+ compatibility table |url=https://compat-table.github.io/compat-table/es2016plus/ |url-status=live |archive-url=https://web.archive.org/web/20240114034945/https://compat-table.github.io/compat-table/es2016plus/ |archive-date=2024-01-14 |access-date=2024-04-14 |website=compat-table.github.io |language=en}}</ref> !scope="col" | ES.Next<ref>{{Cite web |date=2024-04-14 |title=ECMAScript Next compatibility table |url=https://compat-table.github.io/compat-table/esnext/ |url-status=live |archive-url=https://web.archive.org/web/20240114035113/https://compat-table.github.io/compat-table/esnext/ |archive-date=2024-01-14 |access-date=2024-04-14 |website=compat-table.github.io}}</ref><ref>Composite score that includes new features from ES7 through next edition drafts</ref> |- !scope="row" | SpiderMonkey | Firefox 120 | 100% || 98% || 98% || 5% |- !scope="row" | V8 | Google Chrome 117, Microsoft Edge 113, Opera 98 | 100% || 98% || 98% || 5% |- !scope="row" | JavaScriptCore | Safari 17 | 99% || 100% || 98% || 11% |}

== See also == * ECMAScript for XML (E4X) * List of ECMAScript engines

== Notes == {{notelist}}

== References == {{Reflist|colwidth=30em}}

{{Clear}} {{ECMAScript}} {{Ecma International Standards}} {{ISO standards}} {{List of IEC standards}}

Category:Ecma standards Category:Object-based programming languages Category:Programming languages with an ISO standard Category:Scripting languages Category:Source-to-source compilers