mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
422 lines
93 KiB
HTML
422 lines
93 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-global-object"></head>
|
||
<body><div id="spec-container"><emu-clause id="sec-global-object">
|
||
<h1><span class="secnum">19</span> The Global Object</h1>
|
||
<p>The <dfn variants="global objects" tabindex="-1">global object</dfn>:</p>
|
||
<ul>
|
||
<li>is created before control enters any <emu-xref href="#sec-execution-contexts" id="_ref_9525"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref>.</li>
|
||
<li>does not have a <var class="field">[[Construct]]</var> internal method; it cannot be used as a <emu-xref href="#constructor" id="_ref_9526"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> with the <code>new</code> operator.</li>
|
||
<li>does not have a <var class="field">[[Call]]</var> internal method; it cannot be invoked as a function.</li>
|
||
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#host-defined" id="_ref_9527"><a href="overview.html#host-defined">host-defined</a></emu-xref>.</li>
|
||
<li>may have <emu-xref href="#host-defined" id="_ref_9528"><a href="overview.html#host-defined">host-defined</a></emu-xref> properties in addition to the properties defined in this specification. This may include a property whose value is the global object itself.</li>
|
||
</ul>
|
||
|
||
<emu-clause id="sec-value-properties-of-the-global-object">
|
||
<h1><span class="secnum">19.1</span> Value Properties of the Global Object</h1>
|
||
|
||
<emu-clause id="sec-globalthis">
|
||
<h1><span class="secnum">19.1.1</span> globalThis</h1>
|
||
<p>The initial value of the <emu-val>"globalThis"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_9529"><a href="global-object.html#sec-global-object">global object</a></emu-xref> in a <emu-xref href="#realm-record" id="_ref_9530"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref> <var>realm</var> is <var>realm</var>.<var class="field">[[GlobalEnv]]</var>.<var class="field">[[GlobalThisValue]]</var>.</p>
|
||
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-value-properties-of-the-global-object-infinity">
|
||
<h1><span class="secnum">19.1.2</span> Infinity</h1>
|
||
<p>The value of <code>Infinity</code> is <emu-val>+∞</emu-val><sub>𝔽</sub> (see <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_537"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">6.1.6.1</a></emu-xref>). This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-value-properties-of-the-global-object-nan">
|
||
<h1><span class="secnum">19.1.3</span> NaN</h1>
|
||
<p>The value of <code>NaN</code> is <emu-val>NaN</emu-val> (see <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_538"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">6.1.6.1</a></emu-xref>). This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-undefined">
|
||
<h1><span class="secnum">19.1.4</span> undefined</h1>
|
||
<p>The value of <code>undefined</code> is <emu-val>undefined</emu-val> (see <emu-xref href="#sec-ecmascript-language-types-undefined-type" id="_ref_539"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-undefined-type">6.1.1</a></emu-xref>). This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-function-properties-of-the-global-object">
|
||
<h1><span class="secnum">19.2</span> Function Properties of the Global Object</h1>
|
||
|
||
<emu-clause id="sec-eval-x" type="built-in function">
|
||
<h1><span class="secnum">19.2.1</span> eval ( <var>x</var> )</h1>
|
||
<p>This function is the <dfn tabindex="-1">%eval%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Return ? <emu-xref aoid="PerformEval" id="_ref_9531"><a href="global-object.html#sec-performeval" class="e-user-code">PerformEval</a></emu-xref>(<var>x</var>, <emu-val>false</emu-val>, <emu-val>false</emu-val>).</li></ol></emu-alg>
|
||
|
||
<emu-clause id="sec-performeval" type="abstract operation" oldids="sec-performeval-rules-outside-functions,sec-performeval-rules-outside-methods,sec-performeval-rules-outside-constructors" aoid="PerformEval"><span id="sec-performeval-rules-outside-constructors"></span><span id="sec-performeval-rules-outside-methods"></span><span id="sec-performeval-rules-outside-functions"></span>
|
||
<h1><span class="secnum">19.2.1.1</span> PerformEval ( <var>x</var>, <var>strictCaller</var>, <var>direct</var> )</h1>
|
||
<p>The abstract operation PerformEval takes arguments <var>x</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_9532"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), <var>strictCaller</var> (a Boolean), and <var>direct</var> (a Boolean) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9533"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_9534"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9535"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
|
||
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_9536"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: If <var>direct</var> is <emu-val>false</emu-val>, then <var>strictCaller</var> is also <emu-val>false</emu-val>.</li><li>If <var>x</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_9537"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is not a String</a></emu-xref>, return <var>x</var>.</li><li>Let <var>evalRealm</var> be <emu-xref href="#current-realm" id="_ref_9538"><a href="executable-code-and-execution-contexts.html#current-realm">the current Realm Record</a></emu-xref>.</li><li>NOTE: In the case of a <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_9539"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref>, <var>evalRealm</var> is the <emu-xref href="#realm" id="_ref_9540"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> of both the caller of <code>eval</code> and of the <code>eval</code> function itself.</li><li>Perform ? <emu-xref aoid="HostEnsureCanCompileStrings" id="_ref_9541"><a href="global-object.html#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</a></emu-xref>(<var>evalRealm</var>, « », <var>x</var>, <var>direct</var>).</li><li>Let <var>inFunction</var> be <emu-val>false</emu-val>.</li><li>Let <var>inMethod</var> be <emu-val>false</emu-val>.</li><li>Let <var>inDerivedConstructor</var> be <emu-val>false</emu-val>.</li><li>Let <var>inClassFieldInitializer</var> be <emu-val>false</emu-val>.</li><li>If <var>direct</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>thisEnvRec</var> be <emu-xref aoid="GetThisEnvironment" id="_ref_9542"><a href="executable-code-and-execution-contexts.html#sec-getthisenvironment">GetThisEnvironment</a></emu-xref>().</li><li>If <var>thisEnvRec</var> is a <emu-xref href="#sec-function-environment-records" id="_ref_9543"><a href="executable-code-and-execution-contexts.html#sec-function-environment-records">Function Environment Record</a></emu-xref>, then<ol><li>Let <var>F</var> be <var>thisEnvRec</var>.<var class="field">[[FunctionObject]]</var>.</li><li>Set <var>inFunction</var> to <emu-val>true</emu-val>.</li><li>Set <var>inMethod</var> to <var>thisEnvRec</var>.<emu-xref aoid="HasSuperBinding" id="_ref_9544"><a href="executable-code-and-execution-contexts.html#abstract-hassuperbinding">HasSuperBinding</a></emu-xref>().</li><li>If <var>F</var>.<var class="field">[[ConstructorKind]]</var> is <emu-const>derived</emu-const>, set <var>inDerivedConstructor</var> to <emu-val>true</emu-val>.</li><li>Let <var>classFieldInitializerName</var> be <var>F</var>.<var class="field">[[ClassFieldInitializerName]]</var>.</li><li>If <var>classFieldInitializerName</var> is not <emu-const>empty</emu-const>, set <var>inClassFieldInitializer</var> to <emu-val>true</emu-val>.</li></ol></li></ol></li><li>Perform the following substeps in an <emu-xref href="#implementation-defined" id="_ref_9545"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> order, possibly interleaving parsing and error detection:<ol><li>Let <var>script</var> be <emu-xref aoid="ParseText" id="_ref_9546"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>x</var>, <emu-nt id="_ref_23789"><a href="ecmascript-language-scripts-and-modules.html#prod-Script">Script</a></emu-nt>).</li><li>If <var>script</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9547"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of errors, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>If <var>script</var> <emu-xref aoid="Contains" id="_ref_9548"><a href="syntax-directed-operations.html#sec-static-semantics-contains">Contains</a></emu-xref> <emu-nt id="_ref_23790"><a href="ecmascript-language-scripts-and-modules.html#prod-ScriptBody">ScriptBody</a></emu-nt> is <emu-val>false</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Let <var>body</var> be the <emu-nt id="_ref_23791"><a href="ecmascript-language-scripts-and-modules.html#prod-ScriptBody">ScriptBody</a></emu-nt> of <var>script</var>.</li><li>If <var>inFunction</var> is <emu-val>false</emu-val> and <var>body</var> <emu-xref aoid="Contains" id="_ref_9549"><a href="syntax-directed-operations.html#sec-static-semantics-contains">Contains</a></emu-xref> <emu-nt id="_ref_23792"><a href="ecmascript-language-expressions.html#prod-NewTarget">NewTarget</a></emu-nt>, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>If <var>inMethod</var> is <emu-val>false</emu-val> and <var>body</var> <emu-xref aoid="Contains" id="_ref_9550"><a href="syntax-directed-operations.html#sec-static-semantics-contains">Contains</a></emu-xref> <emu-nt id="_ref_23793"><a href="ecmascript-language-expressions.html#prod-SuperProperty">SuperProperty</a></emu-nt>, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>If <var>inDerivedConstructor</var> is <emu-val>false</emu-val> and <var>body</var> <emu-xref aoid="Contains" id="_ref_9551"><a href="syntax-directed-operations.html#sec-static-semantics-contains">Contains</a></emu-xref> <emu-nt id="_ref_23794"><a href="ecmascript-language-expressions.html#prod-SuperCall">SuperCall</a></emu-nt>, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>If <var>inClassFieldInitializer</var> is <emu-val>true</emu-val> and <emu-xref aoid="ContainsArguments" id="_ref_9552"><a href="ecmascript-language-functions-and-classes.html#sec-static-semantics-containsarguments">ContainsArguments</a></emu-xref> of <var>body</var> is <emu-val>true</emu-val>, throw a <emu-val>SyntaxError</emu-val> exception.</li></ol></li><li>If <var>strictCaller</var> is <emu-val>true</emu-val>, let <var>strictEval</var> be <emu-val>true</emu-val>.</li><li>Else, let <var>strictEval</var> be <emu-xref aoid="ScriptIsStrict" id="_ref_9553"><a href="ecmascript-language-scripts-and-modules.html#sec-scriptisstrict">ScriptIsStrict</a></emu-xref> of <var>script</var>.</li><li>Let <var>runningContext</var> be the <emu-xref href="#running-execution-context" id="_ref_9554"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>NOTE: If <var>direct</var> is <emu-val>true</emu-val>, <var>runningContext</var> will be the <emu-xref href="#sec-execution-contexts" id="_ref_9555"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref> that performed the <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_9556"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref>. If <var>direct</var> is <emu-val>false</emu-val>, <var>runningContext</var> will be the <emu-xref href="#sec-execution-contexts" id="_ref_9557"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref> for the invocation of the <code>eval</code> function.</li><li>If <var>direct</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>lexEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_9558"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>runningContext</var>'s LexicalEnvironment).</li><li>Let <var>varEnv</var> be <var>runningContext</var>'s VariableEnvironment.</li><li>Let <var>privateEnv</var> be <var>runningContext</var>'s PrivateEnvironment.</li></ol></li><li>Else,<ol><li>Let <var>lexEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_9559"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>evalRealm</var>.<var class="field">[[GlobalEnv]]</var>).</li><li>Let <var>varEnv</var> be <var>evalRealm</var>.<var class="field">[[GlobalEnv]]</var>.</li><li>Let <var>privateEnv</var> be <emu-val>null</emu-val>.</li></ol></li><li>If <var>strictEval</var> is <emu-val>true</emu-val>, set <var>varEnv</var> to <var>lexEnv</var>.</li><li>If <var>runningContext</var> is not already suspended, suspend <var>runningContext</var>.</li><li>Let <var>evalContext</var> be a new <emu-xref href="#ecmascript-code-execution-context" id="_ref_9560"><a href="executable-code-and-execution-contexts.html#ecmascript-code-execution-context">ECMAScript code execution context</a></emu-xref>.</li><li>Set <var>evalContext</var>'s Function to <emu-val>null</emu-val>.</li><li>Set <var>evalContext</var>'s <emu-xref href="#realm" id="_ref_9561"><a href="executable-code-and-execution-contexts.html#realm">Realm</a></emu-xref> to <var>evalRealm</var>.</li><li>Set <var>evalContext</var>'s ScriptOrModule to <var>runningContext</var>'s ScriptOrModule.</li><li>Set <var>evalContext</var>'s VariableEnvironment to <var>varEnv</var>.</li><li>Set <var>evalContext</var>'s LexicalEnvironment to <var>lexEnv</var>.</li><li>Set <var>evalContext</var>'s PrivateEnvironment to <var>privateEnv</var>.</li><li>Push <var>evalContext</var> onto the <emu-xref href="#execution-context-stack" id="_ref_9562"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref>; <var>evalContext</var> is now the <emu-xref href="#running-execution-context" id="_ref_9563"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Let <var>result</var> be <emu-xref aoid="Completion" id="_ref_9564"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="EvalDeclarationInstantiation" id="_ref_9565"><a href="global-object.html#sec-evaldeclarationinstantiation" class="e-user-code">EvalDeclarationInstantiation</a></emu-xref>(<var>body</var>, <var>varEnv</var>, <var>lexEnv</var>, <var>privateEnv</var>, <var>strictEval</var>)).</li><li>If <var>result</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9566"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref>, then<ol><li>Set <var>result</var> to <emu-xref aoid="Completion" id="_ref_9567"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_9568"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>body</var>).</li></ol></li><li>If <var>result</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9569"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref> and <var>result</var>.<var class="field">[[Value]]</var> is <emu-const>empty</emu-const>, then<ol><li>Set <var>result</var> to <emu-xref aoid="NormalCompletion" id="_ref_9570"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li></ol></li><li>Suspend <var>evalContext</var> and remove it from the <emu-xref href="#execution-context-stack" id="_ref_9571"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref>.</li><li>Resume the context that is now on the top of the <emu-xref href="#execution-context-stack" id="_ref_9572"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> as the <emu-xref href="#running-execution-context" id="_ref_9573"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Return ? <var>result</var>.</li></ol></emu-alg>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>The eval code cannot instantiate variable or function bindings in the variable environment of the calling context that invoked the eval if either the code of the calling context or the eval code is <emu-xref href="#sec-strict-mode-code" id="_ref_9574"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref>. Instead such bindings are instantiated in a new VariableEnvironment that is only accessible to the eval code. Bindings introduced by <code>let</code>, <code>const</code>, or <code>class</code> declarations are always instantiated in a new LexicalEnvironment.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-hostensurecancompilestrings" type="host-defined abstract operation" aoid="HostEnsureCanCompileStrings">
|
||
<h1><span class="secnum">19.2.1.2</span> HostEnsureCanCompileStrings ( <var>calleeRealm</var>, <var>parameterStrings</var>, <var>bodyString</var>, <var>direct</var> )</h1>
|
||
<p>The <emu-xref href="#host-defined" id="_ref_9575"><a href="overview.html#host-defined">host-defined</a></emu-xref> abstract operation HostEnsureCanCompileStrings takes arguments <var>calleeRealm</var> (a <emu-xref href="#realm-record" id="_ref_9576"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>), <var>parameterStrings</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9577"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings), <var>bodyString</var> (a String), and <var>direct</var> (a Boolean) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9578"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-const>unused</emu-const> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9579"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It allows <emu-xref href="#host-environment" id="_ref_9580"><a href="overview.html#host-environment">host environments</a></emu-xref> to block certain ECMAScript functions which allow developers to interpret and evaluate strings as ECMAScript code.</p>
|
||
<p>
|
||
<var>parameterStrings</var> represents the strings that, when using one of the function <emu-xref href="#constructor" id="_ref_9581"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref>, will be concatenated together to build the parameters list. <var>bodyString</var> represents the function body or the string passed to an <code>eval</code> call.
|
||
<var>direct</var> signifies whether the evaluation is a <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_9582"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref>.
|
||
</p>
|
||
<p>The default implementation of HostEnsureCanCompileStrings is to return <emu-xref aoid="NormalCompletion" id="_ref_9583"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-const>unused</emu-const>).</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-evaldeclarationinstantiation" type="abstract operation" oldids="sec-web-compat-evaldeclarationinstantiation" aoid="EvalDeclarationInstantiation"><span id="sec-web-compat-evaldeclarationinstantiation"></span>
|
||
<h1><span class="secnum">19.2.1.3</span> EvalDeclarationInstantiation ( <var>body</var>, <var>varEnv</var>, <var>lexEnv</var>, <var>privateEnv</var>, <var>strict</var> )</h1>
|
||
<p>The abstract operation EvalDeclarationInstantiation takes arguments <var>body</var> (a <emu-nt id="_ref_23795"><a href="ecmascript-language-scripts-and-modules.html#prod-ScriptBody">ScriptBody</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_9584"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>varEnv</var> (an <emu-xref href="#sec-environment-records" id="_ref_9585"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>), <var>lexEnv</var> (a <emu-xref href="#sec-declarative-environment-records" id="_ref_9586"><a href="executable-code-and-execution-contexts.html#sec-declarative-environment-records">Declarative Environment Record</a></emu-xref>), <var>privateEnv</var> (a <emu-xref href="#privateenvironment-record" id="_ref_9587"><a href="executable-code-and-execution-contexts.html#privateenvironment-record">PrivateEnvironment Record</a></emu-xref> or <emu-val>null</emu-val>), and <var>strict</var> (a Boolean) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9588"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-const>unused</emu-const> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9589"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>varNames</var> be the <emu-xref aoid="VarDeclaredNames" id="_ref_9593"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <var>body</var>.</li><li>Let <var>varDeclarations</var> be the <emu-xref aoid="VarScopedDeclarations" id="_ref_9594"><a href="syntax-directed-operations.html#sec-static-semantics-varscopeddeclarations">VarScopedDeclarations</a></emu-xref> of <var>body</var>.</li><li>If <var>strict</var> is <emu-val>false</emu-val>, then<ol><li>If <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9595"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>For each element <var>name</var> of <var>varNames</var>, do<ol><li>If <emu-xref aoid="HasLexicalDeclaration" id="_ref_9596"><a href="executable-code-and-execution-contexts.html#sec-haslexicaldeclaration">HasLexicalDeclaration</a></emu-xref>(<var>varEnv</var>, <var>name</var>) is <emu-val>true</emu-val>, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>NOTE: <code>eval</code> will not create a global var declaration that would be shadowed by a global lexical declaration.</li></ol></li></ol></li><li>Let <var>thisEnv</var> be <var>lexEnv</var>.</li><li><emu-xref href="#assert" id="_ref_9597"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The following loop will terminate.</li><li>Repeat, while <var>thisEnv</var> and <var>varEnv</var> are not the same <emu-xref href="#sec-environment-records" id="_ref_9598"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>,<ol><li>If <var>thisEnv</var> <emu-xref href="#sec-object-type" id="_ref_9599"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> <emu-xref href="#sec-environment-records" id="_ref_9600"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>, then<ol><li>NOTE: The environment of with statements cannot contain any lexical declaration so it doesn't need to be checked for var/let hoisting conflicts.</li><li>For each element <var>name</var> of <var>varNames</var>, do<ol><li>If ! <var>thisEnv</var>.<emu-xref aoid="HasBinding" id="_ref_9601"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>name</var>) is <emu-val>true</emu-val>, then<ol><li id="step-evaldeclarationinstantiation-throw-duplicate-binding" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_9590"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref></div>If the <emu-xref href="#host" id="_ref_9602"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-variablestatements-in-catch-blocks" title="" id="_ref_540"><a href="additional-ecmascript-features-for-web-browsers.html#sec-variablestatements-in-catch-blocks">VariableStatements in Catch Blocks</a></emu-xref>, then<ol><li>If <var>thisEnv</var> is not the <emu-xref href="#sec-environment-records" id="_ref_9603"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> for a <emu-nt id="_ref_23796"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> clause, throw a <emu-val>SyntaxError</emu-val> exception.</li></ol></li><li>Else,<ol><li>Throw a <emu-val>SyntaxError</emu-val> exception.</li></ol></li></ol></li><li>NOTE: A <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_9604"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref> will not hoist var declaration over a like-named lexical declaration.</li></ol></li></ol></li><li>Set <var>thisEnv</var> to <var>thisEnv</var>.<var class="field">[[OuterEnv]]</var>.</li></ol></li></ol></li><li>Let <var>privateIdentifiers</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9605"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Let <var>pointer</var> be <var>privateEnv</var>.</li><li>Repeat, while <var>pointer</var> is not <emu-val>null</emu-val>,<ol><li>For each <emu-xref href="#sec-private-names" id="_ref_9606"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref> <var>binding</var> of <var>pointer</var>.<var class="field">[[Names]]</var>, do<ol><li>If <var>privateIdentifiers</var> does not contain <var>binding</var>.<var class="field">[[Description]]</var>, append <var>binding</var>.<var class="field">[[Description]]</var> to <var>privateIdentifiers</var>.</li></ol></li><li>Set <var>pointer</var> to <var>pointer</var>.<var class="field">[[OuterPrivateEnvironment]]</var>.</li></ol></li><li>If <emu-xref aoid="AllPrivateIdentifiersValid" id="_ref_9607"><a href="ecmascript-language-functions-and-classes.html#sec-static-semantics-allprivateidentifiersvalid">AllPrivateIdentifiersValid</a></emu-xref> of <var>body</var> with argument <var>privateIdentifiers</var> is <emu-val>false</emu-val>, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>Let <var>functionsToInitialize</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9608"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Let <var>declaredFunctionNames</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9609"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>d</var> of <var>varDeclarations</var>, in reverse <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9610"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> order, do<ol><li>If <var>d</var> is not either a <emu-nt id="_ref_23797"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt>, a <emu-nt id="_ref_23798"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>, or a <emu-nt id="_ref_23799"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>, then<ol><li><emu-xref href="#assert" id="_ref_9611"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>d</var> is either a <emu-nt id="_ref_23800"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>, a <emu-nt id="_ref_23801"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorDeclaration">GeneratorDeclaration</a></emu-nt>, an <emu-nt id="_ref_23802"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionDeclaration">AsyncFunctionDeclaration</a></emu-nt>, or an <emu-nt id="_ref_23803"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorDeclaration">AsyncGeneratorDeclaration</a></emu-nt>.</li><li>NOTE: If there are multiple function declarations for the same name, the last declaration is used.</li><li>Let <var>fn</var> be the sole element of the <emu-xref aoid="BoundNames" id="_ref_9612"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>d</var>.</li><li>If <var>declaredFunctionNames</var> does not contain <var>fn</var>, then<ol><li>If <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9613"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>Let <var>fnDefinable</var> be ? <emu-xref aoid="CanDeclareGlobalFunction" id="_ref_9614"><a href="executable-code-and-execution-contexts.html#sec-candeclareglobalfunction" class="e-user-code">CanDeclareGlobalFunction</a></emu-xref>(<var>varEnv</var>, <var>fn</var>).</li><li>If <var>fnDefinable</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>Append <var>fn</var> to <var>declaredFunctionNames</var>.</li><li>Insert <var>d</var> as the first element of <var>functionsToInitialize</var>.</li></ol></li></ol></li></ol></li><li>Let <var>declaredVarNames</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9615"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>d</var> of <var>varDeclarations</var>, do<ol><li>If <var>d</var> is either a <emu-nt id="_ref_23804"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt>, a <emu-nt id="_ref_23805"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>, or a <emu-nt id="_ref_23806"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>, then<ol><li>For each String <var>vn</var> of the <emu-xref aoid="BoundNames" id="_ref_9616"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>d</var>, do<ol><li>If <var>declaredFunctionNames</var> does not contain <var>vn</var>, then<ol><li>If <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9617"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>Let <var>vnDefinable</var> be ? <emu-xref aoid="CanDeclareGlobalVar" id="_ref_9618"><a href="executable-code-and-execution-contexts.html#sec-candeclareglobalvar" class="e-user-code">CanDeclareGlobalVar</a></emu-xref>(<var>varEnv</var>, <var>vn</var>).</li><li>If <var>vnDefinable</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>If <var>declaredVarNames</var> does not contain <var>vn</var>, then<ol><li>Append <var>vn</var> to <var>declaredVarNames</var>.</li></ol></li></ol></li></ol></li></ol></li></ol></li><li id="step-evaldeclarationinstantiation-web-compat-insertion-point" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_9591"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref></div>If <var>strict</var> is <emu-val>false</emu-val> and the <emu-xref href="#host" id="_ref_9619"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title="" id="_ref_541"><a href="additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics">Block-Level Function Declarations Web Legacy Compatibility Semantics</a></emu-xref>, then<ol><li>Let <var>declaredFunctionOrVarNames</var> be the <emu-xref href="#list-concatenation" id="_ref_9620"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>declaredFunctionNames</var> and <var>declaredVarNames</var>.</li><li>For each <emu-nt id="_ref_23807"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt> <var>f</var> that is directly contained in the <emu-nt id="_ref_23808"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> of any <emu-nt id="_ref_23809"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>, <emu-nt id="_ref_23810"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt>, or <emu-nt id="_ref_23811"><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a></emu-nt> <var>x</var> such that <var>body</var> <emu-xref aoid="Contains" id="_ref_9621"><a href="syntax-directed-operations.html#sec-static-semantics-contains">Contains</a></emu-xref> <var>x</var> is <emu-val>true</emu-val>, do<ol><li>Let <var>F</var> be the <emu-xref aoid="StringValue" id="_ref_9622"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of the <emu-nt id="_ref_23812"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt> of <var>f</var>.</li><li>If replacing the <emu-nt id="_ref_23813"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt> <var>f</var> with a <emu-nt id="_ref_23814"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableStatement">VariableStatement</a></emu-nt> that has <var>F</var> as a <emu-nt id="_ref_23815"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt> would not produce any Early Errors for <var>body</var>, then<ol><li>Let <var>bindingExists</var> be <emu-val>false</emu-val>.</li><li>Set <var>thisEnv</var> to <var>lexEnv</var>.</li><li><emu-xref href="#assert" id="_ref_9623"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The following loop will terminate.</li><li>Repeat, while <var>thisEnv</var> is not <var>varEnv</var>,<ol><li>If <var>thisEnv</var> <emu-xref href="#sec-object-type" id="_ref_9624"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> <emu-xref href="#sec-environment-records" id="_ref_9625"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>, then<ol><li>If ! <var>thisEnv</var>.<emu-xref aoid="HasBinding" id="_ref_9626"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>F</var>) is <emu-val>true</emu-val>, then<ol><li id="step-evaldeclarationinstantiation-web-compat-bindingexists" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_9592"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref></div>If the <emu-xref href="#host" id="_ref_9627"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-variablestatements-in-catch-blocks" title="" id="_ref_542"><a href="additional-ecmascript-features-for-web-browsers.html#sec-variablestatements-in-catch-blocks">VariableStatements in Catch Blocks</a></emu-xref>, then<ol><li>If <var>thisEnv</var> is not the <emu-xref href="#sec-environment-records" id="_ref_9628"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> for a <emu-nt id="_ref_23816"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> clause, set <var>bindingExists</var> to <emu-val>true</emu-val>.</li></ol></li><li>Else,<ol><li>Set <var>bindingExists</var> to <emu-val>true</emu-val>.</li></ol></li></ol></li></ol></li><li>Set <var>thisEnv</var> to <var>thisEnv</var>.<var class="field">[[OuterEnv]]</var>.</li></ol></li><li>If <var>bindingExists</var> is <emu-val>false</emu-val> and <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9629"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>If <emu-xref aoid="HasLexicalDeclaration" id="_ref_9630"><a href="executable-code-and-execution-contexts.html#sec-haslexicaldeclaration">HasLexicalDeclaration</a></emu-xref>(<var>varEnv</var>, <var>F</var>) is <emu-val>false</emu-val>, then<ol><li>Let <var>fnDefinable</var> be ? <emu-xref aoid="CanDeclareGlobalVar" id="_ref_9631"><a href="executable-code-and-execution-contexts.html#sec-candeclareglobalvar" class="e-user-code">CanDeclareGlobalVar</a></emu-xref>(<var>varEnv</var>, <var>F</var>).</li></ol></li><li>Else,<ol><li>Let <var>fnDefinable</var> be <emu-val>false</emu-val>.</li></ol></li></ol></li><li>Else,<ol><li>Let <var>fnDefinable</var> be <emu-val>true</emu-val>.</li></ol></li><li>If <var>bindingExists</var> is <emu-val>false</emu-val> and <var>fnDefinable</var> is <emu-val>true</emu-val>, then<ol><li>If <var>declaredFunctionOrVarNames</var> does not contain <var>F</var>, then<ol><li>If <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9632"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>Perform ? <emu-xref aoid="CreateGlobalVarBinding" id="_ref_9633"><a href="executable-code-and-execution-contexts.html#sec-createglobalvarbinding" class="e-user-code">CreateGlobalVarBinding</a></emu-xref>(<var>varEnv</var>, <var>F</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li>Set <var>bindingExists</var> to ! <var>varEnv</var>.<emu-xref aoid="HasBinding" id="_ref_9634"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>F</var>).</li><li>If <var>bindingExists</var> is <emu-val>false</emu-val>, then<ol><li>Perform ! <var>varEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_9635"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>F</var>, <emu-val>true</emu-val>).</li><li>Perform ! <var>varEnv</var>.<emu-xref aoid="InitializeBinding" id="_ref_9636"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>F</var>, <emu-val>undefined</emu-val>).</li></ol></li></ol></li><li>Append <var>F</var> to <var>declaredFunctionOrVarNames</var>.</li></ol></li><li id="step-evaldeclarationinstantiation-alt-funcdecl-eval">When the <emu-nt id="_ref_23817"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt> <var>f</var> is evaluated, perform the following steps in place of the <emu-nt id="_ref_23818"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt> <emu-xref aoid="Evaluation" id="_ref_9637"><a href="syntax-directed-operations.html#sec-evaluation">Evaluation</a></emu-xref> algorithm provided in <emu-xref href="#sec-function-definitions-runtime-semantics-evaluation" id="_ref_543"><a href="ecmascript-language-functions-and-classes.html#sec-function-definitions-runtime-semantics-evaluation">15.2.6</a></emu-xref>:<ol><li>Let <var>gEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_9638"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s VariableEnvironment.</li><li>Let <var>bEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_9639"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>fObj</var> be ! <var>bEnv</var>.<emu-xref aoid="GetBindingValue" id="_ref_9640"><a href="executable-code-and-execution-contexts.html#abstract-getbindingvalue">GetBindingValue</a></emu-xref>(<var>F</var>, <emu-val>false</emu-val>).</li><li>Perform ? <span class="e-user-code"><var>gEnv</var>.<emu-xref aoid="SetMutableBinding" id="_ref_9641"><a href="executable-code-and-execution-contexts.html#abstract-setmutablebinding">SetMutableBinding</a></emu-xref>(<var>F</var>, <var>fObj</var>, <emu-val>false</emu-val>)</span>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></li></ol></li></ol></li></ol></li></ol></li><li id="step-evaldeclarationinstantiation-post-validation">NOTE: No abnormal terminations occur after this algorithm step unless <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9642"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref> and the <emu-xref href="#sec-global-object" id="_ref_9643"><a href="global-object.html#sec-global-object">global object</a></emu-xref> is a <emu-xref href="#proxy-exotic-object" id="_ref_9644"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref>.</li><li>Let <var>lexDeclarations</var> be the <emu-xref aoid="LexicallyScopedDeclarations" id="_ref_9645"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallyscopeddeclarations">LexicallyScopedDeclarations</a></emu-xref> of <var>body</var>.</li><li>For each element <var>d</var> of <var>lexDeclarations</var>, do<ol><li>NOTE: Lexically declared names are only instantiated here but not initialized.</li><li>For each element <var>dn</var> of the <emu-xref aoid="BoundNames" id="_ref_9646"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>d</var>, do<ol><li>If <emu-xref aoid="IsConstantDeclaration" id="_ref_9647"><a href="syntax-directed-operations.html#sec-static-semantics-isconstantdeclaration">IsConstantDeclaration</a></emu-xref> of <var>d</var> is <emu-val>true</emu-val>, then<ol><li>Perform ? <var>lexEnv</var>.<emu-xref aoid="CreateImmutableBinding" id="_ref_9648"><a href="executable-code-and-execution-contexts.html#abstract-createimmutablebinding">CreateImmutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li>Perform ? <var>lexEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_9649"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li></ol></li><li>For each <emu-xref href="#sec-syntactic-grammar" id="_ref_9650"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> <var>f</var> of <var>functionsToInitialize</var>, do<ol><li>Let <var>fn</var> be the sole element of the <emu-xref aoid="BoundNames" id="_ref_9651"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>f</var>.</li><li>Let <var>fo</var> be <emu-xref aoid="InstantiateFunctionObject" id="_ref_9652"><a href="syntax-directed-operations.html#sec-runtime-semantics-instantiatefunctionobject">InstantiateFunctionObject</a></emu-xref> of <var>f</var> with arguments <var>lexEnv</var> and <var>privateEnv</var>.</li><li>If <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9653"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>Perform ? <emu-xref aoid="CreateGlobalFunctionBinding" id="_ref_9654"><a href="executable-code-and-execution-contexts.html#sec-createglobalfunctionbinding" class="e-user-code">CreateGlobalFunctionBinding</a></emu-xref>(<var>varEnv</var>, <var>fn</var>, <var>fo</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li>Let <var>bindingExists</var> be ! <var>varEnv</var>.<emu-xref aoid="HasBinding" id="_ref_9655"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>fn</var>).</li><li>If <var>bindingExists</var> is <emu-val>false</emu-val>, then<ol><li>NOTE: The following invocation cannot return an <emu-xref href="#sec-completion-record-specification-type" id="_ref_9656"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> because of the validation preceding step <emu-xref href="#step-evaldeclarationinstantiation-post-validation" id="_ref_544"><a href="global-object.html#step-evaldeclarationinstantiation-post-validation">14</a></emu-xref>.</li><li>Perform ! <var>varEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_9657"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>fn</var>, <emu-val>true</emu-val>).</li><li>Perform ! <var>varEnv</var>.<emu-xref aoid="InitializeBinding" id="_ref_9658"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>fn</var>, <var>fo</var>).</li></ol></li><li>Else,<ol><li>Perform ! <var>varEnv</var>.<emu-xref aoid="SetMutableBinding" id="_ref_9659"><a href="executable-code-and-execution-contexts.html#abstract-setmutablebinding">SetMutableBinding</a></emu-xref>(<var>fn</var>, <var>fo</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li></ol></li><li>For each String <var>vn</var> of <var>declaredVarNames</var>, do<ol><li>If <var>varEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_9660"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>, then<ol><li>Perform ? <emu-xref aoid="CreateGlobalVarBinding" id="_ref_9661"><a href="executable-code-and-execution-contexts.html#sec-createglobalvarbinding" class="e-user-code">CreateGlobalVarBinding</a></emu-xref>(<var>varEnv</var>, <var>vn</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li>Let <var>bindingExists</var> be ! <var>varEnv</var>.<emu-xref aoid="HasBinding" id="_ref_9662"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>vn</var>).</li><li>If <var>bindingExists</var> is <emu-val>false</emu-val>, then<ol><li>NOTE: The following invocation cannot return an <emu-xref href="#sec-completion-record-specification-type" id="_ref_9663"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> because of the validation preceding step <emu-xref href="#step-evaldeclarationinstantiation-post-validation" id="_ref_545"><a href="global-object.html#step-evaldeclarationinstantiation-post-validation">14</a></emu-xref>.</li><li>Perform ! <var>varEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_9664"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>vn</var>, <emu-val>true</emu-val>).</li><li>Perform ! <var>varEnv</var>.<emu-xref aoid="InitializeBinding" id="_ref_9665"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>vn</var>, <emu-val>undefined</emu-val>).</li></ol></li></ol></li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-isfinite-number" type="built-in function">
|
||
<h1><span class="secnum">19.2.2</span> isFinite ( <var>number</var> )</h1>
|
||
<p>This function is the <dfn tabindex="-1">%isFinite%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>num</var> be ? <emu-xref aoid="ToNumber" id="_ref_9666"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>number</var>).</li><li>If <var>num</var> is <emu-xref href="#finite" id="_ref_9667"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-isnan-number" type="built-in function">
|
||
<h1><span class="secnum">19.2.3</span> isNaN ( <var>number</var> )</h1>
|
||
<p>This function is the <dfn tabindex="-1">%isNaN%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>num</var> be ? <emu-xref aoid="ToNumber" id="_ref_9668"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>number</var>).</li><li>If <var>num</var> is <emu-val>NaN</emu-val>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>A reliable way for ECMAScript code to test if a value <code>X</code> is <emu-val>NaN</emu-val> is an expression of the form <code>X !== X</code>. The result will be <emu-val>true</emu-val> if and only if <code>X</code> is <emu-val>NaN</emu-val>.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-parsefloat-string" type="built-in function">
|
||
<h1><span class="secnum">19.2.4</span> parseFloat ( <var>string</var> )</h1>
|
||
<p>This function produces a Number value dictated by interpretation of the contents of the <var>string</var> argument as a decimal literal.</p>
|
||
<p>It is the <dfn tabindex="-1">%parseFloat%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>inputString</var> be ? <emu-xref aoid="ToString" id="_ref_9669"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>string</var>).</li><li>Let <var>trimmedString</var> be ! <emu-xref aoid="TrimString" id="_ref_9670"><a href="text-processing.html#sec-trimstring">TrimString</a></emu-xref>(<var>inputString</var>, <emu-const>start</emu-const>).</li><li>Let <var>trimmed</var> be <emu-xref aoid="StringToCodePoints" id="_ref_9671"><a href="ecmascript-language-source-code.html#sec-stringtocodepoints">StringToCodePoints</a></emu-xref>(<var>trimmedString</var>).</li><li>Let <var>trimmedPrefix</var> be the longest prefix of <var>trimmed</var> that satisfies the syntax of a <emu-nt id="_ref_23819"><a href="abstract-operations.html#prod-StrDecimalLiteral">StrDecimalLiteral</a></emu-nt>, which might be <var>trimmed</var> itself. If there is no such prefix, return <emu-val>NaN</emu-val>.</li><li>Let <var>parsedNumber</var> be <emu-xref aoid="ParseText" id="_ref_9672"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>trimmedPrefix</var>, <emu-nt id="_ref_23820"><a href="abstract-operations.html#prod-StrDecimalLiteral">StrDecimalLiteral</a></emu-nt>).</li><li><emu-xref href="#assert" id="_ref_9673"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>parsedNumber</var> is a <emu-xref href="#sec-syntactic-grammar" id="_ref_9674"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>.</li><li>Return the <emu-xref aoid="StringNumericValue" id="_ref_9675"><a href="abstract-operations.html#sec-runtime-semantics-stringnumericvalue">StringNumericValue</a></emu-xref> of <var>parsedNumber</var>.</li></ol></emu-alg>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>This function may interpret only a leading portion of <var>string</var> as a Number value; it ignores any code units that cannot be interpreted as part of the notation of a decimal literal, and no indication is given that any such code units were ignored.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-parseint-string-radix" type="built-in function">
|
||
<h1><span class="secnum">19.2.5</span> parseInt ( <var>string</var>, <var>radix</var> )</h1>
|
||
<p>This function produces an <emu-xref href="#integral-number" id="_ref_9676"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> dictated by interpretation of the contents of <var>string</var> according to the specified <var>radix</var>. Leading white space in <var>string</var> is ignored. If <var>radix</var> coerces to 0 (such as when it is <emu-val>undefined</emu-val>), it is assumed to be 10 except when the number representation begins with <emu-val>"0x"</emu-val> or <emu-val>"0X"</emu-val>, in which case it is assumed to be 16. If <var>radix</var> is 16, the number representation may optionally begin with <emu-val>"0x"</emu-val> or <emu-val>"0X"</emu-val>.</p>
|
||
<p>It is the <dfn tabindex="-1">%parseInt%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>inputString</var> be ? <emu-xref aoid="ToString" id="_ref_9677"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>string</var>).</li><li>Let <var>S</var> be ! <emu-xref aoid="TrimString" id="_ref_9678"><a href="text-processing.html#sec-trimstring">TrimString</a></emu-xref>(<var>inputString</var>, <emu-const>start</emu-const>).</li><li>Let <var>sign</var> be 1.</li><li>If <var>S</var> is not empty and the first code unit of <var>S</var> is the code unit 0x002D (HYPHEN-MINUS), set <var>sign</var> to -1.</li><li>If <var>S</var> is not empty and the first code unit of <var>S</var> is either the code unit 0x002B (PLUS SIGN) or the code unit 0x002D (HYPHEN-MINUS), set <var>S</var> to the <emu-xref href="#substring" id="_ref_9679"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>S</var> from index 1.</li><li>Let <var>R</var> be <emu-xref aoid="ℝ" id="_ref_9680"><a href="notational-conventions.html#%E2%84%9D">ℝ</a></emu-xref>(? <emu-xref aoid="ToInt32" id="_ref_9681"><a href="abstract-operations.html#sec-toint32" class="e-user-code">ToInt32</a></emu-xref>(<var>radix</var>)).</li><li>Let <var>stripPrefix</var> be <emu-val>true</emu-val>.</li><li>If <var>R</var> ≠ 0, then<ol><li>If <var>R</var> < 2 or <var>R</var> > 36, return <emu-val>NaN</emu-val>.</li><li>If <var>R</var> ≠ 16, set <var>stripPrefix</var> to <emu-val>false</emu-val>.</li></ol></li><li>Else,<ol><li>Set <var>R</var> to 10.</li></ol></li><li>If <var>stripPrefix</var> is <emu-val>true</emu-val>, then<ol><li>If the length of <var>S</var> ≥ 2 and the first two code units of <var>S</var> are either <emu-val>"0x"</emu-val> or <emu-val>"0X"</emu-val>, then<ol><li>Set <var>S</var> to the <emu-xref href="#substring" id="_ref_9682"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>S</var> from index 2.</li><li>Set <var>R</var> to 16.</li></ol></li></ol></li><li>If <var>S</var> contains a code unit that is not a radix-<var>R</var> digit, let <var>end</var> be the index within <var>S</var> of the first such code unit; else let <var>end</var> be the length of <var>S</var>.</li><li>Let <var>Z</var> be the <emu-xref href="#substring" id="_ref_9683"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>S</var> from 0 to <var>end</var>.</li><li>If <var>Z</var> is empty, return <emu-val>NaN</emu-val>.</li><li>Let <var>mathInt</var> be the <emu-xref href="#integer" id="_ref_9684"><a href="notational-conventions.html#integer">integer</a></emu-xref> value that is represented by <var>Z</var> in radix-<var>R</var> notation, using the letters <b>A</b> through <b>Z</b> and <b>a</b> through <b>z</b> for digits with values 10 through 35. (However, if <var>R</var> = 10 and <var>Z</var> contains more than 20 significant digits, every significant digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if <var>R</var> is not one of 2, 4, 8, 10, 16, or 32, then <var>mathInt</var> may be an <emu-xref href="#implementation-approximated" id="_ref_9685"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> <emu-xref href="#integer" id="_ref_9686"><a href="notational-conventions.html#integer">integer</a></emu-xref> representing the <emu-xref href="#integer" id="_ref_9687"><a href="notational-conventions.html#integer">integer</a></emu-xref> value denoted by <var>Z</var> in radix-<var>R</var> notation.)</li><li>If <var>mathInt</var> = 0, then<ol><li>If <var>sign</var> = -1, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>Return <emu-val>+0</emu-val><sub>𝔽</sub>.</li></ol></li><li>Return <emu-xref aoid="𝔽" id="_ref_9688"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>sign</var> × <var>mathInt</var>).</li></ol></emu-alg>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>This function may interpret only a leading portion of <var>string</var> as an <emu-xref href="#integer" id="_ref_9689"><a href="notational-conventions.html#integer">integer</a></emu-xref> value; it ignores any code units that cannot be interpreted as part of the notation of an <emu-xref href="#integer" id="_ref_9690"><a href="notational-conventions.html#integer">integer</a></emu-xref>, and no indication is given that any such code units were ignored.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-uri-handling-functions" oldids="sec-uri-syntax-and-semantics"><span id="sec-uri-syntax-and-semantics"></span>
|
||
<h1><span class="secnum">19.2.6</span> URI Handling Functions</h1>
|
||
<p>Uniform Resource Identifiers, or URIs, are Strings that identify resources (e.g. web pages or files) and transport protocols by which to access them (e.g. HTTP or FTP) on the Internet. The ECMAScript language itself does not provide any support for using URIs except for functions that encode and decode URIs as described in this section. <code>encodeURI</code> and <code>decodeURI</code> are intended to work with complete URIs; they assume that any reserved characters are intended to have special meaning (e.g., as delimiters) and so are not encoded. <code>encodeURIComponent</code> and <code>decodeURIComponent</code> are intended to work with the individual components of a URI; they assume that any reserved characters represent text and must be encoded to avoid special meaning when the component is part of a complete URI.</p>
|
||
<emu-note><span class="note">Note 1</span><div class="note-contents">
|
||
<p>The set of reserved characters is based upon RFC 2396 and does not reflect changes introduced by the more recent RFC 3986.</p>
|
||
</div></emu-note>
|
||
<emu-note><span class="note">Note 2</span><div class="note-contents">
|
||
<p>Many implementations of ECMAScript provide additional functions and methods that manipulate web pages; these functions are beyond the scope of this standard.</p>
|
||
</div></emu-note>
|
||
|
||
<emu-clause id="sec-decodeuri-encodeduri" type="built-in function">
|
||
<h1><span class="secnum">19.2.6.1</span> decodeURI ( <var>encodedURI</var> )</h1>
|
||
<p>This function computes a new version of a URI in which each escape sequence and UTF-8 encoding of the sort that might be introduced by the <code>encodeURI</code> function is replaced with the UTF-16 encoding of the code point that it represents. Escape sequences that could not have been introduced by <code>encodeURI</code> are not replaced.</p>
|
||
<p>It is the <dfn tabindex="-1">%decodeURI%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>uriString</var> be ? <emu-xref aoid="ToString" id="_ref_9691"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>encodedURI</var>).</li><li>Let <var>preserveEscapeSet</var> be <emu-val>";/?:@&=+$,#"</emu-val>.</li><li>Return ? <emu-xref aoid="Decode" id="_ref_9692"><a href="global-object.html#sec-decode">Decode</a></emu-xref>(<var>uriString</var>, <var>preserveEscapeSet</var>).</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-decodeuricomponent-encodeduricomponent" type="built-in function">
|
||
<h1><span class="secnum">19.2.6.2</span> decodeURIComponent ( <var>encodedURIComponent</var> )</h1>
|
||
<p>This function computes a new version of a URI in which each escape sequence and UTF-8 encoding of the sort that might be introduced by the <code>encodeURIComponent</code> function is replaced with the UTF-16 encoding of the code point that it represents.</p>
|
||
<p>It is the <dfn tabindex="-1">%decodeURIComponent%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>componentString</var> be ? <emu-xref aoid="ToString" id="_ref_9693"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>encodedURIComponent</var>).</li><li>Let <var>preserveEscapeSet</var> be the empty String.</li><li>Return ? <emu-xref aoid="Decode" id="_ref_9694"><a href="global-object.html#sec-decode">Decode</a></emu-xref>(<var>componentString</var>, <var>preserveEscapeSet</var>).</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-encodeuri-uri" type="built-in function">
|
||
<h1><span class="secnum">19.2.6.3</span> encodeURI ( <var>uri</var> )</h1>
|
||
<p>This function computes a new version of a UTF-16 encoded (<emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_546"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">6.1.4</a></emu-xref>) URI in which each instance of certain code points is replaced by one, two, three, or four escape sequences representing the UTF-8 encoding of the code point.</p>
|
||
<p>It is the <dfn tabindex="-1">%encodeURI%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>uriString</var> be ? <emu-xref aoid="ToString" id="_ref_9695"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>uri</var>).</li><li>Let <var>extraUnescaped</var> be <emu-val>";/?:@&=+$,#"</emu-val>.</li><li>Return ? <emu-xref aoid="Encode" id="_ref_9696"><a href="global-object.html#sec-encode">Encode</a></emu-xref>(<var>uriString</var>, <var>extraUnescaped</var>).</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-encodeuricomponent-uricomponent" type="built-in function">
|
||
<h1><span class="secnum">19.2.6.4</span> encodeURIComponent ( <var>uriComponent</var> )</h1>
|
||
<p>This function computes a new version of a UTF-16 encoded (<emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_547"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">6.1.4</a></emu-xref>) URI in which each instance of certain code points is replaced by one, two, three, or four escape sequences representing the UTF-8 encoding of the code point.</p>
|
||
<p>It is the <dfn tabindex="-1">%encodeURIComponent%</dfn> intrinsic object.</p>
|
||
<p>It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>componentString</var> be ? <emu-xref aoid="ToString" id="_ref_9697"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>uriComponent</var>).</li><li>Let <var>extraUnescaped</var> be the empty String.</li><li>Return ? <emu-xref aoid="Encode" id="_ref_9698"><a href="global-object.html#sec-encode">Encode</a></emu-xref>(<var>componentString</var>, <var>extraUnescaped</var>).</li></ol></emu-alg>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-encode" type="abstract operation" aoid="Encode">
|
||
<h1><span class="secnum">19.2.6.5</span> Encode ( <var>string</var>, <var>extraUnescaped</var> )</h1>
|
||
<p>The abstract operation Encode takes arguments <var>string</var> (a String) and <var>extraUnescaped</var> (a String) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9699"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a String or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9700"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs URI encoding and escaping, interpreting <var>string</var> as a sequence of UTF-16 encoded code points as described in <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_548"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">6.1.4</a></emu-xref>. If a character is identified as unreserved in RFC 2396 or appears in <var>extraUnescaped</var>, it is not escaped. It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>len</var> be the length of <var>string</var>.</li><li>Let <var>R</var> be the empty String.</li><li>Let <var>alwaysUnescaped</var> be the <emu-xref href="#string-concatenation" id="_ref_9701"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-xref href="#ASCII-word-characters" id="_ref_9702"><a href="ecmascript-data-types-and-values.html#ASCII-word-characters">the ASCII word characters</a></emu-xref> and <emu-val>"-.!~*'()"</emu-val>.</li><li>Let <var>unescapedSet</var> be the <emu-xref href="#string-concatenation" id="_ref_9703"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>alwaysUnescaped</var> and <var>extraUnescaped</var>.</li><li>Let <var>k</var> be 0.</li><li>Repeat, while <var>k</var> < <var>len</var>,<ol><li>Let <var>C</var> be the code unit at index <var>k</var> within <var>string</var>.</li><li>If <var>unescapedSet</var> contains <var>C</var>, then<ol><li>Set <var>k</var> to <var>k</var> + 1.</li><li>Set <var>R</var> to the <emu-xref href="#string-concatenation" id="_ref_9704"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>R</var> and <var>C</var>.</li></ol></li><li>Else,<ol><li>Let <var>cp</var> be <emu-xref aoid="CodePointAt" id="_ref_9705"><a href="ecmascript-language-source-code.html#sec-codepointat">CodePointAt</a></emu-xref>(<var>string</var>, <var>k</var>).</li><li>If <var>cp</var>.<var class="field">[[IsUnpairedSurrogate]]</var> is <emu-val>true</emu-val>, throw a <emu-val>URIError</emu-val> exception.</li><li>Set <var>k</var> to <var>k</var> + <var>cp</var>.<var class="field">[[CodeUnitCount]]</var>.</li><li>Let <var>Octets</var> be the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9706"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of octets resulting by applying the UTF-8 transformation to <var>cp</var>.<var class="field">[[CodePoint]]</var>.</li><li>For each element <var>octet</var> of <var>Octets</var>, do<ol><li>Let <var>hex</var> be the String representation of <var>octet</var>, formatted as an uppercase hexadecimal number.</li><li>Set <var>R</var> to the <emu-xref href="#string-concatenation" id="_ref_9707"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>R</var>, <emu-val>"%"</emu-val>, and <emu-xref aoid="StringPad" id="_ref_9708"><a href="text-processing.html#sec-stringpad">StringPad</a></emu-xref>(<var>hex</var>, 2, <emu-val>"0"</emu-val>, <emu-const>start</emu-const>).</li></ol></li></ol></li></ol></li><li>Return <var>R</var>.</li></ol></emu-alg>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>Because percent-encoding is used to represent individual octets, a single code point may be expressed as multiple consecutive escape sequences (one for each of its 8-bit UTF-8 code units).</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-decode" type="abstract operation" aoid="Decode">
|
||
<h1><span class="secnum">19.2.6.6</span> Decode ( <var>string</var>, <var>preserveEscapeSet</var> )</h1>
|
||
<p>The abstract operation Decode takes arguments <var>string</var> (a String) and <var>preserveEscapeSet</var> (a String) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9709"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a String or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9710"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs URI unescaping and decoding, preserving any escape sequences that correspond to Basic Latin characters in <var>preserveEscapeSet</var>. It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>len</var> be the length of <var>string</var>.</li><li>Let <var>R</var> be the empty String.</li><li>Let <var>k</var> be 0.</li><li>Repeat, while <var>k</var> < <var>len</var>,<ol><li>Let <var>C</var> be the code unit at index <var>k</var> within <var>string</var>.</li><li>Let <var>S</var> be <var>C</var>.</li><li>If <var>C</var> is the code unit 0x0025 (PERCENT SIGN), then<ol><li>If <var>k</var> + 3 > <var>len</var>, throw a <emu-val>URIError</emu-val> exception.</li><li>Let <var>escape</var> be the <emu-xref href="#substring" id="_ref_9711"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>string</var> from <var>k</var> to <var>k</var> + 3.</li><li>Let <var>B</var> be <emu-xref aoid="ParseHexOctet" id="_ref_9712"><a href="global-object.html#sec-parsehexoctet">ParseHexOctet</a></emu-xref>(<var>string</var>, <var>k</var> + 1).</li><li>If <var>B</var> is not an <emu-xref href="#integer" id="_ref_9713"><a href="notational-conventions.html#integer">integer</a></emu-xref>, throw a <emu-val>URIError</emu-val> exception.</li><li>Set <var>k</var> to <var>k</var> + 2.</li><li>Let <var>n</var> be the number of leading 1 bits in <var>B</var>.</li><li>If <var>n</var> = 0, then<ol><li>Let <var>asciiChar</var> be the code unit whose numeric value is <var>B</var>.</li><li>If <var>preserveEscapeSet</var> contains <var>asciiChar</var>, set <var>S</var> to <var>escape</var>; else set <var>S</var> to <var>asciiChar</var>.</li></ol></li><li>Else,<ol><li>If <var>n</var> = 1 or <var>n</var> > 4, throw a <emu-val>URIError</emu-val> exception.</li><li>Let <var>Octets</var> be « <var>B</var> ».</li><li>Let <var>j</var> be 1.</li><li>Repeat, while <var>j</var> < <var>n</var>,<ol><li>Set <var>k</var> to <var>k</var> + 1.</li><li>If <var>k</var> + 3 > <var>len</var>, throw a <emu-val>URIError</emu-val> exception.</li><li>If the code unit at index <var>k</var> within <var>string</var> is not the code unit 0x0025 (PERCENT SIGN), throw a <emu-val>URIError</emu-val> exception.</li><li>Let <var>continuationByte</var> be <emu-xref aoid="ParseHexOctet" id="_ref_9714"><a href="global-object.html#sec-parsehexoctet">ParseHexOctet</a></emu-xref>(<var>string</var>, <var>k</var> + 1).</li><li>If <var>continuationByte</var> is not an <emu-xref href="#integer" id="_ref_9715"><a href="notational-conventions.html#integer">integer</a></emu-xref>, throw a <emu-val>URIError</emu-val> exception.</li><li>Append <var>continuationByte</var> to <var>Octets</var>.</li><li>Set <var>k</var> to <var>k</var> + 2.</li><li>Set <var>j</var> to <var>j</var> + 1.</li></ol></li><li><emu-xref href="#assert" id="_ref_9716"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The length of <var>Octets</var> is <var>n</var>.</li><li>If <var>Octets</var> does not contain a valid UTF-8 encoding of a Unicode code point, throw a <emu-val>URIError</emu-val> exception.</li><li>Let <var>V</var> be the code point obtained by applying the UTF-8 transformation to <var>Octets</var>, that is, from a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9717"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of octets into a 21-bit value.</li><li>Set <var>S</var> to <emu-xref aoid="UTF16EncodeCodePoint" id="_ref_9718"><a href="ecmascript-language-source-code.html#sec-utf16encodecodepoint">UTF16EncodeCodePoint</a></emu-xref>(<var>V</var>).</li></ol></li></ol></li><li>Set <var>R</var> to the <emu-xref href="#string-concatenation" id="_ref_9719"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>R</var> and <var>S</var>.</li><li>Set <var>k</var> to <var>k</var> + 1.</li></ol></li><li>Return <var>R</var>.</li></ol></emu-alg>
|
||
<emu-note><span class="note">Note</span><div class="note-contents">
|
||
<p>RFC 3629 prohibits the decoding of invalid UTF-8 octet sequences. For example, the invalid sequence 0xC0 0x80 must not decode into the code unit 0x0000. Implementations of the Decode algorithm are required to throw a <emu-val>URIError</emu-val> when encountering such invalid sequences.</p>
|
||
</div></emu-note>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-parsehexoctet" type="abstract operation" aoid="ParseHexOctet">
|
||
<h1><span class="secnum">19.2.6.7</span> ParseHexOctet ( <var>string</var>, <var>position</var> )</h1>
|
||
<p>The abstract operation ParseHexOctet takes arguments <var>string</var> (a String) and <var>position</var> (a non-negative <emu-xref href="#integer" id="_ref_9720"><a href="notational-conventions.html#integer">integer</a></emu-xref>) and returns either a non-negative <emu-xref href="#integer" id="_ref_9721"><a href="notational-conventions.html#integer">integer</a></emu-xref> or a non-empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9722"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-val>SyntaxError</emu-val> objects. It parses a sequence of two hexadecimal characters at the specified <var>position</var> in <var>string</var> into an unsigned 8-bit <emu-xref href="#integer" id="_ref_9723"><a href="notational-conventions.html#integer">integer</a></emu-xref>. It performs the following steps when called:</p>
|
||
<emu-alg><ol><li>Let <var>len</var> be the length of <var>string</var>.</li><li><emu-xref href="#assert" id="_ref_9724"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>position</var> + 2 ≤ <var>len</var>.</li><li>Let <var>hexDigits</var> be the <emu-xref href="#substring" id="_ref_9725"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>string</var> from <var>position</var> to <var>position</var> + 2.</li><li>Let <var>parseResult</var> be <emu-xref aoid="ParseText" id="_ref_9726"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>hexDigits</var>, <emu-nt params="~Sep" id="_ref_23821"><a href="ecmascript-language-lexical-grammar.html#prod-HexDigits">HexDigits</a><emu-mods><emu-params>[~Sep]</emu-params></emu-mods></emu-nt>).</li><li>If <var>parseResult</var> is not a <emu-xref href="#sec-syntactic-grammar" id="_ref_9727"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>, return <var>parseResult</var>.</li><li>Let <var>n</var> be the MV of <var>parseResult</var>.</li><li><emu-xref href="#assert" id="_ref_9728"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>n</var> is in the <emu-xref href="#inclusive-interval" id="_ref_9729"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 255.</li><li>Return <var>n</var>.</li></ol></emu-alg>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object">
|
||
<h1><span class="secnum">19.3</span> Constructor Properties of the Global Object</h1>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-aggregate-error">
|
||
<h1><span class="secnum">19.3.1</span> AggregateError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-aggregate-error-constructor" id="_ref_549"><a href="fundamental-objects.html#sec-aggregate-error-constructor">20.5.7.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-array">
|
||
<h1><span class="secnum">19.3.2</span> Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-array-constructor" id="_ref_550"><a href="indexed-collections.html#sec-array-constructor">23.1.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-arraybuffer">
|
||
<h1><span class="secnum">19.3.3</span> ArrayBuffer ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-arraybuffer-constructor" id="_ref_551"><a href="structured-data.html#sec-arraybuffer-constructor">25.1.4</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-bigint">
|
||
<h1><span class="secnum">19.3.4</span> BigInt ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-bigint-constructor" id="_ref_552"><a href="numbers-and-dates.html#sec-bigint-constructor">21.2.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-bigint64array">
|
||
<h1><span class="secnum">19.3.5</span> BigInt64Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_553"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-biguint64array">
|
||
<h1><span class="secnum">19.3.6</span> BigUint64Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_554"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-boolean">
|
||
<h1><span class="secnum">19.3.7</span> Boolean ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-boolean-constructor" id="_ref_555"><a href="fundamental-objects.html#sec-boolean-constructor">20.3.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-dataview">
|
||
<h1><span class="secnum">19.3.8</span> DataView ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-dataview-constructor" id="_ref_556"><a href="structured-data.html#sec-dataview-constructor">25.3.2</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-date">
|
||
<h1><span class="secnum">19.3.9</span> Date ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-date-constructor" id="_ref_557"><a href="numbers-and-dates.html#sec-date-constructor">21.4.2</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-error">
|
||
<h1><span class="secnum">19.3.10</span> Error ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-error-constructor" id="_ref_558"><a href="fundamental-objects.html#sec-error-constructor">20.5.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-evalerror">
|
||
<h1><span class="secnum">19.3.11</span> EvalError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-native-error-types-used-in-this-standard-evalerror" id="_ref_559"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard-evalerror">20.5.5.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-finalization-registry" oldids="sec-constructor-properties-of-the-global-object-finnalization-registry"><span id="sec-constructor-properties-of-the-global-object-finnalization-registry"></span>
|
||
<h1><span class="secnum">19.3.12</span> FinalizationRegistry ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-finalization-registry-constructor" id="_ref_560"><a href="managing-memory.html#sec-finalization-registry-constructor">26.2.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-float16array">
|
||
<h1><span class="secnum">19.3.13</span> Float16Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_561"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-float32array">
|
||
<h1><span class="secnum">19.3.14</span> Float32Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_562"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-float64array">
|
||
<h1><span class="secnum">19.3.15</span> Float64Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_563"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-function">
|
||
<h1><span class="secnum">19.3.16</span> Function ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-function-constructor" id="_ref_564"><a href="fundamental-objects.html#sec-function-constructor">20.2.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-int8array">
|
||
<h1><span class="secnum">19.3.17</span> Int8Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_565"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-int16array">
|
||
<h1><span class="secnum">19.3.18</span> Int16Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_566"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-int32array">
|
||
<h1><span class="secnum">19.3.19</span> Int32Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_567"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-iterator">
|
||
<h1><span class="secnum">19.3.20</span> Iterator ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-iterator-constructor" id="_ref_568"><a href="control-abstraction-objects.html#sec-iterator-constructor">27.1.3.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-map">
|
||
<h1><span class="secnum">19.3.21</span> Map ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-map-constructor" id="_ref_569"><a href="keyed-collections.html#sec-map-constructor">24.1.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-number">
|
||
<h1><span class="secnum">19.3.22</span> Number ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-number-constructor" id="_ref_570"><a href="numbers-and-dates.html#sec-number-constructor">21.1.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-object">
|
||
<h1><span class="secnum">19.3.23</span> Object ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-object-constructor" id="_ref_571"><a href="fundamental-objects.html#sec-object-constructor">20.1.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-promise">
|
||
<h1><span class="secnum">19.3.24</span> Promise ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-promise-constructor" id="_ref_572"><a href="control-abstraction-objects.html#sec-promise-constructor">27.2.3</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-proxy">
|
||
<h1><span class="secnum">19.3.25</span> Proxy ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-proxy-constructor" id="_ref_573"><a href="reflection.html#sec-proxy-constructor">28.2.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-rangeerror">
|
||
<h1><span class="secnum">19.3.26</span> RangeError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-native-error-types-used-in-this-standard-rangeerror" id="_ref_574"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard-rangeerror">20.5.5.2</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-referenceerror">
|
||
<h1><span class="secnum">19.3.27</span> ReferenceError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-native-error-types-used-in-this-standard-referenceerror" id="_ref_575"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard-referenceerror">20.5.5.3</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-regexp">
|
||
<h1><span class="secnum">19.3.28</span> RegExp ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-regexp-constructor" id="_ref_576"><a href="text-processing.html#sec-regexp-constructor">22.2.4</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-set">
|
||
<h1><span class="secnum">19.3.29</span> Set ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-set-constructor" id="_ref_577"><a href="keyed-collections.html#sec-set-constructor">24.2.2</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-sharedarraybuffer">
|
||
<h1><span class="secnum">19.3.30</span> SharedArrayBuffer ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-sharedarraybuffer-constructor" id="_ref_578"><a href="structured-data.html#sec-sharedarraybuffer-constructor">25.2.3</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-string">
|
||
<h1><span class="secnum">19.3.31</span> String ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-string-constructor" id="_ref_579"><a href="text-processing.html#sec-string-constructor">22.1.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-symbol">
|
||
<h1><span class="secnum">19.3.32</span> Symbol ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-symbol-constructor" id="_ref_580"><a href="fundamental-objects.html#sec-symbol-constructor">20.4.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-syntaxerror">
|
||
<h1><span class="secnum">19.3.33</span> SyntaxError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-native-error-types-used-in-this-standard-syntaxerror" id="_ref_581"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard-syntaxerror">20.5.5.4</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-typeerror">
|
||
<h1><span class="secnum">19.3.34</span> TypeError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-native-error-types-used-in-this-standard-typeerror" id="_ref_582"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard-typeerror">20.5.5.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-uint8array">
|
||
<h1><span class="secnum">19.3.35</span> Uint8Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_583"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-uint8clampedarray">
|
||
<h1><span class="secnum">19.3.36</span> Uint8ClampedArray ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_584"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-uint16array">
|
||
<h1><span class="secnum">19.3.37</span> Uint16Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_585"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-uint32array">
|
||
<h1><span class="secnum">19.3.38</span> Uint32Array ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-typedarray-constructors" id="_ref_586"><a href="indexed-collections.html#sec-typedarray-constructors">23.2.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-urierror">
|
||
<h1><span class="secnum">19.3.39</span> URIError ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-native-error-types-used-in-this-standard-urierror" id="_ref_587"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard-urierror">20.5.5.6</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-weakmap">
|
||
<h1><span class="secnum">19.3.40</span> WeakMap ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-weakmap-constructor" id="_ref_588"><a href="keyed-collections.html#sec-weakmap-constructor">24.3.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-weakref">
|
||
<h1><span class="secnum">19.3.41</span> WeakRef ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-weak-ref-constructor" id="_ref_589"><a href="managing-memory.html#sec-weak-ref-constructor">26.1.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-constructor-properties-of-the-global-object-weakset">
|
||
<h1><span class="secnum">19.3.42</span> WeakSet ( . . . )</h1>
|
||
<p>See <emu-xref href="#sec-weakset-objects" id="_ref_590"><a href="keyed-collections.html#sec-weakset-objects">24.4</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-other-properties-of-the-global-object">
|
||
<h1><span class="secnum">19.4</span> Other Properties of the Global Object</h1>
|
||
|
||
<emu-clause id="sec-atomics">
|
||
<h1><span class="secnum">19.4.1</span> Atomics</h1>
|
||
<p>See <emu-xref href="#sec-atomics-object" id="_ref_591"><a href="structured-data.html#sec-atomics-object">25.4</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-json">
|
||
<h1><span class="secnum">19.4.2</span> JSON</h1>
|
||
<p>See <emu-xref href="#sec-json-object" id="_ref_592"><a href="structured-data.html#sec-json-object">25.5</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-math">
|
||
<h1><span class="secnum">19.4.3</span> Math</h1>
|
||
<p>See <emu-xref href="#sec-math-object" id="_ref_593"><a href="numbers-and-dates.html#sec-math-object">21.3</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
|
||
<emu-clause id="sec-reflect">
|
||
<h1><span class="secnum">19.4.4</span> Reflect</h1>
|
||
<p>See <emu-xref href="#sec-reflect-object" id="_ref_594"><a href="reflection.html#sec-reflect-object">28.1</a></emu-xref>.</p>
|
||
</emu-clause>
|
||
</emu-clause>
|
||
</emu-clause></div></body></html> |