mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
352 lines
48 KiB
HTML
352 lines
48 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 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 Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script><link rel="canonical" href="../#sec-overview"></head>
|
||
<body><div id="spec-container"><emu-clause id="sec-overview">
|
||
<h1><span class="secnum">4</span> Overview</h1>
|
||
<p>This section contains a non-normative overview of the ECMAScript language.</p>
|
||
<p>ECMAScript is an object-oriented programming language for performing computations and manipulating computational objects within a <emu-xref href="#host-environment" id="_ref_1018"><a href="overview.html#host-environment">host environment</a></emu-xref>. ECMAScript as defined here is not intended to be computationally self-sufficient; indeed, there are no provisions in this specification for input of external data or output of computed results. Instead, it is expected that the computational environment of an ECMAScript program will provide not only the objects and other facilities described in this specification but also certain environment-specific objects, whose description and behaviour are beyond the scope of this specification except to indicate that they may provide certain properties that can be accessed and certain functions that can be called from an ECMAScript program.</p>
|
||
<p>ECMAScript was originally designed to be used as a scripting language, but has become widely used as a general-purpose programming language. A <em>scripting language</em> is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. In such systems, useful functionality is already available through a user interface, and the scripting language is a mechanism for exposing that functionality to program control. In this way, the existing system is said to provide a <emu-xref href="#host-environment" id="_ref_1019"><a href="overview.html#host-environment">host environment</a></emu-xref> of objects and facilities, which completes the capabilities of the scripting language. A scripting language is intended for use by both professional and non-professional programmers.</p>
|
||
<p>ECMAScript was originally designed to be a <em>Web scripting language</em>, providing a mechanism to enliven Web pages in browsers and to perform server computation as part of a Web-based client-server architecture. ECMAScript is now used to provide core scripting capabilities for a variety of <emu-xref href="#host-environment" id="_ref_1020"><a href="overview.html#host-environment">host environments</a></emu-xref>. Therefore the core language is specified in this document apart from any particular <emu-xref href="#host-environment" id="_ref_1021"><a href="overview.html#host-environment">host environment</a></emu-xref>.</p>
|
||
<p>ECMAScript usage has moved beyond simple scripting and it is now used for the full spectrum of programming tasks in many different environments and scales. As the usage of ECMAScript has expanded, so have the features and facilities it provides. ECMAScript is now a fully featured general-purpose programming language.</p>
|
||
|
||
<emu-clause id="sec-web-scripting">
|
||
<h1><span class="secnum">4.1</span> Web Scripting</h1>
|
||
<p>A web browser provides an ECMAScript <emu-xref href="#host-environment" id="_ref_1022"><a href="overview.html#host-environment">host environment</a></emu-xref> for client-side computation including, for instance, objects that represent windows, menus, pop-ups, dialog boxes, text areas, anchors, frames, history, cookies, and input/output. Further, the <emu-xref href="#host-environment" id="_ref_1023"><a href="overview.html#host-environment">host environment</a></emu-xref> provides a means to attach scripting code to events such as change of focus, page and image loading, unloading, error and abort, selection, form submission, and mouse actions. Scripting code appears within the HTML and the displayed page is a combination of user interface elements and fixed and computed text and images. The scripting code is reactive to user interaction, and there is no need for a main program.</p>
|
||
<p>A web server provides a different <emu-xref href="#host-environment" id="_ref_1024"><a href="overview.html#host-environment">host environment</a></emu-xref> for server-side computation including objects representing requests, clients, and files; and mechanisms to lock and share data. By using browser-side and server-side scripting together, it is possible to distribute computation between the client and server while providing a customized user interface for a Web-based application.</p>
|
||
<p>Each Web browser and server that supports ECMAScript supplies its own <emu-xref href="#host-environment" id="_ref_1025"><a href="overview.html#host-environment">host environment</a></emu-xref>, completing the ECMAScript execution environment.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-hosts-and-implementations">
|
||
<h1><span class="secnum">4.2</span> Hosts and Implementations</h1>
|
||
<p>To aid integrating ECMAScript into <emu-xref href="#host-environment" id="_ref_1026"><a href="overview.html#host-environment">host environments</a></emu-xref>, this specification defers the definition of certain facilities (e.g., <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1027"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref>), either in whole or in part, to a source outside of this specification. Editorially, this specification distinguishes the following kinds of deferrals.</p>
|
||
<!-- "implementation" below is not a dfn but an em to avoid excessive auto-linking. -->
|
||
<p>An <em id="implementation">implementation</em> is an external source that further defines facilities enumerated in Annex <emu-xref href="#sec-host-layering-points" id="_ref_4"><a href="host-layering-points.html#sec-host-layering-points">D</a></emu-xref> or those that are marked as <emu-xref href="#implementation-defined" id="_ref_1028"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> or <emu-xref href="#implementation-approximated" id="_ref_1029"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref>. In informal use, an implementation refers to a concrete artefact, such as a particular web browser.</p>
|
||
<p>An <dfn id="implementation-defined" tabindex="-1">implementation-defined</dfn> facility is one that defers its definition to an external source without further qualification. This specification does not make any recommendations for particular behaviours, and conforming implementations are free to choose any behaviour within the constraints put forth by this specification.</p>
|
||
<p>An <dfn id="implementation-approximated" tabindex="-1">implementation-approximated</dfn> facility is one that defers its definition to an external source while recommending an ideal behaviour. While conforming implementations are free to choose any behaviour within the constraints put forth by this specification, they are encouraged to strive to approximate the ideal. Some mathematical operations, such as <emu-xref href="#sec-math.exp" id="_ref_5"><a href="numbers-and-dates.html#sec-math.exp"><code>Math.exp</code></a></emu-xref>, are <emu-xref href="#implementation-approximated" id="_ref_1030"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref>.</p>
|
||
<p>A <dfn id="host" variants="hosts" tabindex="-1">host</dfn> is an external source that further defines facilities listed in Annex <emu-xref href="#sec-host-layering-points" id="_ref_6"><a href="host-layering-points.html#sec-host-layering-points">D</a></emu-xref> but does not further define other <emu-xref href="#implementation-defined" id="_ref_1031"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> or <emu-xref href="#implementation-approximated" id="_ref_1032"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> facilities. In informal use, a <emu-xref href="#host" id="_ref_1033"><a href="overview.html#host">host</a></emu-xref> refers to the set of all implementations, such as the set of all web browsers, that interface with this specification in the same way via Annex <emu-xref href="#sec-host-layering-points" id="_ref_7"><a href="host-layering-points.html#sec-host-layering-points">D</a></emu-xref>. A <emu-xref href="#host" id="_ref_1034"><a href="overview.html#host">host</a></emu-xref> is often an external specification, such as WHATWG HTML (<a href="https://html.spec.whatwg.org/">https://html.spec.whatwg.org/</a>). In other words, facilities that are <emu-xref href="#host-defined" id="_ref_1035"><a href="overview.html#host-defined">host-defined</a></emu-xref> are often further defined in external specifications.</p>
|
||
<p>A <dfn id="host-hook" variants="host hooks" tabindex="-1">host hook</dfn> is an abstract operation that is defined in whole or in part by an external source. All <emu-xref href="#host-hook" id="_ref_1036"><a href="overview.html#host-hook">host hooks</a></emu-xref> must be listed in Annex <emu-xref href="#sec-host-layering-points" id="_ref_8"><a href="host-layering-points.html#sec-host-layering-points">D</a></emu-xref>. A <emu-xref href="#host-hook" id="_ref_1037"><a href="overview.html#host-hook">host hook</a></emu-xref> must conform to at least the following requirements:</p>
|
||
<ul>
|
||
<li>It must return either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1038"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_1039"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>.</li>
|
||
</ul>
|
||
<p>A <dfn id="host-defined" tabindex="-1">host-defined</dfn> facility is one that defers its definition to an external source without further qualification and is listed in Annex <emu-xref href="#sec-host-layering-points" id="_ref_9"><a href="host-layering-points.html#sec-host-layering-points">D</a></emu-xref>. Implementations that are not <emu-xref href="#host" id="_ref_1040"><a href="overview.html#host">hosts</a></emu-xref> may also provide definitions for <emu-xref href="#host-defined" id="_ref_1041"><a href="overview.html#host-defined">host-defined</a></emu-xref> facilities.</p>
|
||
<p>A <dfn id="host-environment" variants="host environments" tabindex="-1">host environment</dfn> is a particular choice of definition for all <emu-xref href="#host-defined" id="_ref_1042"><a href="overview.html#host-defined">host-defined</a></emu-xref> facilities. A <emu-xref href="#host-environment" id="_ref_1043"><a href="overview.html#host-environment">host environment</a></emu-xref> typically includes objects or functions which allow obtaining input and providing output as <emu-xref href="#host-defined" id="_ref_1044"><a href="overview.html#host-defined">host-defined</a></emu-xref> properties of the <emu-xref href="#sec-global-object" id="_ref_1045"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</p>
|
||
<p>This specification follows the editorial convention of always using the most specific term. For example, if a facility is <emu-xref href="#host-defined" id="_ref_1046"><a href="overview.html#host-defined">host-defined</a></emu-xref>, it should not be referred to as <emu-xref href="#implementation-defined" id="_ref_1047"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>.</p>
|
||
<p>Both <emu-xref href="#host" id="_ref_1048"><a href="overview.html#host">hosts</a></emu-xref> and implementations may interface with this specification via the language types, specification types, <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_1049"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref>, grammar productions, intrinsic objects, and intrinsic symbols defined herein.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-ecmascript-overview">
|
||
<h1><span class="secnum">4.3</span> ECMAScript Overview</h1>
|
||
<p>The following is an informal overview of ECMAScript—not all parts of the language are described. This overview is not part of the standard proper.</p>
|
||
<p>ECMAScript is object-based: basic language and <emu-xref href="#host" id="_ref_1050"><a href="overview.html#host">host</a></emu-xref> facilities are provided by objects, and an ECMAScript program is a cluster of communicating objects. In ECMAScript, an <em>object</em> is a collection of zero or more <em>properties</em> each with <em>attributes</em> that determine how each property can be used—for example, when the Writable attribute for a property is set to <emu-val>false</emu-val>, any attempt by executed ECMAScript code to assign a different value to the property fails. Properties are containers that hold other objects, <em>primitive values</em>, or <em>functions</em>. A primitive value is a member of one of the following built-in types: <b>Undefined</b>, <b>Null</b>, <b>Boolean</b>, <b>Number</b>, <b>BigInt</b>, <b>String</b>, and <b>Symbol;</b> an object is a member of the built-in type <b>Object</b>; and a function is a callable object. A function that is associated with an object via a property is called a <em>method</em>.</p>
|
||
<p>ECMAScript defines a collection of <em>built-in objects</em> that round out the definition of ECMAScript entities. These built-in objects include the <emu-xref href="#sec-global-object" id="_ref_1051"><a href="global-object.html#sec-global-object">global object</a></emu-xref>; objects that are fundamental to the <emu-xref href="#sec-runtime-semantics" id="_ref_1052"><a href="notational-conventions.html#sec-runtime-semantics">runtime semantics</a></emu-xref> of the language including <code>Object</code>, <code>Function</code>, <code>Boolean</code>, <code>Symbol</code>, and various <code>Error</code> objects; objects that represent and manipulate numeric values including <code>Math</code>, <code>Number</code>, and <code>Date</code>; the text processing objects <code>String</code> and <code>RegExp</code>; objects that are indexed collections of values including <code>Array</code> and nine different kinds of Typed Arrays whose elements all have a specific numeric data representation; keyed collections including <code>Map</code> and <code>Set</code> objects; objects supporting structured data including the <code>JSON</code> object, <code>ArrayBuffer</code>, <code>SharedArrayBuffer</code>, and <code>DataView</code>; objects supporting control abstractions including generator functions and <code>Promise</code> objects; and reflection objects including <code>Proxy</code> and <code>Reflect</code>.</p>
|
||
<p>ECMAScript also defines a set of built-in <em>operators</em>. ECMAScript operators include various unary operations, multiplicative operators, additive operators, bitwise shift operators, relational operators, equality operators, binary bitwise operators, binary logical operators, assignment operators, and the comma operator.</p>
|
||
<p>Large ECMAScript programs are supported by <em>modules</em> which allow a program to be divided into multiple sequences of statements and declarations. Each module explicitly identifies declarations it uses that need to be provided by other modules and which of its declarations are available for use by other modules.</p>
|
||
<p>ECMAScript syntax intentionally resembles Java syntax. ECMAScript syntax is relaxed to enable it to serve as an easy-to-use scripting language. For example, a variable is not required to have its type declared nor are types associated with properties, and defined functions are not required to have their declarations appear textually before calls to them.</p>
|
||
|
||
<emu-clause id="sec-objects">
|
||
<h1><span class="secnum">4.3.1</span> Objects</h1>
|
||
<p>Even though ECMAScript includes syntax for class definitions, ECMAScript objects are not fundamentally class-based such as those in C++, Smalltalk, or Java. Instead objects may be created in various ways including via a literal notation or via <em><emu-xref href="#constructor" id="_ref_1053"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref></em> which create objects and then execute code that initializes all or part of them by assigning initial values to their properties. Each <emu-xref href="#constructor" id="_ref_1054"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is a function that has a property named <emu-val>"prototype"</emu-val> that is used to implement <em>prototype-based inheritance</em> and <em>shared properties</em>. Objects are created by using <emu-xref href="#constructor" id="_ref_1055"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> in <b>new</b> expressions; for example, <code>new Date(2009, 11)</code> creates a new Date object. Invoking a <emu-xref href="#constructor" id="_ref_1056"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> without using <b>new</b> has consequences that depend on the <emu-xref href="#constructor" id="_ref_1057"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. For example, <code>Date()</code> produces a string representation of the current date and time rather than an object.</p>
|
||
<p>Every object created by a <emu-xref href="#constructor" id="_ref_1058"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> has an implicit reference (called the object's <em>prototype</em>) to the value of its <emu-xref href="#constructor" id="_ref_1059"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>'s <emu-val>"prototype"</emu-val> property. Furthermore, a prototype may have a non-<emu-val>null</emu-val> implicit reference to its prototype, and so on; this is called the <em>prototype chain</em>. When a reference is made to a property in an object, that reference is to the property of that name in the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if that object contains the named property, that is the property to which the reference refers; if that object does not contain the named property, the prototype for that object is examined next; and so on.</p>
|
||
<emu-figure id="figure-1" caption="Object/Prototype Relationships"><figure><figcaption>Figure 1: Object/Prototype Relationships</figcaption>
|
||
<img alt="An image of lots of boxes and arrows." height="354" src="../img/figure-1.svg" width="719">
|
||
</figure></emu-figure>
|
||
<p>In a class-based object-oriented language, in general, state is carried by instances, methods are carried by classes, and inheritance is only of structure and behaviour. In ECMAScript, the state and methods are carried by objects, while structure, behaviour, and state are all inherited.</p>
|
||
<p>All objects that do not directly contain a particular property that their prototype contains share that property and its value. Figure 1 illustrates this:</p>
|
||
<p><b>CF</b> is a <emu-xref href="#constructor" id="_ref_1060"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> (and also an object). Five objects have been created by using <code>new</code> expressions: <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>, <b>cf<sub>4</sub></b>, and <b>cf<sub>5</sub></b>. Each of these objects contains properties named <emu-val>"q1"</emu-val> and <emu-val>"q2"</emu-val>. The dashed lines represent the implicit prototype relationship; so, for example, <b>cf<sub>3</sub></b>'s prototype is <b>CF<sub>p</sub></b>. The <emu-xref href="#constructor" id="_ref_1061"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>, <b>CF</b>, has two properties itself, named <emu-val>"P1"</emu-val> and <emu-val>"P2"</emu-val>, which are not visible to <b>CF<sub>p</sub></b>, <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>, <b>cf<sub>4</sub></b>, or <b>cf<sub>5</sub></b>. The property named <emu-val>"CFP1"</emu-val> in <b>CF<sub>p</sub></b> is shared by <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>, <b>cf<sub>4</sub></b>, and <b>cf<sub>5</sub></b> (but not by <b>CF</b>), as are any properties found in <b>CF<sub>p</sub></b>'s implicit prototype chain that are not named <emu-val>"q1"</emu-val>, <emu-val>"q2"</emu-val>, or <emu-val>"CFP1"</emu-val>. Notice that there is no implicit prototype link between <b>CF</b> and <b>CF<sub>p</sub></b>.</p>
|
||
<p>Unlike most class-based object languages, properties can be added to objects dynamically by assigning values to them. That is, <emu-xref href="#constructor" id="_ref_1062"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> are not required to name or assign values to all or any of the constructed object's properties. In the above diagram, one could add a new shared property for <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>, <b>cf<sub>4</sub></b>, and <b>cf<sub>5</sub></b> by assigning a new value to the property in <b>CF<sub>p</sub></b>.</p>
|
||
<p>Although ECMAScript objects are not inherently class-based, it is often convenient to define class-like abstractions based upon a common pattern of <emu-xref href="#constructor" id="_ref_1063"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> functions, prototype objects, and methods. The ECMAScript built-in objects themselves follow such a class-like pattern. Beginning with ECMAScript 2015, the ECMAScript language includes syntactic class definitions that permit programmers to concisely define objects that conform to the same class-like abstraction pattern used by the built-in objects.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-strict-variant-of-ecmascript">
|
||
<h1><span class="secnum">4.3.2</span> The Strict Variant of ECMAScript</h1>
|
||
<p>The ECMAScript Language recognizes the possibility that some users of the language may wish to restrict their usage of some features available in the language. They might do so in the interests of security, to avoid what they consider to be error-prone features, to get enhanced error checking, or for other reasons of their choosing. In support of this possibility, ECMAScript defines a strict variant of the language. The strict variant of the language excludes some specific syntactic and semantic features of the regular ECMAScript language and modifies the detailed semantics of some features. The strict variant also specifies additional error conditions that must be reported by throwing error exceptions in situations that are not specified as errors by the non-strict form of the language.</p>
|
||
<p>The strict variant of ECMAScript is commonly referred to as the <em>strict mode</em> of the language. Strict mode selection and use of the strict mode syntax and semantics of ECMAScript is explicitly made at the level of individual <emu-xref href="#sec-source-text" id="_ref_1064"><a href="ecmascript-language-source-code.html#sec-source-text">ECMAScript source text</a></emu-xref> units as described in <emu-xref href="#sec-strict-mode-code" id="_ref_10"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">11.2.2</a></emu-xref>. Because strict mode is selected at the level of a syntactic source text unit, strict mode only imposes restrictions that have local effect within such a source text unit. Strict mode does not restrict or modify any aspect of the ECMAScript semantics that must operate consistently across multiple source text units. A complete ECMAScript program may be composed of both strict mode and non-strict mode <emu-xref href="#sec-source-text" id="_ref_1065"><a href="ecmascript-language-source-code.html#sec-source-text">ECMAScript source text</a></emu-xref> units. In this case, strict mode only applies when actually executing code that is defined within a strict mode source text unit.</p>
|
||
<p>In order to conform to this specification, an ECMAScript implementation must implement both the full unrestricted ECMAScript language and the strict variant of the ECMAScript language as defined by this specification. In addition, an implementation must support the combination of unrestricted and strict mode source text units into a single composite program.</p>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions">
|
||
<h1><span class="secnum">4.4</span> Terms and Definitions</h1>
|
||
<p>For the purposes of this document, the following terms and definitions apply.</p>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-implementation-approximated">
|
||
<h1><span class="secnum">4.4.1</span> implementation-approximated</h1>
|
||
<p>an <emu-xref href="#implementation-approximated" id="_ref_1066"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> facility is defined in whole or in part by an external source but has a recommended, ideal behaviour in this specification</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-implementation-defined">
|
||
<h1><span class="secnum">4.4.2</span> implementation-defined</h1>
|
||
<p>an <emu-xref href="#implementation-defined" id="_ref_1067"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> facility is defined in whole or in part by an external source to this specification</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-host-defined">
|
||
<h1><span class="secnum">4.4.3</span> host-defined</h1>
|
||
<p>same as <emu-xref href="#implementation-defined" id="_ref_1068"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Editorially, see clause <emu-xref href="#sec-hosts-and-implementations" id="_ref_11"><a href="overview.html#sec-hosts-and-implementations">4.2</a></emu-xref>.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-type">
|
||
<h1><span class="secnum">4.4.4</span> type</h1>
|
||
<p>set of data values as defined in clause <emu-xref href="#sec-ecmascript-data-types-and-values" id="_ref_12"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-data-types-and-values">6</a></emu-xref></p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-primitive-value">
|
||
<h1><span class="secnum">4.4.5</span> primitive value</h1>
|
||
<p>member of one of the types Undefined, Null, Boolean, Number, BigInt, Symbol, or String as defined in clause <emu-xref href="#sec-ecmascript-data-types-and-values" id="_ref_13"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-data-types-and-values">6</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A primitive value is a datum that is represented directly at the lowest level of the language implementation.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-object">
|
||
<h1><span class="secnum">4.4.6</span> object</h1>
|
||
<p>member of the type Object</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>An object is a collection of properties and has a single prototype object. The prototype may be <emu-val>null</emu-val>.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor">
|
||
<h1><span class="secnum">4.4.7</span> constructor</h1>
|
||
<p><emu-xref href="#function-object" id="_ref_1069"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> that creates and initializes objects</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>The value of a <emu-xref href="#constructor" id="_ref_1070"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>'s <emu-val>"prototype"</emu-val> property is a prototype object that is used to implement inheritance and shared properties.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-prototype">
|
||
<h1><span class="secnum">4.4.8</span> prototype</h1>
|
||
<p>object that provides shared properties for other objects</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>When a <emu-xref href="#constructor" id="_ref_1071"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> creates an object, that object implicitly references the <emu-xref href="#constructor" id="_ref_1072"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>'s <emu-val>"prototype"</emu-val> property for the purpose of resolving property references. The <emu-xref href="#constructor" id="_ref_1073"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>'s <emu-val>"prototype"</emu-val> property can be referenced by the program expression <code><var>constructor</var>.prototype</code>, and properties added to an object's prototype are shared, through inheritance, by all objects sharing the prototype. Alternatively, a new object may be created with an explicitly specified prototype by using the <code>Object.create</code> built-in function.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-ordinary-object">
|
||
<h1><span class="secnum">4.4.9</span> ordinary object</h1>
|
||
<p>object that has the default behaviour for the essential internal methods that must be supported by all objects</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-exotic-object">
|
||
<h1><span class="secnum">4.4.10</span> exotic object</h1>
|
||
<p>object that does not have the default behaviour for one or more of the essential internal methods</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Any object that is not an <emu-xref href="#ordinary-object" id="_ref_1074"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> is an <emu-xref href="#exotic-object" id="_ref_1075"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref>.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-standard-object">
|
||
<h1><span class="secnum">4.4.11</span> standard object</h1>
|
||
<p>object whose semantics are defined by this specification</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-built-in-object">
|
||
<h1><span class="secnum">4.4.12</span> built-in object</h1>
|
||
<p>object specified and supplied by an ECMAScript implementation</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Standard built-in objects are defined in this specification. An ECMAScript implementation may specify and supply additional kinds of built-in objects.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-undefined-value">
|
||
<h1><span class="secnum">4.4.13</span> undefined value</h1>
|
||
<p>primitive value used when a variable has not been assigned a value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-undefined-type">
|
||
<h1><span class="secnum">4.4.14</span> Undefined type</h1>
|
||
<p>type whose sole value is the <emu-val>undefined</emu-val> value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-null-value">
|
||
<h1><span class="secnum">4.4.15</span> null value</h1>
|
||
<p>primitive value that represents the intentional absence of any object value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-null-type">
|
||
<h1><span class="secnum">4.4.16</span> Null type</h1>
|
||
<p>type whose sole value is the <emu-val>null</emu-val> value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-boolean-value">
|
||
<h1><span class="secnum">4.4.17</span> Boolean value</h1>
|
||
<p>member of the <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_1076"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">Boolean type</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>There are only two Boolean values, <emu-val>true</emu-val> and <emu-val>false</emu-val>.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-boolean-type">
|
||
<h1><span class="secnum">4.4.18</span> Boolean type</h1>
|
||
<p>type consisting of the primitive values <emu-val>true</emu-val> and <emu-val>false</emu-val></p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-boolean-object">
|
||
<h1><span class="secnum">4.4.19</span> Boolean object</h1>
|
||
<p>member of the <emu-xref href="#sec-object-type" id="_ref_1077"><a href="ecmascript-data-types-and-values.html#sec-object-type">Object type</a></emu-xref> that is an instance of the standard built-in Boolean <emu-xref href="#constructor" id="_ref_1078"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A Boolean object is created by using the Boolean <emu-xref href="#constructor" id="_ref_1079"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> in a <code>new</code> expression, supplying a Boolean value as an argument. The resulting object has an internal slot whose value is the Boolean value. A Boolean object can be coerced to a Boolean value.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-string-value">
|
||
<h1><span class="secnum">4.4.20</span> String value</h1>
|
||
<p>primitive value that is a <emu-xref href="#finite" id="_ref_1080"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> ordered sequence of zero or more 16-bit unsigned <emu-xref href="#integer" id="_ref_1081"><a href="notational-conventions.html#integer">integer</a></emu-xref> values</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A String value is a member of the <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_1082"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">String type</a></emu-xref>. Each <emu-xref href="#integer" id="_ref_1083"><a href="notational-conventions.html#integer">integer</a></emu-xref> value in the sequence usually represents a single 16-bit unit of UTF-16 text. However, ECMAScript does not place any restrictions or requirements on the values except that they must be 16-bit unsigned <emu-xref href="#integer" id="_ref_1084"><a href="notational-conventions.html#integer">integers</a></emu-xref>.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-string-type">
|
||
<h1><span class="secnum">4.4.21</span> String type</h1>
|
||
<p>set of all possible String values</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-string-object">
|
||
<h1><span class="secnum">4.4.22</span> String object</h1>
|
||
<p>member of the <emu-xref href="#sec-object-type" id="_ref_1085"><a href="ecmascript-data-types-and-values.html#sec-object-type">Object type</a></emu-xref> that is an instance of the standard built-in String <emu-xref href="#constructor" id="_ref_1086"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A String object is created by using the String <emu-xref href="#constructor" id="_ref_1087"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> in a <code>new</code> expression, supplying a String value as an argument. The resulting object has an internal slot whose value is the String value. A String object can be coerced to a String value by calling the String <emu-xref href="#constructor" id="_ref_1088"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> as a function (<emu-xref href="#sec-string-constructor-string-value" id="_ref_14"><a href="text-processing.html#sec-string-constructor-string-value">22.1.1.1</a></emu-xref>).</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-number-value">
|
||
<h1><span class="secnum">4.4.23</span> Number value</h1>
|
||
<p>primitive value corresponding to a double-precision 64-bit binary format <emu-xref href="#sec-bibliography" id="_ref_1089"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> value</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A Number value is a member of the <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_1090"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">Number type</a></emu-xref> and is a direct representation of a number.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-number-type">
|
||
<h1><span class="secnum">4.4.24</span> Number type</h1>
|
||
<p>set of all possible Number values including <emu-val>NaN</emu-val> (“not a number”), <emu-val>+∞</emu-val><sub>𝔽</sub> (positive infinity), and <emu-val>-∞</emu-val><sub>𝔽</sub> (negative infinity)</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-number-object">
|
||
<h1><span class="secnum">4.4.25</span> Number object</h1>
|
||
<p>member of the <emu-xref href="#sec-object-type" id="_ref_1091"><a href="ecmascript-data-types-and-values.html#sec-object-type">Object type</a></emu-xref> that is an instance of the standard built-in Number <emu-xref href="#constructor" id="_ref_1092"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A Number object is created by using the Number <emu-xref href="#constructor" id="_ref_1093"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> in a <code>new</code> expression, supplying a Number value as an argument. The resulting object has an internal slot whose value is the Number value. A Number object can be coerced to a Number value by calling the Number <emu-xref href="#constructor" id="_ref_1094"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> as a function (<emu-xref href="#sec-number-constructor-number-value" id="_ref_15"><a href="numbers-and-dates.html#sec-number-constructor-number-value">21.1.1.1</a></emu-xref>).</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-infinity">
|
||
<h1><span class="secnum">4.4.26</span> Infinity</h1>
|
||
<p>Number value that is the positive infinite Number value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-nan">
|
||
<h1><span class="secnum">4.4.27</span> NaN</h1>
|
||
<p>Number value that is an <emu-xref href="#sec-bibliography" id="_ref_1095"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> NaN (“not a number”) value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-bigint-value">
|
||
<h1><span class="secnum">4.4.28</span> BigInt value</h1>
|
||
<p>primitive value corresponding to an arbitrary-precision <emu-xref href="#integer" id="_ref_1096"><a href="notational-conventions.html#integer">integer</a></emu-xref> value</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-bigint-type">
|
||
<h1><span class="secnum">4.4.29</span> BigInt type</h1>
|
||
<p>set of all possible BigInt values</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-bigint-object">
|
||
<h1><span class="secnum">4.4.30</span> BigInt object</h1>
|
||
<p>member of the <emu-xref href="#sec-object-type" id="_ref_1097"><a href="ecmascript-data-types-and-values.html#sec-object-type">Object type</a></emu-xref> that is an instance of the standard built-in BigInt <emu-xref href="#constructor" id="_ref_1098"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref></p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-symbol-value">
|
||
<h1><span class="secnum">4.4.31</span> Symbol value</h1>
|
||
<p>primitive value that represents a unique, non-String Object <emu-xref href="#property-key" id="_ref_1099"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref></p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-symbol-type">
|
||
<h1><span class="secnum">4.4.32</span> Symbol type</h1>
|
||
<p>set of all possible Symbol values</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-symbol-object">
|
||
<h1><span class="secnum">4.4.33</span> Symbol object</h1>
|
||
<p>member of the <emu-xref href="#sec-object-type" id="_ref_1100"><a href="ecmascript-data-types-and-values.html#sec-object-type">Object type</a></emu-xref> that is an instance of the standard built-in Symbol <emu-xref href="#constructor" id="_ref_1101"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref></p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-terms-and-definitions-function">
|
||
<h1><span class="secnum">4.4.34</span> function</h1>
|
||
<p>member of the <emu-xref href="#sec-object-type" id="_ref_1102"><a href="ecmascript-data-types-and-values.html#sec-object-type">Object type</a></emu-xref> that may be invoked as a subroutine</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>In addition to its properties, a function contains executable code and state that determine how it behaves when invoked. A function's code may or may not be written in ECMAScript.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-built-in-function">
|
||
<h1><span class="secnum">4.4.35</span> built-in function</h1>
|
||
<p>built-in object that is a function</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Examples of built-in functions include <code>parseInt</code> and <code>Math.exp</code>. A <emu-xref href="#host" id="_ref_1103"><a href="overview.html#host">host</a></emu-xref> or implementation may provide additional built-in functions that are not described in this specification.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-built-in-constructor">
|
||
<h1><span class="secnum">4.4.36</span> built-in constructor</h1>
|
||
<p>built-in function that is a <emu-xref href="#constructor" id="_ref_1104"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref></p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Examples of built-in <emu-xref href="#constructor" id="_ref_1105"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> include <code>Object</code> and <code>Function</code>. A <emu-xref href="#host" id="_ref_1106"><a href="overview.html#host">host</a></emu-xref> or implementation may provide additional built-in <emu-xref href="#constructor" id="_ref_1107"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that are not described in this specification.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-property">
|
||
<h1><span class="secnum">4.4.37</span> property</h1>
|
||
<p>part of an object that associates a key (either a String value or a Symbol value) and a value</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Depending upon the form of the property the value may be represented either directly as a data value (a primitive value, an object, or a <emu-xref href="#function-object" id="_ref_1108"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) or indirectly by a pair of accessor functions.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-method">
|
||
<h1><span class="secnum">4.4.38</span> method</h1>
|
||
<p>function that is the value of a property</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>When a function is called as a method of an object, the object is passed to the function as its <emu-val>this</emu-val> value.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-built-in-method">
|
||
<h1><span class="secnum">4.4.39</span> built-in method</h1>
|
||
<p>method that is a built-in function</p>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Standard built-in methods are defined in this specification. A <emu-xref href="#host" id="_ref_1109"><a href="overview.html#host">host</a></emu-xref> or implementation may provide additional built-in methods that are not described in this specification.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-attribute">
|
||
<h1><span class="secnum">4.4.40</span> attribute</h1>
|
||
<p>internal value that defines some characteristic of a property</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-own-property">
|
||
<h1><span class="secnum">4.4.41</span> own property</h1>
|
||
<p>property that is directly contained by its object</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-inherited-property">
|
||
<h1><span class="secnum">4.4.42</span> inherited property</h1>
|
||
<p>property of an object that is not an own property but is a property (either own or inherited) of the object's prototype</p>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-organization-of-this-specification">
|
||
<h1><span class="secnum">4.5</span> Organization of This Specification</h1>
|
||
<p>The remainder of this specification is organized as follows:</p>
|
||
<p>Clause <emu-xref href="#sec-notational-conventions" id="_ref_16"><a href="notational-conventions.html#sec-notational-conventions">5</a></emu-xref> defines the notational conventions used throughout the specification.</p>
|
||
<p>Clauses <emu-xref href="#sec-ecmascript-data-types-and-values" id="_ref_17"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-data-types-and-values">6</a></emu-xref> through <emu-xref href="#sec-ordinary-and-exotic-objects-behaviours" id="_ref_18"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-and-exotic-objects-behaviours">10</a></emu-xref> define the execution environment within which ECMAScript programs operate.</p>
|
||
<p>Clauses <emu-xref href="#sec-ecmascript-language-source-code" id="_ref_19"><a href="ecmascript-language-source-code.html#sec-ecmascript-language-source-code">11</a></emu-xref> through <emu-xref href="#sec-error-handling-and-language-extensions" id="_ref_20"><a href="error-handling-and-language-extensions.html#sec-error-handling-and-language-extensions">17</a></emu-xref> define the actual ECMAScript programming language including its syntactic encoding and the execution semantics of all language features.</p>
|
||
<p>Clauses <emu-xref href="#sec-ecmascript-standard-built-in-objects" id="_ref_21"><a href="ecmascript-standard-built-in-objects.html#sec-ecmascript-standard-built-in-objects">18</a></emu-xref> through <emu-xref href="#sec-reflection" id="_ref_22"><a href="reflection.html#sec-reflection">28</a></emu-xref> define the ECMAScript standard library. They include the definitions of all of the standard objects that are available for use by ECMAScript programs as they execute.</p>
|
||
<p>Clause <emu-xref href="#sec-memory-model" id="_ref_23"><a href="memory-model.html#sec-memory-model">29</a></emu-xref> describes the memory consistency model of accesses on SharedArrayBuffer-backed memory and methods of the Atomics object.</p>
|
||
</emu-clause>
|
||
</emu-clause></div></body></html> |