Files
ask262/spec-built/multipage/index.html
T

85 lines
19 KiB
HTML

<!DOCTYPE html><html lang="en-GB-oxendict"><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><meta property="og:image" content="https://tc39.es/ecmarkup/ecma-logo.png"><meta property="og:title" content="ECMAScript® 2026 Language&nbsp;Specification"><meta property="og:description" content="Introduction
This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invent">
<link rel="icon" href="../img/favicon.ico">
<link rel="stylesheet" href="../assets/css/ecmarkup.css"><link rel="stylesheet" href="../assets/css/print.css" media="print">
<title>ECMAScript® 2026 Language&nbsp;Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script></head>
<body><div id="spec-container"><h1 class="version">Draft ECMA-262 / March 26, 2026</h1>
<h1 class="title">ECMAScript® 2026 Language&nbsp;Specification</h1>
<p><img src="../img/ecma-logo.svg" id="ecma-logo" alt="Ecma International logo"></p>
<div id="metadata-block">
<h1>About this Specification</h1>
<p>The document at <a href="https://tc39.es/ecma262/">https://tc39.es/ecma262/</a> is the most accurate and up-to-date ECMAScript specification. It contains the content of the most recent yearly snapshot plus any <a href="https://github.com/tc39/proposals/blob/HEAD/finished-proposals.md">finished proposals</a> — those that have reached Stage&nbsp;4 in the <a href="https://tc39.es/process-document/">proposal process</a> and thus are implemented in several implementations and will be included in the next yearly snapshot. Historical snapshots are available at <a href="https://ecma-international.org/publications-and-standards/standards/ecma-262/">https://ecma-international.org/publications-and-standards/standards/ecma-262/</a>.</p>
<p>This document is available as <a href="..">a single page</a> and as <a href="">multiple pages</a>.</p>
<h1>Contributing to this Specification</h1>
<p>This specification is developed on GitHub with the help of the ECMAScript community. There are a number of ways to contribute to the development of this specification:</p>
<ul>
<li>GitHub Repository: <a href="https://github.com/tc39/ecma262">https://github.com/tc39/ecma262</a></li>
<li>Issues: <a href="https://github.com/tc39/ecma262/issues">All Issues</a>, <a href="https://github.com/tc39/ecma262/issues/new">File a New Issue</a></li>
<li>Pull Requests: <a href="https://github.com/tc39/ecma262/pulls">All Pull Requests</a>, <a href="https://github.com/tc39/ecma262/pulls/new">Create a New Pull Request</a></li>
<li>Test Suite: <a href="https://github.com/tc39/test262">Test262</a></li>
<li>
Editors:
<ul>
<li><a href="mailto:shu at rfrn dot org">Shu-yu Guo</a></li>
<li><a href="mailto:ecma262-editor-list at michael dot ficarra dot me">Michael Ficarra</a> (<a href="https://bsky.app/profile/michael.ficarra.me">@michael.ficarra.me</a>)</li>
<li><a href="mailto:bakkot at gmail dot com">Kevin Gibbons</a></li>
</ul>
</li>
<li>
Community:
<ul>
<li>Discourse: <a href="https://es.discourse.group">https://es.discourse.group/</a></li>
<li>Chat: <a href="https://github.com/tc39/how-we-work/blob/HEAD/matrix-guide.md">Matrix</a></li>
<li>Mailing <emu-not-ref>List</emu-not-ref> Archives: <a href="https://esdiscuss.org">https://esdiscuss.org/</a></li>
</ul>
</li>
</ul>
<p>Refer to the <emu-xref href="#sec-colophon" id="_ref_0"><a href="colophon.html#sec-colophon">colophon</a></emu-xref> for more information on how this document is created.</p>
</div>
<emu-intro id="sec-intro">
<h1>Introduction</h1>
<p>This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company's Navigator 2.0 browser. Though best known as the language embedded in web browsers, it has also been widely adopted for use outside the browser, including server and embedded applications, and has grown to be one of the world's most widely used general-purpose programming languages.</p>
<p>The development of the ECMAScript Language Specification started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.</p>
<p>That Ecma Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved as international standard ISO/IEC 16262, in April 1998. The Ecma General Assembly of June 1998 approved the second edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the second edition are editorial in nature.</p>
<p>The third edition of the Standard introduced powerful regular expressions, better string handling, new control statements, try/catch exception handling, tighter definition of errors, formatting for numeric output and minor changes in anticipation of future language growth. The third edition of the ECMAScript standard was adopted by the Ecma General Assembly of December 1999 and published as ISO/IEC 16262:2002 in June 2002.</p>
<p>After publication of the third edition, ECMAScript achieved massive adoption in conjunction with the World Wide Web where it has become the programming language that is supported by essentially all web browsers. Significant work was done to develop a fourth edition of ECMAScript. However, that work was not completed and not published as the fourth edition of ECMAScript but some of it was incorporated into the development of the sixth edition.</p>
<p>The fifth edition of ECMAScript (published as ECMA-262 5<sup>th</sup> edition) codified de facto interpretations of the language specification that have become common among browser implementations and added support for new features that had emerged since the publication of the third edition. Such features include <emu-xref href="#sec-object-type" id="_ref_995"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor properties</a></emu-xref>, reflective creation and inspection of objects, program control of property attributes, additional array manipulation functions, support for the JSON object encoding format, and a strict mode that provides enhanced error checking and program security. The fifth edition was adopted by the Ecma General Assembly of December 2009.</p>
<p>The fifth edition was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved as international standard ISO/IEC 16262:2011. Edition 5.1 of the ECMAScript Standard incorporated minor corrections and is the same text as ISO/IEC 16262:2011. The 5.1 Edition was adopted by the Ecma General Assembly of June 2011.</p>
<p>Focused development of the sixth edition started in 2009, as the fifth edition was being prepared for publication. However, this was preceded by significant experimentation and language enhancement design efforts dating to the publication of the third edition in 1999. In a very real sense, the completion of the sixth edition is the culmination of a fifteen year effort. The goals for this edition included providing better support for large applications, library creation, and for use of ECMAScript as a compilation target for other languages. Some of its major enhancements included modules, class declarations, lexical block scoping, <emu-xref href="#sec-iterator-interface" id="_ref_996"><a href="control-abstraction-objects.html#sec-iterator-interface">iterators</a></emu-xref> and generators, promises for asynchronous programming, destructuring patterns, and proper tail calls. The ECMAScript library of built-ins was expanded to support additional data abstractions including maps, sets, and arrays of binary numeric values as well as additional support for Unicode supplementary characters in strings and regular expressions. The built-ins were also made extensible via subclassing. The sixth edition provides the foundation for regular, incremental language and library enhancements. The sixth edition was adopted by the General Assembly of June 2015.</p>
<p>ECMAScript 2016 was the first ECMAScript edition released under Ecma TC39's new yearly release cadence and open development process. A plain-text source document was built from the ECMAScript 2015 source document to serve as the base for further development entirely on GitHub. Over the year of this standard's development, hundreds of pull requests and issues were filed representing thousands of bug fixes, editorial fixes and other improvements. Additionally, numerous software tools were developed to aid in this effort including Ecmarkup, Ecmarkdown, and Grammarkdown. ES2016 also included support for a new exponentiation operator and adds a new method to <code>Array.prototype</code> called <code>includes</code>.</p>
<p>ECMAScript 2017 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience by providing syntax for promise-returning functions. Shared Memory and Atomics introduce a new <emu-xref href="#sec-memory-model" id="_ref_997"><a href="memory-model.html#sec-memory-model">memory model</a></emu-xref> that allows multi-<emu-xref href="#agent" id="_ref_998"><a href="executable-code-and-execution-contexts.html#agent">agent</a></emu-xref> programs to communicate using atomic operations that ensure a well-defined execution order even on parallel CPUs. It also included new static methods on Object: <code>Object.values</code>, <code>Object.entries</code>, and <code>Object.getOwnPropertyDescriptors</code>.</p>
<p>ECMAScript 2018 introduced support for asynchronous iteration via the <emu-xref href="#sec-asynciterator-interface" id="_ref_999"><a href="control-abstraction-objects.html#sec-asynciterator-interface">async iterator</a></emu-xref> protocol and async generators. It also included four new regular expression features: the <code>dotAll</code> flag, named capture groups, Unicode property escapes, and look-behind assertions. Lastly it included object rest and spread properties.</p>
<p>ECMAScript 2019 introduced a few new built-in functions: <code>flat</code> and <code>flatMap</code> on <code>Array.prototype</code> for flattening arrays, <code>Object.fromEntries</code> for directly turning the return value of <code>Object.entries</code> into a new Object, and <code>trimStart</code> and <code>trimEnd</code> on <code>String.prototype</code> as better-named alternatives to the widely implemented but non-standard <code>String.prototype.trimLeft</code> and <code>trimRight</code> built-ins. In addition, it included a few minor updates to syntax and semantics. Updated syntax included optional catch binding parameters and allowing U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) in string literals to align with JSON. Other updates included requiring that <code>Array.prototype.sort</code> be a stable sort, requiring that <code>JSON.stringify</code> return well-formed UTF-8 regardless of input, and clarifying <code>Function.prototype.toString</code> by requiring that it either return the corresponding original source text or a standard placeholder.</p>
<p>ECMAScript 2020, the 11<sup>th</sup> edition, introduced the <code>matchAll</code> method for Strings, to produce an <emu-xref href="#sec-iterator-interface" id="_ref_1000"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref> for all match objects generated by a global regular expression; <code>import()</code>, a syntax to asynchronously import Modules with a dynamic specifier; <code>BigInt</code>, a new number primitive for working with arbitrary precision <emu-xref href="#integer" id="_ref_1001"><a href="notational-conventions.html#integer">integers</a></emu-xref>; <code>Promise.allSettled</code>, a new Promise combinator that does not short-circuit; <code>globalThis</code>, a universal way to access the global <code>this</code> value; dedicated <code>export * as ns from 'module'</code> syntax for use within modules; increased standardization of <code>for-in</code> enumeration order; <code>import.meta</code>, a <emu-xref href="#host" id="_ref_1002"><a href="overview.html#host">host</a></emu-xref>-populated object available in Modules that may contain contextual information about the Module; as well as adding two new syntax features to improve working with “nullish” values (<emu-val>undefined</emu-val> or <emu-val>null</emu-val>): nullish coalescing, a value selection operator; and optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke is nullish.</p>
<p>ECMAScript 2021, the 12<sup>th</sup> edition, introduced the <code>replaceAll</code> method for Strings; <code>Promise.any</code>, a Promise combinator that short-circuits when an input value is fulfilled; <code>AggregateError</code>, a new Error type to represent multiple errors at once; logical assignment operators (<code>??=</code>, <code>&amp;&amp;=</code>, <code>||=</code>); <code>WeakRef</code>, for referring to a target object without preserving it from garbage collection, and <code>FinalizationRegistry</code>, to manage registration and unregistration of cleanup operations performed when target objects are garbage collected; separators for numeric literals (<code>1_000</code>); and <code>Array.prototype.sort</code> was made more precise, reducing the amount of cases that result in an <emu-xref href="#implementation-defined" id="_ref_1003"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> <emu-xref href="#sort-order" id="_ref_1004"><a href="indexed-collections.html#sort-order">sort order</a></emu-xref>.</p>
<p>ECMAScript 2022, the 13<sup>th</sup> edition, introduced top-level <code>await</code>, allowing the <emu-xref href="#sec-keywords-and-reserved-words" id="_ref_1005"><a href="ecmascript-language-lexical-grammar.html#sec-keywords-and-reserved-words">keyword</a></emu-xref> to be used at the top level of modules; new class elements: public and private instance fields, public and private static fields, private instance methods and accessors, and private static methods and accessors; static blocks inside classes, to perform per-class evaluation initialization; the <code>#x in obj</code> syntax, to test for presence of private fields on objects; regular expression match indices via the <code>/d</code> flag, which provides start and end indices for matched substrings; the <code>cause</code> property on <code>Error</code> objects, which can be used to record a causation chain in errors; the <code>at</code> method for Strings, Arrays, and <emu-xref href="#typedarray" id="_ref_1006"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArrays</a></emu-xref>, which allows relative indexing; and <code>Object.hasOwn</code>, a convenient alternative to <code>Object.prototype.hasOwnProperty</code>.</p>
<p>ECMAScript 2023, the 14<sup>th</sup> edition, introduced the <code>toSorted</code>, <code>toReversed</code>, <code>with</code>, <code>findLast</code>, and <code>findLastIndex</code> methods on <code>Array.prototype</code> and <code>TypedArray.prototype</code>, as well as the <code>toSpliced</code> method on <code>Array.prototype</code>; added support for <code>#!</code> comments at the beginning of files to better facilitate executable ECMAScript files; and allowed the use of most Symbols as keys in weak collections.</p>
<p>ECMAScript 2024, the 15<sup>th</sup> edition, added facilities for resizing and transferring ArrayBuffers and SharedArrayBuffers; added a new RegExp <code>/v</code> flag for creating RegExps with more advanced features for working with sets of strings; and introduced the <code>Promise.withResolvers</code> convenience method for constructing Promises, the <code>Object.groupBy</code> and <code>Map.groupBy</code> methods for aggregating data, the <code>Atomics.waitAsync</code> method for asynchronously waiting for a change to shared memory, and the <code>String.prototype.isWellFormed</code> and <code>String.prototype.toWellFormed</code> methods for checking and ensuring that strings contain only well-formed Unicode.</p>
<p>ECMAScript 2025, the 16<sup>th</sup> edition, added a new <code>Iterator</code> global with associated static and prototype methods for working with <emu-xref href="#sec-iterator-interface" id="_ref_1007"><a href="control-abstraction-objects.html#sec-iterator-interface">iterators</a></emu-xref>; added methods to <code>Set.prototype</code> for performing common operations on Sets; added support for importing JSON modules as well as syntax for declaring attributes of imported modules; added the <code>RegExp.escape</code> method for escaping a string to be safely used in a regular expression; added syntax for enabling and disabling modifier flags inline within regular expressions; added the <code>Promise.try</code> method for calling functions which may or may not return a <code>Promise</code> and ensuring the result is always a <code>Promise</code>; and added a new <code>Float16Array</code> <emu-xref href="#typedarray" id="_ref_1008"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> kind as well as the related <code>DataView.prototype.getFloat16</code>, <code>DataView.prototype.setFloat16</code>, and <code>Math.f16round</code> methods.</p>
<p>Dozens of individuals representing many organizations have made very significant contributions within Ecma TC39 to the development of this edition and to the prior editions. In addition, a vibrant community has emerged supporting TC39's ECMAScript efforts. This community has reviewed numerous drafts, filed thousands of bug reports, performed implementation experiments, contributed test suites, and educated the world-wide developer community about ECMAScript. Unfortunately, it is impossible to identify and acknowledge every person and organization who has contributed to this effort.</p>
<p>
Allen Wirfs-Brock<br>
ECMA-262, Project Editor, 6<sup>th</sup> Edition
</p>
<p>
Brian Terlson<br>
ECMA-262, Project Editor, 7<sup>th</sup> through 10<sup>th</sup> Editions
</p>
<p>
Jordan Harband<br>
ECMA-262, Project Editor, 10<sup>th</sup> through 12<sup>th</sup> Editions
</p>
<p>
Shu-yu Guo<br>
ECMA-262, Project Editor, 12<sup>th</sup> through 16<sup>th</sup> Editions
</p>
<p>
Michael Ficarra<br>
ECMA-262, Project Editor, 12<sup>th</sup> through 16<sup>th</sup> Editions
</p>
<p>
Kevin Gibbons<br>
ECMA-262, Project Editor, 12<sup>th</sup> through 16<sup>th</sup> Editions
</p>
</emu-intro></div></body></html>