Files
ask262/spec-built/multipage/ordinary-and-exotic-objects-behaviours.html

1534 lines
450 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en-GB-oxendict"><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><meta property="og:image" content="https://tc39.es/ecmarkup/ecma-logo.png"><meta property="og:title" content="ECMAScript® 2026 Language&nbsp;Specification"><meta property="og:description" content="Introduction
This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invent">
<link rel="icon" href="../img/favicon.ico">
<link rel="stylesheet" href="../assets/css/ecmarkup.css"><link rel="stylesheet" href="../assets/css/print.css" media="print">
<title>ECMAScript® 2026 Language&nbsp;Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script><link rel="canonical" href="../#sec-ordinary-and-exotic-objects-behaviours"></head>
<body><div id="spec-container"><emu-clause id="sec-ordinary-and-exotic-objects-behaviours">
<h1><span class="secnum">10</span> Ordinary and Exotic Objects Behaviours</h1>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots">
<h1><span class="secnum">10.1</span> Ordinary Object Internal Methods and Internal Slots</h1>
<p>All <emu-xref href="#ordinary-object" id="_ref_4439"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> have an internal slot called <var class="field">[[Prototype]]</var>. The value of this internal slot is either <emu-val>null</emu-val> or an object and is used for implementing inheritance. Assume a property named <var>P</var> is missing from an <emu-xref href="#ordinary-object" id="_ref_4440"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> but exists on its <var class="field">[[Prototype]]</var> object. If <var>P</var> refers to a <emu-xref href="#sec-object-type" id="_ref_4441"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> on the <var class="field">[[Prototype]]</var> object, <var>O</var> inherits it for get access, making it behave as if <var>P</var> was a property of <var>O</var>. If <var>P</var> refers to a writable <emu-xref href="#sec-object-type" id="_ref_4442"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> on the <var class="field">[[Prototype]]</var> object, set access of <var>P</var> on <var>O</var> creates a new <emu-xref href="#sec-object-type" id="_ref_4443"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> named <var>P</var> on <var>O</var>. If <var>P</var> refers to a non-writable <emu-xref href="#sec-object-type" id="_ref_4444"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> on the <var class="field">[[Prototype]]</var> object, set access of <var>P</var> on <var>O</var> fails. If <var>P</var> refers to an <emu-xref href="#sec-object-type" id="_ref_4445"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> on the <var class="field">[[Prototype]]</var> object, the accessor is inherited by <var>O</var> for both get access and set access.</p>
<p>Every <emu-xref href="#ordinary-object" id="_ref_4446"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> has a Boolean-valued <var class="field">[[Extensible]]</var> internal slot which is used to fulfill the extensibility-related internal method invariants specified in <emu-xref href="#sec-invariants-of-the-essential-internal-methods" id="_ref_270"><a href="ecmascript-data-types-and-values.html#sec-invariants-of-the-essential-internal-methods">6.1.7.3</a></emu-xref>. Namely, once the value of an object's <var class="field">[[Extensible]]</var> internal slot has been set to <emu-val>false</emu-val>, it is no longer possible to add properties to the object, to modify the value of the object's <var class="field">[[Prototype]]</var> internal slot, or to subsequently change the value of <var class="field">[[Extensible]]</var> to <emu-val>true</emu-val>.</p>
<p>In the following algorithm descriptions, assume <var>O</var> is an <emu-xref href="#ordinary-object" id="_ref_4447"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>, <var>P</var> is a <emu-xref href="#property-key" id="_ref_4448"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> value, <var>V</var> is any <emu-xref href="#sec-ecmascript-language-types" id="_ref_4449"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>, and <var>Desc</var> is a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4450"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> record.</p>
<p>Each <emu-xref href="#ordinary-object" id="_ref_4451"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> internal method delegates to a similarly-named abstract operation. If such an abstract operation depends on another internal method, then the internal method is invoked on <var>O</var> rather than calling the similarly-named abstract operation directly. These semantics ensure that <emu-xref href="#exotic-object" id="_ref_4452"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref> have their overridden internal methods invoked when <emu-xref href="#ordinary-object" id="_ref_4453"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> internal methods are applied to them.</p>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof" type="internal method">
<h1><span class="secnum">10.1.1</span> <var class="field">[[GetPrototypeOf]]</var> ( )</h1>
<p>The <var class="field">[[GetPrototypeOf]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4454"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4455"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either an Object or <emu-val>null</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="OrdinaryGetPrototypeOf" id="_ref_4456"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetprototypeof">OrdinaryGetPrototypeOf</a></emu-xref>(<var>O</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinarygetprototypeof" type="abstract operation" aoid="OrdinaryGetPrototypeOf">
<h1><span class="secnum">10.1.1.1</span> OrdinaryGetPrototypeOf ( <var>O</var> )</h1>
<p>The abstract operation OrdinaryGetPrototypeOf takes argument <var>O</var> (an Object) and returns an Object or <emu-val>null</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <var>O</var>.<var class="field">[[Prototype]]</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-setprototypeof-v" type="internal method">
<h1><span class="secnum">10.1.2</span> <var class="field">[[SetPrototypeOf]]</var> ( <var>V</var> )</h1>
<p>The <var class="field">[[SetPrototypeOf]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4457"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes argument <var>V</var> (an Object or <emu-val>null</emu-val>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4458"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="OrdinarySetPrototypeOf" id="_ref_4459"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarysetprototypeof">OrdinarySetPrototypeOf</a></emu-xref>(<var>O</var>, <var>V</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinarysetprototypeof" type="abstract operation" aoid="OrdinarySetPrototypeOf">
<h1><span class="secnum">10.1.2.1</span> OrdinarySetPrototypeOf ( <var>O</var>, <var>V</var> )</h1>
<p>The abstract operation OrdinarySetPrototypeOf takes arguments <var>O</var> (an Object) and <var>V</var> (an Object or <emu-val>null</emu-val>) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>current</var> be <var>O</var>.<var class="field">[[Prototype]]</var>.</li><li>If <emu-xref aoid="SameValue" id="_ref_4460"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>V</var>, <var>current</var>) is <emu-val>true</emu-val>, return <emu-val>true</emu-val>.</li><li>Let <var>extensible</var> be <var>O</var>.<var class="field">[[Extensible]]</var>.</li><li>If <var>extensible</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>p</var> be <var>V</var>.</li><li>Let <var>done</var> be <emu-val>false</emu-val>.</li><li id="step-ordinarysetprototypeof-loop">Repeat, while <var>done</var> is <emu-val>false</emu-val>,<ol><li>If <var>p</var> is <emu-val>null</emu-val>, then<ol><li>Set <var>done</var> to <emu-val>true</emu-val>.</li></ol></li><li>Else if <emu-xref aoid="SameValue" id="_ref_4461"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>p</var>, <var>O</var>) is <emu-val>true</emu-val>, then<ol><li>Return <emu-val>false</emu-val>.</li></ol></li><li>Else,<ol><li>If <var>p</var>.<var class="field">[[GetPrototypeOf]]</var> is not the <emu-xref href="#ordinary-object" id="_ref_4462"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> internal method defined in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof" id="_ref_271"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof">10.1.1</a></emu-xref>, set <var>done</var> to <emu-val>true</emu-val>.</li><li>Else, set <var>p</var> to <var>p</var>.<var class="field">[[Prototype]]</var>.</li></ol></li></ol></li><li>Set <var>O</var>.<var class="field">[[Prototype]]</var> to <var>V</var>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The loop in step <emu-xref href="#step-ordinarysetprototypeof-loop" id="_ref_272"><a href="ordinary-and-exotic-objects-behaviours.html#step-ordinarysetprototypeof-loop">7</a></emu-xref> guarantees that there will be no cycles in any prototype chain that only includes objects that use the <emu-xref href="#ordinary-object" id="_ref_4463"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> definitions for <var class="field">[[GetPrototypeOf]]</var> and <var class="field">[[SetPrototypeOf]]</var>.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-isextensible" type="internal method">
<h1><span class="secnum">10.1.3</span> <var class="field">[[IsExtensible]]</var> ( )</h1>
<p>The <var class="field">[[IsExtensible]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4464"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4465"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="OrdinaryIsExtensible" id="_ref_4466"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryisextensible">OrdinaryIsExtensible</a></emu-xref>(<var>O</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinaryisextensible" type="abstract operation" aoid="OrdinaryIsExtensible">
<h1><span class="secnum">10.1.3.1</span> OrdinaryIsExtensible ( <var>O</var> )</h1>
<p>The abstract operation OrdinaryIsExtensible takes argument <var>O</var> (an Object) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <var>O</var>.<var class="field">[[Extensible]]</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-preventextensions" type="internal method">
<h1><span class="secnum">10.1.4</span> <var class="field">[[PreventExtensions]]</var> ( )</h1>
<p>The <var class="field">[[PreventExtensions]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4467"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4468"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-val>true</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="OrdinaryPreventExtensions" id="_ref_4469"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarypreventextensions">OrdinaryPreventExtensions</a></emu-xref>(<var>O</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinarypreventextensions" type="abstract operation" aoid="OrdinaryPreventExtensions">
<h1><span class="secnum">10.1.4.1</span> OrdinaryPreventExtensions ( <var>O</var> )</h1>
<p>The abstract operation OrdinaryPreventExtensions takes argument <var>O</var> (an Object) and returns <emu-val>true</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Set <var>O</var>.<var class="field">[[Extensible]]</var> to <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p" type="internal method">
<h1><span class="secnum">10.1.5</span> <var class="field">[[GetOwnProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[GetOwnProperty]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4470"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_4471"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4472"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4473"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_4474"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinarygetownproperty" type="abstract operation" aoid="OrdinaryGetOwnProperty">
<h1><span class="secnum">10.1.5.1</span> OrdinaryGetOwnProperty ( <var>O</var>, <var>P</var> )</h1>
<p>The abstract operation OrdinaryGetOwnProperty takes arguments <var>O</var> (an Object) and <var>P</var> (a <emu-xref href="#property-key" id="_ref_4475"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4476"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> does not have an own property with key <var>P</var>, return <emu-val>undefined</emu-val>.</li><li>Let <var>D</var> be a newly created <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4477"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> with no fields.</li><li>Let <var>X</var> be <var>O</var>'s own property whose key is <var>P</var>.</li><li>If <var>X</var> is a <emu-xref href="#sec-object-type" id="_ref_4478"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref>, then<ol><li>Set <var>D</var>.<var class="field">[[Value]]</var> to the value of <var>X</var>'s <var class="field">[[Value]]</var> attribute.</li><li>Set <var>D</var>.<var class="field">[[Writable]]</var> to the value of <var>X</var>'s <var class="field">[[Writable]]</var> attribute.</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_4479"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>X</var> is an <emu-xref href="#sec-object-type" id="_ref_4480"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref>.</li><li>Set <var>D</var>.<var class="field">[[Get]]</var> to the value of <var>X</var>'s <var class="field">[[Get]]</var> attribute.</li><li>Set <var>D</var>.<var class="field">[[Set]]</var> to the value of <var>X</var>'s <var class="field">[[Set]]</var> attribute.</li></ol></li><li>Set <var>D</var>.<var class="field">[[Enumerable]]</var> to the value of <var>X</var>'s <var class="field">[[Enumerable]]</var> attribute.</li><li>Set <var>D</var>.<var class="field">[[Configurable]]</var> to the value of <var>X</var>'s <var class="field">[[Configurable]]</var> attribute.</li><li>Return <var>D</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc" type="internal method">
<h1><span class="secnum">10.1.6</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4481"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_4482"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4483"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4484"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4485"><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>Return ?&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_4486"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty" class="e-user-code">OrdinaryDefineOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>, <var>Desc</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinarydefineownproperty" type="abstract operation" aoid="OrdinaryDefineOwnProperty">
<h1><span class="secnum">10.1.6.1</span> OrdinaryDefineOwnProperty ( <var>O</var>, <var>P</var>, <var>Desc</var> )</h1>
<p>The abstract operation OrdinaryDefineOwnProperty takes arguments <var>O</var> (an Object), <var>P</var> (a <emu-xref href="#property-key" id="_ref_4487"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4488"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4489"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4490"><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>current</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>Let <var>extensible</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_4491"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>O</var>).</li><li>Return <emu-xref aoid="ValidateAndApplyPropertyDescriptor" id="_ref_4492"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validateandapplypropertydescriptor">ValidateAndApplyPropertyDescriptor</a></emu-xref>(<var>O</var>, <var>P</var>, <var>extensible</var>, <var>Desc</var>, <var>current</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-iscompatiblepropertydescriptor" type="abstract operation" aoid="IsCompatiblePropertyDescriptor">
<h1><span class="secnum">10.1.6.2</span> IsCompatiblePropertyDescriptor ( <var>Extensible</var>, <var>Desc</var>, <var>Current</var> )</h1>
<p>The abstract operation IsCompatiblePropertyDescriptor takes arguments <var>Extensible</var> (a Boolean), <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4493"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>), and <var>Current</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4494"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="ValidateAndApplyPropertyDescriptor" id="_ref_4495"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validateandapplypropertydescriptor">ValidateAndApplyPropertyDescriptor</a></emu-xref>(<emu-val>undefined</emu-val>, <emu-val>""</emu-val>, <var>Extensible</var>, <var>Desc</var>, <var>Current</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-validateandapplypropertydescriptor" type="abstract operation" aoid="ValidateAndApplyPropertyDescriptor">
<h1><span class="secnum">10.1.6.3</span> ValidateAndApplyPropertyDescriptor ( <var>O</var>, <var>P</var>, <var>extensible</var>, <var>Desc</var>, <var>current</var> )</h1>
<p>The abstract operation ValidateAndApplyPropertyDescriptor takes arguments <var>O</var> (an Object or <emu-val>undefined</emu-val>), <var>P</var> (a <emu-xref href="#property-key" id="_ref_4496"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>extensible</var> (a Boolean), <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4497"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>), and <var>current</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4498"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>) and returns a Boolean. It returns <emu-val>true</emu-val> if and only if <var>Desc</var> can be applied as the property of an object with specified <var>extensibility</var> and current property <var>current</var> while upholding <emu-xref href="#sec-invariants-of-the-essential-internal-methods" id="_ref_273"><a href="ecmascript-data-types-and-values.html#sec-invariants-of-the-essential-internal-methods">invariants</a></emu-xref>. When such application is possible and <var>O</var> is not <emu-val>undefined</emu-val>, it is performed for the property named <var>P</var> (which is created if necessary). It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4499"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>P</var> is a <emu-xref href="#property-key" id="_ref_4500"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>.</li><li>If <var>current</var> is <emu-val>undefined</emu-val>, then<ol><li>If <var>extensible</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>O</var> is <emu-val>undefined</emu-val>, return <emu-val>true</emu-val>.</li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_4501"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, then<ol><li>Create an own <emu-xref href="#sec-object-type" id="_ref_4502"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> named <var>P</var> of object <var>O</var> whose <var class="field">[[Get]]</var>, <var class="field">[[Set]]</var>, <var class="field">[[Enumerable]]</var>, and <var class="field">[[Configurable]]</var> attributes are set to the value of the corresponding field in <var>Desc</var> if <var>Desc</var> has that field, or to the attribute's <emu-xref href="#table-object-property-attributes" id="_ref_274"><a href="ecmascript-data-types-and-values.html#table-object-property-attributes">default value</a></emu-xref> otherwise.</li></ol></li><li>Else,<ol><li>Create an own <emu-xref href="#sec-object-type" id="_ref_4503"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> named <var>P</var> of object <var>O</var> whose <var class="field">[[Value]]</var>, <var class="field">[[Writable]]</var>, <var class="field">[[Enumerable]]</var>, and <var class="field">[[Configurable]]</var> attributes are set to the value of the corresponding field in <var>Desc</var> if <var>Desc</var> has that field, or to the attribute's <emu-xref href="#table-object-property-attributes" id="_ref_275"><a href="ecmascript-data-types-and-values.html#table-object-property-attributes">default value</a></emu-xref> otherwise.</li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></li><li><emu-xref href="#assert" id="_ref_4504"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>current</var> is a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4505"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">fully populated Property Descriptor</a></emu-xref>.</li><li>If <var>Desc</var> does not have any fields, return <emu-val>true</emu-val>.</li><li>If <var>current</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <var>Desc</var> has a <var class="field">[[Configurable]]</var> field and <var>Desc</var>.<var class="field">[[Configurable]]</var> is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has an <var class="field">[[Enumerable]]</var> field and <var>Desc</var>.<var class="field">[[Enumerable]]</var> is not <var>current</var>.<var class="field">[[Enumerable]]</var>, return <emu-val>false</emu-val>.</li><li>If <emu-xref aoid="IsGenericDescriptor" id="_ref_4506"><a href="ecmascript-data-types-and-values.html#sec-isgenericdescriptor">IsGenericDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>false</emu-val> and <emu-xref aoid="IsAccessorDescriptor" id="_ref_4507"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>Desc</var>) is not <emu-xref aoid="IsAccessorDescriptor" id="_ref_4508"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>current</var>), return <emu-val>false</emu-val>.</li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_4509"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>current</var>) is <emu-val>true</emu-val>, then<ol><li>If <var>Desc</var> has a <var class="field">[[Get]]</var> field and <emu-xref aoid="SameValue" id="_ref_4510"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>Desc</var>.<var class="field">[[Get]]</var>, <var>current</var>.<var class="field">[[Get]]</var>) is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Set]]</var> field and <emu-xref aoid="SameValue" id="_ref_4511"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>Desc</var>.<var class="field">[[Set]]</var>, <var>current</var>.<var class="field">[[Set]]</var>) is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li></ol></li><li>Else if <var>current</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <var>Desc</var> has a <var class="field">[[Writable]]</var> field and <var>Desc</var>.<var class="field">[[Writable]]</var> is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>NOTE: <emu-xref aoid="SameValue" id="_ref_4512"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref> returns <emu-val>true</emu-val> for <emu-val>NaN</emu-val> values which may be distinguishable by other means. Returning here ensures that any existing property of <var>O</var> remains unmodified.</li><li>If <var>Desc</var> has a <var class="field">[[Value]]</var> field, return <emu-xref aoid="SameValue" id="_ref_4513"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>Desc</var>.<var class="field">[[Value]]</var>, <var>current</var>.<var class="field">[[Value]]</var>).</li></ol></li></ol></li><li>If <var>O</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="IsDataDescriptor" id="_ref_4514"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>current</var>) is <emu-val>true</emu-val> and <emu-xref aoid="IsAccessorDescriptor" id="_ref_4515"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, then<ol><li>If <var>Desc</var> has a <var class="field">[[Configurable]]</var> field, let <var>configurable</var> be <var>Desc</var>.<var class="field">[[Configurable]]</var>; else let <var>configurable</var> be <var>current</var>.<var class="field">[[Configurable]]</var>.</li><li>If <var>Desc</var> has an <var class="field">[[Enumerable]]</var> field, let <var>enumerable</var> be <var>Desc</var>.<var class="field">[[Enumerable]]</var>; else let <var>enumerable</var> be <var>current</var>.<var class="field">[[Enumerable]]</var>.</li><li>Replace the property named <var>P</var> of object <var>O</var> with an <emu-xref href="#sec-object-type" id="_ref_4516"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> whose <var class="field">[[Configurable]]</var> and <var class="field">[[Enumerable]]</var> attributes are set to <var>configurable</var> and <var>enumerable</var>, respectively, and whose <var class="field">[[Get]]</var> and <var class="field">[[Set]]</var> attributes are set to the value of the corresponding field in <var>Desc</var> if <var>Desc</var> has that field, or to the attribute's <emu-xref href="#table-object-property-attributes" id="_ref_276"><a href="ecmascript-data-types-and-values.html#table-object-property-attributes">default value</a></emu-xref> otherwise.</li></ol></li><li>Else if <emu-xref aoid="IsAccessorDescriptor" id="_ref_4517"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>current</var>) is <emu-val>true</emu-val> and <emu-xref aoid="IsDataDescriptor" id="_ref_4518"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, then<ol><li>If <var>Desc</var> has a <var class="field">[[Configurable]]</var> field, let <var>configurable</var> be <var>Desc</var>.<var class="field">[[Configurable]]</var>; else let <var>configurable</var> be <var>current</var>.<var class="field">[[Configurable]]</var>.</li><li>If <var>Desc</var> has an <var class="field">[[Enumerable]]</var> field, let <var>enumerable</var> be <var>Desc</var>.<var class="field">[[Enumerable]]</var>; else let <var>enumerable</var> be <var>current</var>.<var class="field">[[Enumerable]]</var>.</li><li>Replace the property named <var>P</var> of object <var>O</var> with a <emu-xref href="#sec-object-type" id="_ref_4519"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> whose <var class="field">[[Configurable]]</var> and <var class="field">[[Enumerable]]</var> attributes are set to <var>configurable</var> and <var>enumerable</var>, respectively, and whose <var class="field">[[Value]]</var> and <var class="field">[[Writable]]</var> attributes are set to the value of the corresponding field in <var>Desc</var> if <var>Desc</var> has that field, or to the attribute's <emu-xref href="#table-object-property-attributes" id="_ref_277"><a href="ecmascript-data-types-and-values.html#table-object-property-attributes">default value</a></emu-xref> otherwise.</li></ol></li><li>Else,<ol><li>For each field of <var>Desc</var>, set the corresponding attribute of the property named <var>P</var> of object <var>O</var> to the value of the field.</li></ol></li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p" type="internal method">
<h1><span class="secnum">10.1.7</span> <var class="field">[[HasProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[HasProperty]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4520"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_4521"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4522"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4523"><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>Return ?&nbsp;<emu-xref aoid="OrdinaryHasProperty" id="_ref_4524"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryhasproperty" class="e-user-code">OrdinaryHasProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinaryhasproperty" type="abstract operation" aoid="OrdinaryHasProperty">
<h1><span class="secnum">10.1.7.1</span> OrdinaryHasProperty ( <var>O</var>, <var>P</var> )</h1>
<p>The abstract operation OrdinaryHasProperty takes arguments <var>O</var> (an Object) and <var>P</var> (a <emu-xref href="#property-key" id="_ref_4525"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4526"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4527"><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>hasOwn</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>hasOwn</var> is not <emu-val>undefined</emu-val>, return <emu-val>true</emu-val>.</li><li>Let <var>parent</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <var>parent</var> is not <emu-val>null</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>parent</var>.<var class="field">[[HasProperty]]</var>(<var>P</var>)</span>.</li></ol></li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver" type="internal method">
<h1><span class="secnum">10.1.8</span> <var class="field">[[Get]]</var> ( <var>P</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Get]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4528"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_4529"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4530"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4531"><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_4532"><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_4533"><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>Return ?&nbsp;<emu-xref aoid="OrdinaryGet" id="_ref_4534"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryget" class="e-user-code">OrdinaryGet</a></emu-xref>(<var>O</var>, <var>P</var>, <var>Receiver</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinaryget" type="abstract operation" aoid="OrdinaryGet">
<h1><span class="secnum">10.1.8.1</span> OrdinaryGet ( <var>O</var>, <var>P</var>, <var>Receiver</var> )</h1>
<p>The abstract operation OrdinaryGet takes arguments <var>O</var> (an Object), <var>P</var> (a <emu-xref href="#property-key" id="_ref_4535"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4536"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4537"><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_4538"><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_4539"><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>desc</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>desc</var> is <emu-val>undefined</emu-val>, then<ol><li>Let <var>parent</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <var>parent</var> is <emu-val>null</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Return ?&nbsp;<span class="e-user-code"><var>parent</var>.<var class="field">[[Get]]</var>(<var>P</var>, <var>Receiver</var>)</span>.</li></ol></li><li>If <emu-xref aoid="IsDataDescriptor" id="_ref_4540"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>desc</var>) is <emu-val>true</emu-val>, return <var>desc</var>.<var class="field">[[Value]]</var>.</li><li><emu-xref href="#assert" id="_ref_4541"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsAccessorDescriptor" id="_ref_4542"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>desc</var>) is <emu-val>true</emu-val>.</li><li>Let <var>getter</var> be <var>desc</var>.<var class="field">[[Get]]</var>.</li><li>If <var>getter</var> is <emu-val>undefined</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Return ?&nbsp;<emu-xref aoid="Call" id="_ref_4543"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>getter</var>, <var>Receiver</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver" type="internal method">
<h1><span class="secnum">10.1.9</span> <var class="field">[[Set]]</var> ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Set]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4544"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_4545"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4546"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4547"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4548"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4549"><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>Return ?&nbsp;<emu-xref aoid="OrdinarySet" id="_ref_4550"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryset" class="e-user-code">OrdinarySet</a></emu-xref>(<var>O</var>, <var>P</var>, <var>V</var>, <var>Receiver</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinaryset" type="abstract operation" aoid="OrdinarySet">
<h1><span class="secnum">10.1.9.1</span> OrdinarySet ( <var>O</var>, <var>P</var>, <var>V</var>, <var>Receiver</var> )</h1>
<p>The abstract operation OrdinarySet takes arguments <var>O</var> (an Object), <var>P</var> (a <emu-xref href="#property-key" id="_ref_4551"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4552"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4553"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4554"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4555"><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>ownDesc</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>Return ?&nbsp;<emu-xref aoid="OrdinarySetWithOwnDescriptor" id="_ref_4556"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarysetwithowndescriptor" class="e-user-code">OrdinarySetWithOwnDescriptor</a></emu-xref>(<var>O</var>, <var>P</var>, <var>V</var>, <var>Receiver</var>, <var>ownDesc</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-ordinarysetwithowndescriptor" type="abstract operation" aoid="OrdinarySetWithOwnDescriptor">
<h1><span class="secnum">10.1.9.2</span> OrdinarySetWithOwnDescriptor ( <var>O</var>, <var>P</var>, <var>V</var>, <var>Receiver</var>, <var>ownDesc</var> )</h1>
<p>The abstract operation OrdinarySetWithOwnDescriptor takes arguments <var>O</var> (an Object), <var>P</var> (a <emu-xref href="#property-key" id="_ref_4557"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4558"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4559"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>ownDesc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_4560"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4561"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4562"><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>If <var>ownDesc</var> is <emu-val>undefined</emu-val>, then<ol><li>Let <var>parent</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <var>parent</var> is not <emu-val>null</emu-val>, return ?&nbsp;<span class="e-user-code"><var>parent</var>.<var class="field">[[Set]]</var>(<var>P</var>, <var>V</var>, <var>Receiver</var>)</span>.</li><li>Set <var>ownDesc</var> to the PropertyDescriptor { <var class="field">[[Value]]</var>: <emu-val>undefined</emu-val>, <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}.</li></ol></li><li>If <emu-xref aoid="IsDataDescriptor" id="_ref_4563"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>ownDesc</var>) is <emu-val>true</emu-val>, then<ol><li>If <var>ownDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Receiver</var> <emu-xref href="#sec-object-type" id="_ref_4564"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <emu-val>false</emu-val>.</li><li>Let <var>existingDescriptor</var> be ?&nbsp;<span class="e-user-code"><var>Receiver</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>existingDescriptor</var> is <emu-val>undefined</emu-val>, then<ol><li><emu-xref href="#assert" id="_ref_4565"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>Receiver</var> does not currently have a property <var>P</var>.</li><li>Return ?&nbsp;<emu-xref aoid="CreateDataProperty" id="_ref_4566"><a href="abstract-operations.html#sec-createdataproperty" class="e-user-code">CreateDataProperty</a></emu-xref>(<var>Receiver</var>, <var>P</var>, <var>V</var>).</li></ol></li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_4567"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>existingDescriptor</var>) is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>existingDescriptor</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>valueDesc</var> be the PropertyDescriptor { <var class="field">[[Value]]</var>: <var>V</var>&nbsp;}.</li><li>Return ?&nbsp;<span class="e-user-code"><var>Receiver</var>.<var class="field">[[DefineOwnProperty]]</var>(<var>P</var>, <var>valueDesc</var>)</span>.</li></ol></li><li><emu-xref href="#assert" id="_ref_4568"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsAccessorDescriptor" id="_ref_4569"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>ownDesc</var>) is <emu-val>true</emu-val>.</li><li>Let <var>setter</var> be <var>ownDesc</var>.<var class="field">[[Set]]</var>.</li><li>If <var>setter</var> is <emu-val>undefined</emu-val>, return <emu-val>false</emu-val>.</li><li>Perform ?&nbsp;<emu-xref aoid="Call" id="_ref_4570"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>setter</var>, <var>Receiver</var>, « <var>V</var>&nbsp;»).</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-delete-p" type="internal method">
<h1><span class="secnum">10.1.10</span> <var class="field">[[Delete]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[Delete]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4571"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_4572"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4573"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4574"><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>Return ?&nbsp;<emu-xref aoid="OrdinaryDelete" id="_ref_4575"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydelete" class="e-user-code">OrdinaryDelete</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinarydelete" type="abstract operation" aoid="OrdinaryDelete">
<h1><span class="secnum">10.1.10.1</span> OrdinaryDelete ( <var>O</var>, <var>P</var> )</h1>
<p>The abstract operation OrdinaryDelete takes arguments <var>O</var> (an Object) and <var>P</var> (a <emu-xref href="#property-key" id="_ref_4576"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4577"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4578"><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>desc</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>desc</var> is <emu-val>undefined</emu-val>, return <emu-val>true</emu-val>.</li><li>If <var>desc</var>.<var class="field">[[Configurable]]</var> is <emu-val>true</emu-val>, then<ol><li>Remove the own property with name <var>P</var> from <var>O</var>.</li><li>Return <emu-val>true</emu-val>.</li></ol></li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" type="internal method">
<h1><span class="secnum">10.1.11</span> <var class="field">[[OwnPropertyKeys]]</var> ( )</h1>
<p>The <var class="field">[[OwnPropertyKeys]]</var> internal method of an <emu-xref href="#ordinary-object" id="_ref_4579"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4580"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4581"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_4582"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="OrdinaryOwnPropertyKeys" id="_ref_4583"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryownpropertykeys">OrdinaryOwnPropertyKeys</a></emu-xref>(<var>O</var>).</li></ol></emu-alg>
<emu-clause id="sec-ordinaryownpropertykeys" type="abstract operation" aoid="OrdinaryOwnPropertyKeys">
<h1><span class="secnum">10.1.11.1</span> OrdinaryOwnPropertyKeys ( <var>O</var> )</h1>
<p>The abstract operation OrdinaryOwnPropertyKeys takes argument <var>O</var> (an Object) and returns a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4584"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_4585"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>keys</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4586"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each own <emu-xref href="#property-key" id="_ref_4587"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> is an <emu-xref href="#array-index" id="_ref_4588"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>, in ascending numeric index order, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_4589"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_4590"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref> and <var>P</var> is not an <emu-xref href="#array-index" id="_ref_4591"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>, in ascending chronological order of property creation, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_4592"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_4593"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, in ascending chronological order of property creation, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>Return <var>keys</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ordinaryobjectcreate" type="abstract operation" oldids="sec-objectcreate" aoid="OrdinaryObjectCreate"><span id="sec-objectcreate"></span>
<h1><span class="secnum">10.1.12</span> OrdinaryObjectCreate ( <var>proto</var> [ , <var>additionalInternalSlotsList</var> ] )</h1>
<p>The abstract operation OrdinaryObjectCreate takes argument <var>proto</var> (an Object or <emu-val>null</emu-val>) and optional argument <var>additionalInternalSlotsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4594"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of names of internal slots) and returns an Object. It is used to specify the runtime creation of new <emu-xref href="#ordinary-object" id="_ref_4595"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref>. <var>additionalInternalSlotsList</var> contains the names of additional internal slots that must be defined as part of the object, beyond <var class="field">[[Prototype]]</var> and <var class="field">[[Extensible]]</var>. If <var>additionalInternalSlotsList</var> is not provided, a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4596"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> is used. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>internalSlotsList</var> be « <var class="field">[[Prototype]]</var>, <var class="field">[[Extensible]]</var>&nbsp;».</li><li>If <var>additionalInternalSlotsList</var> is present, set <var>internalSlotsList</var> to the <emu-xref href="#list-concatenation" id="_ref_4597"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>internalSlotsList</var> and <var>additionalInternalSlotsList</var>.</li><li>Let <var>O</var> be <emu-xref aoid="MakeBasicObject" id="_ref_4598"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref>(<var>internalSlotsList</var>).</li><li>Set <var>O</var>.<var class="field">[[Prototype]]</var> to <var>proto</var>.</li><li>Return <var>O</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Although OrdinaryObjectCreate does little more than call <emu-xref aoid="MakeBasicObject" id="_ref_4599"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref>, its use communicates the intention to create an <emu-xref href="#ordinary-object" id="_ref_4600"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>, and not an exotic one. Thus, within this specification, it is not called by any algorithm that subsequently modifies the internal methods of the object in ways that would make the result non-ordinary. Operations that create <emu-xref href="#exotic-object" id="_ref_4601"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref> invoke <emu-xref aoid="MakeBasicObject" id="_ref_4602"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref> directly.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-ordinarycreatefromconstructor" type="abstract operation" aoid="OrdinaryCreateFromConstructor">
<h1><span class="secnum">10.1.13</span> OrdinaryCreateFromConstructor ( <var>constructor</var>, <var>intrinsicDefaultProto</var> [ , <var>internalSlotsList</var> ] )</h1>
<p>The abstract operation OrdinaryCreateFromConstructor takes arguments <var>constructor</var> (a <emu-xref href="#function-object" id="_ref_4603"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>intrinsicDefaultProto</var> (a String) and optional argument <var>internalSlotsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4604"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of names of internal slots) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4605"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4606"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It creates an <emu-xref href="#ordinary-object" id="_ref_4607"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> whose <var class="field">[[Prototype]]</var> value is retrieved from a <emu-xref href="#constructor" id="_ref_4608"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>'s <emu-val>"prototype"</emu-val> property, if it exists. Otherwise the intrinsic named by <var>intrinsicDefaultProto</var> is used for <var class="field">[[Prototype]]</var>. <var>internalSlotsList</var> contains the names of additional internal slots that must be defined as part of the object. If <var>internalSlotsList</var> is not provided, a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4609"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> is used. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4610"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>intrinsicDefaultProto</var> is this specification's name of an intrinsic object. The corresponding object must be an intrinsic that is intended to be used as the <var class="field">[[Prototype]]</var> value of an object.</li><li>Let <var>proto</var> be ?&nbsp;<emu-xref aoid="GetPrototypeFromConstructor" id="_ref_4611"><a href="ordinary-and-exotic-objects-behaviours.html#sec-getprototypefromconstructor" class="e-user-code">GetPrototypeFromConstructor</a></emu-xref>(<var>constructor</var>, <var>intrinsicDefaultProto</var>).</li><li>If <var>internalSlotsList</var> is present, let <var>slotsList</var> be <var>internalSlotsList</var>.</li><li>Else, let <var>slotsList</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4612"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Return <emu-xref aoid="OrdinaryObjectCreate" id="_ref_4613"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<var>proto</var>, <var>slotsList</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-getprototypefromconstructor" type="abstract operation" aoid="GetPrototypeFromConstructor">
<h1><span class="secnum">10.1.14</span> GetPrototypeFromConstructor ( <var>constructor</var>, <var>intrinsicDefaultProto</var> )</h1>
<p>The abstract operation GetPrototypeFromConstructor takes arguments <var>constructor</var> (a <emu-xref href="#function-object" id="_ref_4614"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>intrinsicDefaultProto</var> (a String) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4615"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4616"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It determines the <var class="field">[[Prototype]]</var> value that should be used to create an object corresponding to a specific <emu-xref href="#constructor" id="_ref_4617"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. The value is retrieved from the <emu-xref href="#constructor" id="_ref_4618"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>'s <emu-val>"prototype"</emu-val> property, if it exists. Otherwise the intrinsic named by <var>intrinsicDefaultProto</var> is used for <var class="field">[[Prototype]]</var>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4619"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>intrinsicDefaultProto</var> is this specification's name of an intrinsic object. The corresponding object must be an intrinsic that is intended to be used as the <var class="field">[[Prototype]]</var> value of an object.</li><li>Let <var>proto</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_4620"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>constructor</var>, <emu-val>"prototype"</emu-val>).</li><li>If <var>proto</var> <emu-xref href="#sec-object-type" id="_ref_4621"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, then<ol><li>Let <var>realm</var> be ?&nbsp;<emu-xref aoid="GetFunctionRealm" id="_ref_4622"><a href="abstract-operations.html#sec-getfunctionrealm">GetFunctionRealm</a></emu-xref>(<var>constructor</var>).</li><li>Set <var>proto</var> to <var>realm</var>'s intrinsic object named <var>intrinsicDefaultProto</var>.</li></ol></li><li>Return <var>proto</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>constructor</var> does not supply a <var class="field">[[Prototype]]</var> value, the default value that is used is obtained from the <emu-xref href="#realm" id="_ref_4623"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> of the <var>constructor</var> function rather than from the <emu-xref href="#running-execution-context" id="_ref_4624"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-requireinternalslot" type="abstract operation" aoid="RequireInternalSlot">
<h1><span class="secnum">10.1.15</span> RequireInternalSlot ( <var>O</var>, <var>internalSlot</var> )</h1>
<p>The abstract operation RequireInternalSlot takes arguments <var>O</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4625"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>internalSlot</var> (an internal slot name) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4626"><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_4627"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It throws an exception unless <var>O</var> <emu-xref href="#sec-object-type" id="_ref_4628"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and has the given internal slot. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_4629"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>O</var> does not have an <var>internalSlot</var> internal slot, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ecmascript-function-objects">
<h1><span class="secnum">10.2</span> ECMAScript Function Objects</h1>
<p>ECMAScript <emu-xref href="#function-object" id="_ref_4630"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> encapsulate parameterized ECMAScript code closed over a lexical environment and support the dynamic evaluation of that code. An ECMAScript <emu-xref href="#function-object" id="_ref_4631"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> is an <emu-xref href="#ordinary-object" id="_ref_4632"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> and has the same internal slots and the same internal methods as other <emu-xref href="#ordinary-object" id="_ref_4633"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref>. The code of an ECMAScript <emu-xref href="#function-object" id="_ref_4634"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> may be either <emu-xref href="#sec-strict-mode-code" id="_ref_4635"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref> (<emu-xref href="#sec-strict-mode-code" id="_ref_278"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">11.2.2</a></emu-xref>) or <emu-xref href="#non-strict-code" id="_ref_4636"><a href="ecmascript-language-source-code.html#non-strict-code">non-strict code</a></emu-xref>. An ECMAScript <emu-xref href="#function-object" id="_ref_4637"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> whose code is <emu-xref href="#sec-strict-mode-code" id="_ref_4638"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref> is called a <dfn id="strict-function" variants="strict functions" tabindex="-1">strict function</dfn>. One whose code is not <emu-xref href="#sec-strict-mode-code" id="_ref_4639"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref> is called a <dfn id="non-strict-function" variants="non-strict functions" tabindex="-1">non-strict function</dfn>.</p>
<p>In addition to <var class="field">[[Extensible]]</var> and <var class="field">[[Prototype]]</var>, ECMAScript <emu-xref href="#function-object" id="_ref_4640"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> also have the internal slots listed in <emu-xref href="#table-internal-slots-of-ecmascript-function-objects" id="_ref_279"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-ecmascript-function-objects">Table 25</a></emu-xref>.</p>
<emu-table id="table-internal-slots-of-ecmascript-function-objects" caption="Internal Slots of ECMAScript Function Objects" oldids="table-27"><figure><figcaption>Table 25: Internal Slots of ECMAScript Function Objects</figcaption><span id="table-27"></span>
<table>
<thead>
<tr>
<th>
Internal Slot
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[Environment]]</var>
</td>
<td>
an <emu-xref href="#sec-environment-records" id="_ref_4641"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>
</td>
<td>
The <emu-xref href="#sec-environment-records" id="_ref_4642"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> that the function was closed over. Used as the outer environment when evaluating the code of the function.
</td>
</tr>
<tr>
<td>
<var class="field">[[PrivateEnvironment]]</var>
</td>
<td>
a <emu-xref href="#privateenvironment-record" id="_ref_4643"><a href="executable-code-and-execution-contexts.html#privateenvironment-record">PrivateEnvironment Record</a></emu-xref> or <emu-val>null</emu-val>
</td>
<td>
The <emu-xref href="#privateenvironment-record" id="_ref_4644"><a href="executable-code-and-execution-contexts.html#privateenvironment-record">PrivateEnvironment Record</a></emu-xref> for <emu-xref href="#sec-private-names" id="_ref_4645"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Names</a></emu-xref> that the function was closed over. <emu-val>null</emu-val> if this function is not syntactically contained within a class. Used as the outer PrivateEnvironment for inner classes when evaluating the code of the function.
</td>
</tr>
<tr>
<td>
<var class="field">[[FormalParameters]]</var>
</td>
<td>
a <emu-xref href="#sec-syntactic-grammar" id="_ref_4646"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>
</td>
<td>
The root parse node of the source text that defines the function's formal parameter list.
</td>
</tr>
<tr>
<td>
<var class="field">[[ECMAScriptCode]]</var>
</td>
<td>
a <emu-xref href="#sec-syntactic-grammar" id="_ref_4647"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>
</td>
<td>
The root parse node of the source text that defines the function's body.
</td>
</tr>
<tr>
<td>
<var class="field">[[ConstructorKind]]</var>
</td>
<td>
<emu-const>base</emu-const> or <emu-const>derived</emu-const>
</td>
<td>
Whether or not the function is a derived class <emu-xref href="#constructor" id="_ref_4648"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.
</td>
</tr>
<tr>
<td>
<var class="field">[[Realm]]</var>
</td>
<td>
a <emu-xref href="#realm-record" id="_ref_4649"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>
</td>
<td>
The <emu-xref href="#realm" id="_ref_4650"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> in which the function was created and which provides any intrinsic objects that are accessed when evaluating the function.
</td>
</tr>
<tr>
<td>
<var class="field">[[ScriptOrModule]]</var>
</td>
<td>
a <emu-xref href="#script-record" id="_ref_4651"><a href="ecmascript-language-scripts-and-modules.html#script-record">Script Record</a></emu-xref> or a <emu-xref href="#sec-abstract-module-records" id="_ref_4652"><a href="ecmascript-language-scripts-and-modules.html#sec-abstract-module-records">Module Record</a></emu-xref>
</td>
<td>
The script or module in which the function was created.
</td>
</tr>
<tr>
<td>
<var class="field">[[ThisMode]]</var>
</td>
<td>
<emu-const>lexical</emu-const>, <emu-const>strict</emu-const>, or <emu-const>global</emu-const>
</td>
<td>
Defines how <code>this</code> references are interpreted within the formal parameters and code body of the function. <emu-const>lexical</emu-const> means that <code>this</code> refers to the <emu-val>this</emu-val> value of a lexically enclosing function. <emu-const>strict</emu-const> means that the <emu-val>this</emu-val> value is used exactly as provided by an invocation of the function. <emu-const>global</emu-const> means that a <emu-val>this</emu-val> value of <emu-val>undefined</emu-val> or <emu-val>null</emu-val> is interpreted as a reference to the <emu-xref href="#sec-global-object" id="_ref_4653"><a href="global-object.html#sec-global-object">global object</a></emu-xref>, and any other <emu-val>this</emu-val> value is first passed to <emu-xref aoid="ToObject" id="_ref_4654"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>.
</td>
</tr>
<tr>
<td>
<var class="field">[[Strict]]</var>
</td>
<td>
a Boolean
</td>
<td>
<emu-val>true</emu-val> if this is a <emu-xref href="#strict-function" id="_ref_4655"><a href="ordinary-and-exotic-objects-behaviours.html#strict-function">strict function</a></emu-xref>, <emu-val>false</emu-val> if this is a <emu-xref href="#non-strict-function" id="_ref_4656"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict function</a></emu-xref>.
</td>
</tr>
<tr>
<td>
<var class="field">[[HomeObject]]</var>
</td>
<td>
an Object
</td>
<td>
If the function uses <code>super</code>, this is the object whose <var class="field">[[GetPrototypeOf]]</var> provides the object where <code>super</code> property lookups begin.
</td>
</tr>
<tr>
<td>
<var class="field">[[SourceText]]</var>
</td>
<td>
a sequence of Unicode code points
</td>
<td>
The <emu-xref href="#sec-source-text" id="_ref_280"><a href="ecmascript-language-source-code.html#sec-source-text">source text</a></emu-xref> that defines the function.
</td>
</tr>
<tr>
<td>
<var class="field">[[Fields]]</var>
</td>
<td>
a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4657"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-classfielddefinition-record-specification-type" id="_ref_4658"><a href="ecmascript-data-types-and-values.html#sec-classfielddefinition-record-specification-type">ClassFieldDefinition Records</a></emu-xref>
</td>
<td>
If the function is a class, this is a list of <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4659"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Records</a></emu-xref> representing the non-static fields and corresponding initializers of the class.
</td>
</tr>
<tr>
<td>
<var class="field">[[PrivateMethods]]</var>
</td>
<td>
a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4660"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-privateelement-specification-type" id="_ref_4661"><a href="ecmascript-data-types-and-values.html#sec-privateelement-specification-type">PrivateElements</a></emu-xref>
</td>
<td>
If the function is a class, this is a list representing the non-static private methods and accessors of the class.
</td>
</tr>
<tr>
<td>
<var class="field">[[ClassFieldInitializerName]]</var>
</td>
<td>
a String, a Symbol, a <emu-xref href="#sec-private-names" id="_ref_4662"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref>, or <emu-const>empty</emu-const>
</td>
<td>
If the function is created as the initializer of a class field, the name to use for <emu-xref aoid="NamedEvaluation" id="_ref_4663"><a href="syntax-directed-operations.html#sec-runtime-semantics-namedevaluation">NamedEvaluation</a></emu-xref> of the field; <emu-const>empty</emu-const> otherwise.
</td>
</tr>
<tr>
<td>
<var class="field">[[IsClassConstructor]]</var>
</td>
<td>
a Boolean
</td>
<td>
Indicates whether the function is a class <emu-xref href="#constructor" id="_ref_4664"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. (If <emu-val>true</emu-val>, invoking the function's <var class="field">[[Call]]</var> will immediately throw a <emu-val>TypeError</emu-val> exception.)
</td>
</tr>
</tbody></table>
</figure></emu-table>
<p>All ECMAScript <emu-xref href="#function-object" id="_ref_4665"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> have the <var class="field">[[Call]]</var> internal method defined here. ECMAScript functions that are also <emu-xref href="#constructor" id="_ref_4666"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> in addition have the <var class="field">[[Construct]]</var> internal method.</p>
<emu-clause id="sec-ecmascript-function-objects-call-thisargument-argumentslist" type="internal method">
<h1><span class="secnum">10.2.1</span> <var class="field">[[Call]]</var> ( <var>thisArgument</var>, <var>argumentsList</var> )</h1>
<p>The <var class="field">[[Call]]</var> internal method of an ECMAScript <emu-xref href="#function-object" id="_ref_4667"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> <var>F</var> takes arguments <var>thisArgument</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4668"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4669"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4670"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4671"><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_4672"><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_4673"><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>callerContext</var> be the <emu-xref href="#running-execution-context" id="_ref_4674"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Let <var>calleeContext</var> be <emu-xref aoid="PrepareForOrdinaryCall" id="_ref_4675"><a href="ordinary-and-exotic-objects-behaviours.html#sec-prepareforordinarycall">PrepareForOrdinaryCall</a></emu-xref>(<var>F</var>, <emu-val>undefined</emu-val>).</li><li><emu-xref href="#assert" id="_ref_4676"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>calleeContext</var> is now the <emu-xref href="#running-execution-context" id="_ref_4677"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If <var>F</var>.<var class="field">[[IsClassConstructor]]</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>error</var> be a newly created <emu-val>TypeError</emu-val> object.</li><li>NOTE: <var>error</var> is created in <var>calleeContext</var> with <var>F</var>'s associated <emu-xref href="#realm-record" id="_ref_4678"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>.</li><li>Remove <var>calleeContext</var> from the <emu-xref href="#execution-context-stack" id="_ref_4679"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> and restore <var>callerContext</var> as the <emu-xref href="#running-execution-context" id="_ref_4680"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Return <emu-xref aoid="ThrowCompletion" id="_ref_4681"><a href="ecmascript-data-types-and-values.html#sec-throwcompletion">ThrowCompletion</a></emu-xref>(<var>error</var>).</li></ol></li><li>Perform <emu-xref aoid="OrdinaryCallBindThis" id="_ref_4682"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycallbindthis">OrdinaryCallBindThis</a></emu-xref>(<var>F</var>, <var>calleeContext</var>, <var>thisArgument</var>).</li><li>Let <var>result</var> be <emu-xref aoid="Completion" id="_ref_4683"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="OrdinaryCallEvaluateBody" id="_ref_4684"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycallevaluatebody" class="e-user-code">OrdinaryCallEvaluateBody</a></emu-xref>(<var>F</var>, <var>argumentsList</var>)).</li><li id="step-call-pop-context-stack">Remove <var>calleeContext</var> from the <emu-xref href="#execution-context-stack" id="_ref_4685"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> and restore <var>callerContext</var> as the <emu-xref href="#running-execution-context" id="_ref_4686"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If <var>result</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4687"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">return completion</a></emu-xref>, return <var>result</var>.<var class="field">[[Value]]</var>.</li><li><emu-xref href="#assert" id="_ref_4688"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>result</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4689"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>.</li><li>Return ?&nbsp;<var>result</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>When <var>calleeContext</var> is removed from the <emu-xref href="#execution-context-stack" id="_ref_4690"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> in step <emu-xref href="#step-call-pop-context-stack" id="_ref_281"><a href="ordinary-and-exotic-objects-behaviours.html#step-call-pop-context-stack">7</a></emu-xref> it must not be destroyed if it is suspended and retained for later resumption by an accessible Generator.</p>
</div></emu-note>
<emu-clause id="sec-prepareforordinarycall" type="abstract operation" aoid="PrepareForOrdinaryCall">
<h1><span class="secnum">10.2.1.1</span> PrepareForOrdinaryCall ( <var>F</var>, <var>newTarget</var> )</h1>
<p>The abstract operation PrepareForOrdinaryCall takes arguments <var>F</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4691"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>newTarget</var> (an Object or <emu-val>undefined</emu-val>) and returns an <emu-xref href="#sec-execution-contexts" id="_ref_4692"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>callerContext</var> be the <emu-xref href="#running-execution-context" id="_ref_4693"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Let <var>calleeContext</var> be a new <emu-xref href="#ecmascript-code-execution-context" id="_ref_4694"><a href="executable-code-and-execution-contexts.html#ecmascript-code-execution-context">ECMAScript code execution context</a></emu-xref>.</li><li>Set the Function of <var>calleeContext</var> to <var>F</var>.</li><li>Let <var>calleeRealm</var> be <var>F</var>.<var class="field">[[Realm]]</var>.</li><li>Set the <emu-xref href="#realm" id="_ref_4695"><a href="executable-code-and-execution-contexts.html#realm">Realm</a></emu-xref> of <var>calleeContext</var> to <var>calleeRealm</var>.</li><li>Set the ScriptOrModule of <var>calleeContext</var> to <var>F</var>.<var class="field">[[ScriptOrModule]]</var>.</li><li>Let <var>localEnv</var> be <emu-xref aoid="NewFunctionEnvironment" id="_ref_4696"><a href="executable-code-and-execution-contexts.html#sec-newfunctionenvironment">NewFunctionEnvironment</a></emu-xref>(<var>F</var>, <var>newTarget</var>).</li><li>Set the LexicalEnvironment of <var>calleeContext</var> to <var>localEnv</var>.</li><li>Set the VariableEnvironment of <var>calleeContext</var> to <var>localEnv</var>.</li><li>Set the PrivateEnvironment of <var>calleeContext</var> to <var>F</var>.<var class="field">[[PrivateEnvironment]]</var>.</li><li>If <var>callerContext</var> is not already suspended, suspend <var>callerContext</var>.</li><li>Push <var>calleeContext</var> onto the <emu-xref href="#execution-context-stack" id="_ref_4697"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref>; <var>calleeContext</var> is now the <emu-xref href="#running-execution-context" id="_ref_4698"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>NOTE: Any exception objects produced after this point are associated with <var>calleeRealm</var>.</li><li>Return <var>calleeContext</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-ordinarycallbindthis" type="abstract operation" aoid="OrdinaryCallBindThis">
<h1><span class="secnum">10.2.1.2</span> OrdinaryCallBindThis ( <var>F</var>, <var>calleeContext</var>, <var>thisArgument</var> )</h1>
<p>The abstract operation OrdinaryCallBindThis takes arguments <var>F</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4699"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>), <var>calleeContext</var> (an <emu-xref href="#sec-execution-contexts" id="_ref_4700"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref>), and <var>thisArgument</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4701"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns <emu-const>unused</emu-const>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>thisMode</var> be <var>F</var>.<var class="field">[[ThisMode]]</var>.</li><li>If <var>thisMode</var> is <emu-const>lexical</emu-const>, return <emu-const>unused</emu-const>.</li><li>Let <var>calleeRealm</var> be <var>F</var>.<var class="field">[[Realm]]</var>.</li><li>Let <var>localEnv</var> be the LexicalEnvironment of <var>calleeContext</var>.</li><li>If <var>thisMode</var> is <emu-const>strict</emu-const>, then<ol><li>Let <var>thisValue</var> be <var>thisArgument</var>.</li></ol></li><li>Else,<ol><li>If <var>thisArgument</var> is either <emu-val>undefined</emu-val> or <emu-val>null</emu-val>, then<ol><li>Let <var>globalEnv</var> be <var>calleeRealm</var>.<var class="field">[[GlobalEnv]]</var>.</li><li><emu-xref href="#assert" id="_ref_4702"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>globalEnv</var> is a <emu-xref href="#sec-global-environment-records" id="_ref_4703"><a href="executable-code-and-execution-contexts.html#sec-global-environment-records">Global Environment Record</a></emu-xref>.</li><li>Let <var>thisValue</var> be <var>globalEnv</var>.<var class="field">[[GlobalThisValue]]</var>.</li></ol></li><li>Else,<ol><li>Let <var>thisValue</var> be !&nbsp;<emu-xref aoid="ToObject" id="_ref_4704"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>thisArgument</var>).</li><li>NOTE: <emu-xref aoid="ToObject" id="_ref_4705"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref> produces wrapper objects using <var>calleeRealm</var>.</li></ol></li></ol></li><li><emu-xref href="#assert" id="_ref_4706"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>localEnv</var> is a <emu-xref href="#sec-function-environment-records" id="_ref_4707"><a href="executable-code-and-execution-contexts.html#sec-function-environment-records">Function Environment Record</a></emu-xref>.</li><li><emu-xref href="#assert" id="_ref_4708"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The next step never returns an <emu-xref href="#sec-completion-record-specification-type" id="_ref_4709"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> because <var>localEnv</var>.<var class="field">[[ThisBindingStatus]]</var> is not <emu-const>initialized</emu-const>.</li><li>Perform !&nbsp;<emu-xref aoid="BindThisValue" id="_ref_4710"><a href="executable-code-and-execution-contexts.html#sec-bindthisvalue">BindThisValue</a></emu-xref>(<var>localEnv</var>, <var>thisValue</var>).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-evaluatebody" type="sdo" aoid="EvaluateBody">
<h1><span class="secnum">10.2.1.3</span> Runtime Semantics: EvaluateBody</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_4711"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> EvaluateBody takes arguments <var>functionObject</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4712"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4713"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4714"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4715"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">return completion</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4716"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="FunctionBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-FunctionBody">FunctionBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="xn8an8nx" id="prod-xc-5PFkl"><emu-nt id="_ref_19491"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionStatementList">FunctionStatementList</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="EvaluateFunctionBody" id="_ref_4717"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluatefunctionbody" class="e-user-code">EvaluateFunctionBody</a></emu-xref> of <emu-nt id="_ref_19492"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionBody">FunctionBody</a></emu-nt> with arguments <var>functionObject</var> and <var>argumentsList</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="ConciseBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-ConciseBody">ConciseBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="39f4t7jo" id="prod-ph5_rCcA"><emu-nt id="_ref_19493"><a href="ecmascript-language-functions-and-classes.html#prod-ExpressionBody">ExpressionBody</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="EvaluateConciseBody" id="_ref_4718"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluateconcisebody" class="e-user-code">EvaluateConciseBody</a></emu-xref> of <emu-nt id="_ref_19494"><a href="ecmascript-language-functions-and-classes.html#prod-ConciseBody">ConciseBody</a></emu-nt> with arguments <var>functionObject</var> and <var>argumentsList</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="GeneratorBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorBody">GeneratorBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="iqzbkm-h" id="prod-dp9uKN5f"><emu-nt id="_ref_19495"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionBody">FunctionBody</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="EvaluateGeneratorBody" id="_ref_4719"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluategeneratorbody" class="e-user-code">EvaluateGeneratorBody</a></emu-xref> of <emu-nt id="_ref_19496"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorBody">GeneratorBody</a></emu-nt> with arguments <var>functionObject</var> and <var>argumentsList</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="AsyncGeneratorBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorBody">AsyncGeneratorBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="iqzbkm-h" id="prod-_F5bCEpP"><emu-nt id="_ref_19497"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionBody">FunctionBody</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="EvaluateAsyncGeneratorBody" id="_ref_4720"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluateasyncgeneratorbody" class="e-user-code">EvaluateAsyncGeneratorBody</a></emu-xref> of <emu-nt id="_ref_19498"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorBody">AsyncGeneratorBody</a></emu-nt> with arguments <var>functionObject</var> and <var>argumentsList</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="AsyncFunctionBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionBody">AsyncFunctionBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="iqzbkm-h" id="prod-V5mALOgb"><emu-nt id="_ref_19499"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionBody">FunctionBody</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="EvaluateAsyncFunctionBody" id="_ref_4721"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluateasyncfunctionbody" class="e-user-code">EvaluateAsyncFunctionBody</a></emu-xref> of <emu-nt id="_ref_19500"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionBody">AsyncFunctionBody</a></emu-nt> with arguments <var>functionObject</var> and <var>argumentsList</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="AsyncConciseBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-AsyncConciseBody">AsyncConciseBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="39f4t7jo" id="prod--uh40sBe"><emu-nt id="_ref_19501"><a href="ecmascript-language-functions-and-classes.html#prod-ExpressionBody">ExpressionBody</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="EvaluateAsyncConciseBody" id="_ref_4722"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluateasyncconcisebody" class="e-user-code">EvaluateAsyncConciseBody</a></emu-xref> of <emu-nt id="_ref_19502"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncConciseBody">AsyncConciseBody</a></emu-nt> with arguments <var>functionObject</var> and <var>argumentsList</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="Initializer">
<emu-nt><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="_d0ijvnh" id="prod-pu8sYeYA">
<emu-t>=</emu-t>
<emu-nt id="_ref_19503"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4723"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>argumentsList</var> is empty.</li><li><emu-xref href="#assert" id="_ref_4724"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>functionObject</var>.<var class="field">[[ClassFieldInitializerName]]</var> is not <emu-const>empty</emu-const>.</li><li>If <emu-xref aoid="IsAnonymousFunctionDefinition" id="_ref_4725"><a href="syntax-directed-operations.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a></emu-xref>(<emu-nt id="_ref_19504"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>) is <emu-val>true</emu-val>, then<ol><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="NamedEvaluation" id="_ref_4726"><a href="syntax-directed-operations.html#sec-runtime-semantics-namedevaluation" class="e-user-code">NamedEvaluation</a></emu-xref> of <emu-nt id="_ref_19505"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> with argument <var>functionObject</var>.<var class="field">[[ClassFieldInitializerName]]</var>.</li></ol></li><li>Else,<ol><li>Let <var>rhs</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_4727"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_19506"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>.</li><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_4728"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>rhs</var>).</li></ol></li><li>Return <emu-xref aoid="ReturnCompletion" id="_ref_4729"><a href="ecmascript-data-types-and-values.html#sec-returncompletion">ReturnCompletion</a></emu-xref>(<var>value</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Even though field initializers constitute a function boundary, calling <emu-xref aoid="FunctionDeclarationInstantiation" id="_ref_4730"><a href="ordinary-and-exotic-objects-behaviours.html#sec-functiondeclarationinstantiation">FunctionDeclarationInstantiation</a></emu-xref> does not have any observable effect and so is omitted.</p>
</div></emu-note>
<emu-grammar><emu-production name="ClassStaticBlockBody" collapsed="">
<emu-nt><a href="ecmascript-language-functions-and-classes.html#prod-ClassStaticBlockBody">ClassStaticBlockBody</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="oh0jsomm" id="prod-X0MRkB7d"><emu-nt id="_ref_19507"><a href="ecmascript-language-functions-and-classes.html#prod-ClassStaticBlockStatementList">ClassStaticBlockStatementList</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4731"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>argumentsList</var> is empty.</li><li>Return ?&nbsp;<emu-xref aoid="EvaluateClassStaticBlockBody" id="_ref_4732"><a href="ecmascript-language-functions-and-classes.html#sec-runtime-semantics-evaluateclassstaticblockbody" class="e-user-code">EvaluateClassStaticBlockBody</a></emu-xref> of <emu-nt id="_ref_19508"><a href="ecmascript-language-functions-and-classes.html#prod-ClassStaticBlockBody">ClassStaticBlockBody</a></emu-nt> with argument <var>functionObject</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-ordinarycallevaluatebody" type="abstract operation" aoid="OrdinaryCallEvaluateBody">
<h1><span class="secnum">10.2.1.4</span> OrdinaryCallEvaluateBody ( <var>F</var>, <var>argumentsList</var> )</h1>
<p>The abstract operation OrdinaryCallEvaluateBody takes arguments <var>F</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4733"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4734"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4735"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4736"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">return completion</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4737"><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>Return ?&nbsp;<emu-xref aoid="EvaluateBody" id="_ref_4738"><a href="ordinary-and-exotic-objects-behaviours.html#sec-runtime-semantics-evaluatebody" class="e-user-code">EvaluateBody</a></emu-xref> of <var>F</var>.<var class="field">[[ECMAScriptCode]]</var> with arguments <var>F</var> and <var>argumentsList</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ecmascript-function-objects-construct-argumentslist-newtarget" type="internal method">
<h1><span class="secnum">10.2.2</span> <var class="field">[[Construct]]</var> ( <var>argumentsList</var>, <var>newTarget</var> )</h1>
<p>The <var class="field">[[Construct]]</var> internal method of an ECMAScript <emu-xref href="#function-object" id="_ref_4739"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> <var>F</var> takes arguments <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4740"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4741"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and <var>newTarget</var> (a <emu-xref href="#constructor" id="_ref_4742"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4743"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4744"><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>callerContext</var> be the <emu-xref href="#running-execution-context" id="_ref_4745"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Let <var>kind</var> be <var>F</var>.<var class="field">[[ConstructorKind]]</var>.</li><li>If <var>kind</var> is <emu-const>base</emu-const>, then<ol><li>Let <var>thisArgument</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_4746"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(<var>newTarget</var>, <emu-val>"%Object.prototype%"</emu-val>).</li></ol></li><li>Let <var>calleeContext</var> be <emu-xref aoid="PrepareForOrdinaryCall" id="_ref_4747"><a href="ordinary-and-exotic-objects-behaviours.html#sec-prepareforordinarycall">PrepareForOrdinaryCall</a></emu-xref>(<var>F</var>, <var>newTarget</var>).</li><li><emu-xref href="#assert" id="_ref_4748"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>calleeContext</var> is now the <emu-xref href="#running-execution-context" id="_ref_4749"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If <var>kind</var> is <emu-const>base</emu-const>, then<ol><li>Perform <emu-xref aoid="OrdinaryCallBindThis" id="_ref_4750"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycallbindthis">OrdinaryCallBindThis</a></emu-xref>(<var>F</var>, <var>calleeContext</var>, <var>thisArgument</var>).</li><li>Let <var>initializeResult</var> be <emu-xref aoid="Completion" id="_ref_4751"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="InitializeInstanceElements" id="_ref_4752"><a href="abstract-operations.html#sec-initializeinstanceelements" class="e-user-code">InitializeInstanceElements</a></emu-xref>(<var>thisArgument</var>, <var>F</var>)).</li><li>If <var>initializeResult</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_4753"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Remove <var>calleeContext</var> from the <emu-xref href="#execution-context-stack" id="_ref_4754"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> and restore <var>callerContext</var> as the <emu-xref href="#running-execution-context" id="_ref_4755"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Return ?&nbsp;<var>initializeResult</var>.</li></ol></li></ol></li><li>Let <var>constructorEnv</var> be the LexicalEnvironment of <var>calleeContext</var>.</li><li>Let <var>result</var> be <emu-xref aoid="Completion" id="_ref_4756"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="OrdinaryCallEvaluateBody" id="_ref_4757"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycallevaluatebody" class="e-user-code">OrdinaryCallEvaluateBody</a></emu-xref>(<var>F</var>, <var>argumentsList</var>)).</li><li>Remove <var>calleeContext</var> from the <emu-xref href="#execution-context-stack" id="_ref_4758"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> and restore <var>callerContext</var> as the <emu-xref href="#running-execution-context" id="_ref_4759"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If <var>result</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4760"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>, then<ol><li>Return ?&nbsp;<var>result</var>.</li></ol></li><li><emu-xref href="#assert" id="_ref_4761"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>result</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4762"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">return completion</a></emu-xref>.</li><li>If <var>result</var>.<var class="field">[[Value]]</var> <emu-xref href="#sec-object-type" id="_ref_4763"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>, return <var>result</var>.<var class="field">[[Value]]</var>.</li><li>If <var>kind</var> is <emu-const>base</emu-const>, return <var>thisArgument</var>.</li><li>If <var>result</var>.<var class="field">[[Value]]</var> is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>thisBinding</var> be ?&nbsp;<var>constructorEnv</var>.<emu-xref aoid="GetThisBinding" id="_ref_4764"><a href="executable-code-and-execution-contexts.html#abstract-getthisbinding">GetThisBinding</a></emu-xref>().</li><li><emu-xref href="#assert" id="_ref_4765"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>thisBinding</var> <emu-xref href="#sec-object-type" id="_ref_4766"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Return <var>thisBinding</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-ordinaryfunctioncreate" type="abstract operation" oldids="sec-functionallocate,sec-functioninitialize,sec-functioncreate,sec-generatorfunctioncreate,sec-asyncgeneratorfunctioncreate,sec-async-functions-abstract-operations-async-function-create" aoid="OrdinaryFunctionCreate"><span id="sec-async-functions-abstract-operations-async-function-create"></span><span id="sec-asyncgeneratorfunctioncreate"></span><span id="sec-generatorfunctioncreate"></span><span id="sec-functioncreate"></span><span id="sec-functioninitialize"></span><span id="sec-functionallocate"></span>
<h1><span class="secnum">10.2.3</span> OrdinaryFunctionCreate ( <var>functionPrototype</var>, <var>sourceText</var>, <var>ParameterList</var>, <var>Body</var>, <var>thisMode</var>, <var>env</var>, <var>privateEnv</var> )</h1>
<p>The abstract operation OrdinaryFunctionCreate takes arguments <var>functionPrototype</var> (an Object), <var>sourceText</var> (a sequence of Unicode code points), <var>ParameterList</var> (a <emu-xref href="#sec-syntactic-grammar" id="_ref_4767"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>Body</var> (a <emu-xref href="#sec-syntactic-grammar" id="_ref_4768"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>thisMode</var> (<emu-const>lexical-this</emu-const> or <emu-const>non-lexical-this</emu-const>), <var>env</var> (an <emu-xref href="#sec-environment-records" id="_ref_4769"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>), and <var>privateEnv</var> (a <emu-xref href="#privateenvironment-record" id="_ref_4770"><a href="executable-code-and-execution-contexts.html#privateenvironment-record">PrivateEnvironment Record</a></emu-xref> or <emu-val>null</emu-val>) and returns an ECMAScript <emu-xref href="#function-object" id="_ref_4771"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>. It is used to specify the runtime creation of a new function with a default <var class="field">[[Call]]</var> internal method and no <var class="field">[[Construct]]</var> internal method (although one may be subsequently added by an operation such as <emu-xref aoid="MakeConstructor" id="_ref_4772"><a href="ordinary-and-exotic-objects-behaviours.html#sec-makeconstructor">MakeConstructor</a></emu-xref>). <var>sourceText</var> is the source text of the syntactic definition of the function to be created. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>internalSlotsList</var> be the internal slots listed in <emu-xref href="#table-internal-slots-of-ecmascript-function-objects" id="_ref_282"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-ecmascript-function-objects">Table 25</a></emu-xref>.</li><li>Let <var>F</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_4773"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<var>functionPrototype</var>, <var>internalSlotsList</var>).</li><li>Set <var>F</var>.<var class="field">[[Call]]</var> to the definition specified in <emu-xref href="#sec-ecmascript-function-objects-call-thisargument-argumentslist" id="_ref_283"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ecmascript-function-objects-call-thisargument-argumentslist">10.2.1</a></emu-xref>.</li><li>Set <var>F</var>.<var class="field">[[SourceText]]</var> to <var>sourceText</var>.</li><li>Set <var>F</var>.<var class="field">[[FormalParameters]]</var> to <var>ParameterList</var>.</li><li>Set <var>F</var>.<var class="field">[[ECMAScriptCode]]</var> to <var>Body</var>.</li><li>Let <var>Strict</var> be <emu-xref aoid="IsStrict" id="_ref_4774"><a href="ecmascript-language-source-code.html#sec-isstrict">IsStrict</a></emu-xref>(<var>Body</var>).</li><li>Set <var>F</var>.<var class="field">[[Strict]]</var> to <var>Strict</var>.</li><li>If <var>thisMode</var> is <emu-const>lexical-this</emu-const>, set <var>F</var>.<var class="field">[[ThisMode]]</var> to <emu-const>lexical</emu-const>.</li><li>Else if <var>Strict</var> is <emu-val>true</emu-val>, set <var>F</var>.<var class="field">[[ThisMode]]</var> to <emu-const>strict</emu-const>.</li><li>Else, set <var>F</var>.<var class="field">[[ThisMode]]</var> to <emu-const>global</emu-const>.</li><li>Set <var>F</var>.<var class="field">[[IsClassConstructor]]</var> to <emu-val>false</emu-val>.</li><li>Set <var>F</var>.<var class="field">[[Environment]]</var> to <var>env</var>.</li><li>Set <var>F</var>.<var class="field">[[PrivateEnvironment]]</var> to <var>privateEnv</var>.</li><li>Set <var>F</var>.<var class="field">[[ScriptOrModule]]</var> to <emu-xref aoid="GetActiveScriptOrModule" id="_ref_4775"><a href="executable-code-and-execution-contexts.html#sec-getactivescriptormodule">GetActiveScriptOrModule</a></emu-xref>().</li><li>Set <var>F</var>.<var class="field">[[Realm]]</var> to <emu-xref href="#current-realm" id="_ref_4776"><a href="executable-code-and-execution-contexts.html#current-realm">the current Realm Record</a></emu-xref>.</li><li>Set <var>F</var>.<var class="field">[[HomeObject]]</var> to <emu-val>undefined</emu-val>.</li><li>Set <var>F</var>.<var class="field">[[Fields]]</var> to a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4777"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Set <var>F</var>.<var class="field">[[PrivateMethods]]</var> to a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4778"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Set <var>F</var>.<var class="field">[[ClassFieldInitializerName]]</var> to <emu-const>empty</emu-const>.</li><li>Let <var>len</var> be the <emu-xref aoid="ExpectedArgumentCount" id="_ref_4779"><a href="ecmascript-language-functions-and-classes.html#sec-static-semantics-expectedargumentcount">ExpectedArgumentCount</a></emu-xref> of <var>ParameterList</var>.</li><li>Perform <emu-xref aoid="SetFunctionLength" id="_ref_4780"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionlength">SetFunctionLength</a></emu-xref>(<var>F</var>, <var>len</var>).</li><li>Return <var>F</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-addrestrictedfunctionproperties" type="abstract operation" aoid="AddRestrictedFunctionProperties">
<h1><span class="secnum">10.2.4</span> AddRestrictedFunctionProperties ( <var>F</var>, <var>realm</var> )</h1>
<p>The abstract operation AddRestrictedFunctionProperties takes arguments <var>F</var> (a <emu-xref href="#function-object" id="_ref_4781"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>realm</var> (a <emu-xref href="#realm-record" id="_ref_4782"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>) and returns <emu-const>unused</emu-const>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4783"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>realm</var>.<var class="field">[[Intrinsics]]</var>.[[<emu-xref href="#sec-%throwtypeerror%" id="_ref_4784"><a href="ordinary-and-exotic-objects-behaviours.html#sec-%throwtypeerror%">%ThrowTypeError%</a></emu-xref>]] exists and has been initialized.</li><li>Let <var>thrower</var> be <var>realm</var>.<var class="field">[[Intrinsics]]</var>.[[<emu-xref href="#sec-%throwtypeerror%" id="_ref_4785"><a href="ordinary-and-exotic-objects-behaviours.html#sec-%throwtypeerror%">%ThrowTypeError%</a></emu-xref>]].</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4786"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>F</var>, <emu-val>"caller"</emu-val>, PropertyDescriptor { <var class="field">[[Get]]</var>: <var>thrower</var>, <var class="field">[[Set]]</var>: <var>thrower</var>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4787"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>F</var>, <emu-val>"arguments"</emu-val>, PropertyDescriptor { <var class="field">[[Get]]</var>: <var>thrower</var>, <var class="field">[[Set]]</var>: <var>thrower</var>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
<emu-clause id="sec-%throwtypeerror%" type="built-in function">
<h1><span class="secnum">10.2.4.1</span> %ThrowTypeError% ( )</h1>
<p>This function is the <dfn tabindex="-1">%ThrowTypeError%</dfn> intrinsic object.</p>
<p>It is an anonymous built-in <emu-xref href="#function-object" id="_ref_4788"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> that is defined once for each <emu-xref href="#realm" id="_ref_4789"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
<p>The value of the <var class="field">[[Extensible]]</var> internal slot of this function is <emu-val>false</emu-val>.</p>
<p>The <emu-val>"length"</emu-val> property of this function 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>
<p>The <emu-val>"name"</emu-val> property of this function 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-makeconstructor" type="abstract operation" aoid="MakeConstructor">
<h1><span class="secnum">10.2.5</span> MakeConstructor ( <var>F</var> [ , <var>writablePrototype</var> [ , <var>prototype</var> ] ] )</h1>
<p>The abstract operation MakeConstructor takes argument <var>F</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4790"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> or a built-in <emu-xref href="#function-object" id="_ref_4791"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and optional arguments <var>writablePrototype</var> (a Boolean) and <var>prototype</var> (an Object) and returns <emu-const>unused</emu-const>. It converts <var>F</var> into a <emu-xref href="#constructor" id="_ref_4792"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>F</var> is an ECMAScript <emu-xref href="#function-object" id="_ref_4793"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>, then<ol><li><emu-xref href="#assert" id="_ref_4794"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsConstructor" id="_ref_4795"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>F</var>) is <emu-val>false</emu-val>.</li><li><emu-xref href="#assert" id="_ref_4796"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>F</var> is an extensible object that does not have a <emu-val>"prototype"</emu-val> own property.</li><li>Set <var>F</var>.<var class="field">[[Construct]]</var> to the definition specified in <emu-xref href="#sec-ecmascript-function-objects-construct-argumentslist-newtarget" id="_ref_284"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ecmascript-function-objects-construct-argumentslist-newtarget">10.2.2</a></emu-xref>.</li></ol></li><li>Else,<ol><li>Set <var>F</var>.<var class="field">[[Construct]]</var> to the definition specified in <emu-xref href="#sec-built-in-function-objects-construct-argumentslist-newtarget" id="_ref_285"><a href="ordinary-and-exotic-objects-behaviours.html#sec-built-in-function-objects-construct-argumentslist-newtarget">10.3.2</a></emu-xref>.</li></ol></li><li>Set <var>F</var>.<var class="field">[[ConstructorKind]]</var> to <emu-const>base</emu-const>.</li><li>If <var>writablePrototype</var> is not present, set <var>writablePrototype</var> to <emu-val>true</emu-val>.</li><li>If <var>prototype</var> is not present, then<ol><li>Set <var>prototype</var> to <emu-xref aoid="OrdinaryObjectCreate" id="_ref_4797"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_4798"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4799"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>prototype</var>, <emu-val>"constructor"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <var>F</var>, <var class="field">[[Writable]]</var>: <var>writablePrototype</var>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}).</li></ol></li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4800"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>F</var>, <emu-val>"prototype"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <var>prototype</var>, <var class="field">[[Writable]]</var>: <var>writablePrototype</var>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val>&nbsp;}).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-makeclassconstructor" type="abstract operation" aoid="MakeClassConstructor">
<h1><span class="secnum">10.2.6</span> MakeClassConstructor ( <var>F</var> )</h1>
<p>The abstract operation MakeClassConstructor takes argument <var>F</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4801"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and returns <emu-const>unused</emu-const>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4802"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>F</var>.<var class="field">[[IsClassConstructor]]</var> is <emu-val>false</emu-val>.</li><li>Set <var>F</var>.<var class="field">[[IsClassConstructor]]</var> to <emu-val>true</emu-val>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-makemethod" type="abstract operation" aoid="MakeMethod">
<h1><span class="secnum">10.2.7</span> MakeMethod ( <var>F</var>, <var>homeObject</var> )</h1>
<p>The abstract operation MakeMethod takes arguments <var>F</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4803"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>homeObject</var> (an Object) and returns <emu-const>unused</emu-const>. It configures <var>F</var> as a method. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4804"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>homeObject</var> is an <emu-xref href="#ordinary-object" id="_ref_4805"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li><li>Set <var>F</var>.<var class="field">[[HomeObject]]</var> to <var>homeObject</var>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-definemethodproperty" oldids="sec-createmethodproperty" type="abstract operation" aoid="DefineMethodProperty"><span id="sec-createmethodproperty"></span>
<h1><span class="secnum">10.2.8</span> DefineMethodProperty ( <var>homeObject</var>, <var>key</var>, <var>closure</var>, <var>enumerable</var> )</h1>
<p>The abstract operation DefineMethodProperty takes arguments <var>homeObject</var> (an Object), <var>key</var> (a <emu-xref href="#property-key" id="_ref_4806"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> or <emu-xref href="#sec-private-names" id="_ref_4807"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref>), <var>closure</var> (a <emu-xref href="#function-object" id="_ref_4808"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>), and <var>enumerable</var> (a Boolean) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4809"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-privateelement-specification-type" id="_ref_4810"><a href="ecmascript-data-types-and-values.html#sec-privateelement-specification-type">PrivateElement</a></emu-xref> or <emu-const>unused</emu-const>, or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_4811"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4812"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>homeObject</var> is an ordinary, extensible object.</li><li>If <var>key</var> is a <emu-xref href="#sec-private-names" id="_ref_4813"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref>, return <emu-xref href="#sec-privateelement-specification-type" id="_ref_4814"><a href="ecmascript-data-types-and-values.html#sec-privateelement-specification-type">PrivateElement</a></emu-xref> { <var class="field">[[Key]]</var>: <var>key</var>, <var class="field">[[Kind]]</var>: <emu-const>method</emu-const>, <var class="field">[[Value]]</var>: <var>closure</var>&nbsp;}.</li><li>Let <var>desc</var> be the PropertyDescriptor { <var class="field">[[Value]]</var>: <var>closure</var>, <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <var>enumerable</var>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}.</li><li>Perform ?&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4815"><a href="abstract-operations.html#sec-definepropertyorthrow" class="e-user-code">DefinePropertyOrThrow</a></emu-xref>(<var>homeObject</var>, <var>key</var>, <var>desc</var>).</li><li>NOTE: <emu-xref aoid="DefinePropertyOrThrow" id="_ref_4816"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref> only returns an <emu-xref href="#sec-completion-record-specification-type" id="_ref_4817"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> when attempting to define a class static method whose <var>key</var> is <emu-val>"prototype"</emu-val>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-setfunctionname" type="abstract operation" aoid="SetFunctionName">
<h1><span class="secnum">10.2.9</span> SetFunctionName ( <var>F</var>, <var>name</var> [ , <var>prefix</var> ] )</h1>
<p>The abstract operation SetFunctionName takes arguments <var>F</var> (a <emu-xref href="#function-object" id="_ref_4818"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>name</var> (a <emu-xref href="#property-key" id="_ref_4819"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> or <emu-xref href="#sec-private-names" id="_ref_4820"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref>) and optional argument <var>prefix</var> (a String) and returns <emu-const>unused</emu-const>. It adds a <emu-val>"name"</emu-val> property to <var>F</var>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4821"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>F</var> is an extensible object that does not have a <emu-val>"name"</emu-val> own property.</li><li>If <var>name</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_4822"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, then<ol><li>Let <var>description</var> be <var>name</var>.<var class="field">[[Description]]</var>.</li><li>If <var>description</var> is <emu-val>undefined</emu-val>, set <var>name</var> to the empty String.</li><li>Else, set <var>name</var> to the <emu-xref href="#string-concatenation" id="_ref_4823"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-val>"["</emu-val>, <var>description</var>, and <emu-val>"]"</emu-val>.</li></ol></li><li>Else if <var>name</var> is a <emu-xref href="#sec-private-names" id="_ref_4824"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref>, then<ol><li>Set <var>name</var> to <var>name</var>.<var class="field">[[Description]]</var>.</li></ol></li><li>If <var>F</var> has an <var class="field">[[InitialName]]</var> internal slot, then<ol><li>Set <var>F</var>.<var class="field">[[InitialName]]</var> to <var>name</var>.</li></ol></li><li>If <var>prefix</var> is present, then<ol><li>Set <var>name</var> to the <emu-xref href="#string-concatenation" id="_ref_4825"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>prefix</var>, the code unit 0x0020 (SPACE), and <var>name</var>.</li><li>If <var>F</var> has an <var class="field">[[InitialName]]</var> internal slot, then<ol><li>NOTE: The choice in the following step is made independently each time this Abstract Operation is invoked.</li><li>Optionally, set <var>F</var>.<var class="field">[[InitialName]]</var> to <var>name</var>.</li></ol></li></ol></li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4826"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>F</var>, <emu-val>"name"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <var>name</var>, <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>true</emu-val>&nbsp;}).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-setfunctionlength" type="abstract operation" aoid="SetFunctionLength">
<h1><span class="secnum">10.2.10</span> SetFunctionLength ( <var>F</var>, <var>length</var> )</h1>
<p>The abstract operation SetFunctionLength takes arguments <var>F</var> (a <emu-xref href="#function-object" id="_ref_4827"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>length</var> (a non-negative <emu-xref href="#integer" id="_ref_4828"><a href="notational-conventions.html#integer">integer</a></emu-xref> or +∞) and returns <emu-const>unused</emu-const>. It adds a <emu-val>"length"</emu-val> property to <var>F</var>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_4829"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>F</var> is an extensible object that does not have a <emu-val>"length"</emu-val> own property.</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_4830"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>F</var>, <emu-val>"length"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <emu-xref aoid="𝔽" id="_ref_4831"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>length</var>), <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>true</emu-val>&nbsp;}).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-functiondeclarationinstantiation" type="abstract operation" oldids="sec-web-compat-functiondeclarationinstantiation" aoid="FunctionDeclarationInstantiation"><span id="sec-web-compat-functiondeclarationinstantiation"></span>
<h1><span class="secnum">10.2.11</span> FunctionDeclarationInstantiation ( <var>func</var>, <var>argumentsList</var> )</h1>
<p>The abstract operation FunctionDeclarationInstantiation takes arguments <var>func</var> (an ECMAScript <emu-xref href="#function-object" id="_ref_4832"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4833"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4834"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4835"><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_4836"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. <var>func</var> is the <emu-xref href="#function-object" id="_ref_4837"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> for which the <emu-xref href="#sec-execution-contexts" id="_ref_4838"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref> is being established.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>When an <emu-xref href="#sec-execution-contexts" id="_ref_4839"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref> is established for evaluating an ECMAScript function a new <emu-xref href="#sec-function-environment-records" id="_ref_4840"><a href="executable-code-and-execution-contexts.html#sec-function-environment-records">Function Environment Record</a></emu-xref> is created and bindings for each formal parameter are instantiated in that <emu-xref href="#sec-environment-records" id="_ref_4841"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>. Each declaration in the function body is also instantiated. If the function's formal parameters do not include any default value initializers then the body declarations are instantiated in the same <emu-xref href="#sec-environment-records" id="_ref_4842"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> as the parameters. If default value parameter initializers exist, a second <emu-xref href="#sec-environment-records" id="_ref_4843"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is created for the body declarations. Formal parameters and functions are initialized as part of FunctionDeclarationInstantiation. All other bindings are initialized during evaluation of the function body.</p>
</div></emu-note>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>calleeContext</var> be the <emu-xref href="#running-execution-context" id="_ref_4845"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Let <var>code</var> be <var>func</var>.<var class="field">[[ECMAScriptCode]]</var>.</li><li>Let <var>strict</var> be <var>func</var>.<var class="field">[[Strict]]</var>.</li><li>Let <var>formals</var> be <var>func</var>.<var class="field">[[FormalParameters]]</var>.</li><li>Let <var>parameterNames</var> be the <emu-xref aoid="BoundNames" id="_ref_4846"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>formals</var>.</li><li>If <var>parameterNames</var> has any duplicate entries, let <var>hasDuplicates</var> be <emu-val>true</emu-val>; else let <var>hasDuplicates</var> be <emu-val>false</emu-val>.</li><li>Let <var>simpleParameterList</var> be <emu-xref aoid="IsSimpleParameterList" id="_ref_4847"><a href="ecmascript-language-functions-and-classes.html#sec-static-semantics-issimpleparameterlist">IsSimpleParameterList</a></emu-xref> of <var>formals</var>.</li><li>Let <var>hasParameterExpressions</var> be <emu-xref aoid="ContainsExpression" id="_ref_4848"><a href="ecmascript-language-functions-and-classes.html#sec-static-semantics-containsexpression">ContainsExpression</a></emu-xref> of <var>formals</var>.</li><li>Let <var>varNames</var> be the <emu-xref aoid="VarDeclaredNames" id="_ref_4849"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <var>code</var>.</li><li>Let <var>varDeclarations</var> be the <emu-xref aoid="VarScopedDeclarations" id="_ref_4850"><a href="syntax-directed-operations.html#sec-static-semantics-varscopeddeclarations">VarScopedDeclarations</a></emu-xref> of <var>code</var>.</li><li>Let <var>lexicalNames</var> be the <emu-xref aoid="LexicallyDeclaredNames" id="_ref_4851"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallydeclarednames">LexicallyDeclaredNames</a></emu-xref> of <var>code</var>.</li><li>Let <var>functionNames</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4852"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Let <var>functionsToInitialize</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4853"><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_4854"><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 neither a <emu-nt id="_ref_19509"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> nor a <emu-nt id="_ref_19510"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt> nor a <emu-nt id="_ref_19511"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>, then<ol><li><emu-xref href="#assert" id="_ref_4855"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>d</var> is either a <emu-nt id="_ref_19512"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>, a <emu-nt id="_ref_19513"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorDeclaration">GeneratorDeclaration</a></emu-nt>, an <emu-nt id="_ref_19514"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionDeclaration">AsyncFunctionDeclaration</a></emu-nt>, or an <emu-nt id="_ref_19515"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorDeclaration">AsyncGeneratorDeclaration</a></emu-nt>.</li><li>Let <var>fn</var> be the sole element of the <emu-xref aoid="BoundNames" id="_ref_4856"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>d</var>.</li><li>If <var>functionNames</var> does not contain <var>fn</var>, then<ol><li>Insert <var>fn</var> as the first element of <var>functionNames</var>.</li><li>NOTE: If there are multiple function declarations for the same name, the last declaration is used.</li><li>Insert <var>d</var> as the first element of <var>functionsToInitialize</var>.</li></ol></li></ol></li></ol></li><li>Let <var>argumentsObjectNeeded</var> be <emu-val>true</emu-val>.</li><li>If <var>func</var>.<var class="field">[[ThisMode]]</var> is <emu-const>lexical</emu-const>, then<ol><li>NOTE: Arrow functions never have an arguments object.</li><li>Set <var>argumentsObjectNeeded</var> to <emu-val>false</emu-val>.</li></ol></li><li>Else if <var>parameterNames</var> contains <emu-val>"arguments"</emu-val>, then<ol><li>Set <var>argumentsObjectNeeded</var> to <emu-val>false</emu-val>.</li></ol></li><li>Else if <var>hasParameterExpressions</var> is <emu-val>false</emu-val>, then<ol><li>If <var>functionNames</var> contains <emu-val>"arguments"</emu-val> or <var>lexicalNames</var> contains <emu-val>"arguments"</emu-val>, then<ol><li>Set <var>argumentsObjectNeeded</var> to <emu-val>false</emu-val>.</li></ol></li></ol></li><li>If <var>strict</var> is <emu-val>true</emu-val> or <var>hasParameterExpressions</var> is <emu-val>false</emu-val>, then<ol><li>NOTE: Only a single <emu-xref href="#sec-environment-records" id="_ref_4857"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is needed for the parameters, since calls to <code>eval</code> in <emu-xref href="#sec-strict-mode-code" id="_ref_4858"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref> cannot create new bindings which are visible outside of the <code>eval</code>.</li><li>Let <var>env</var> be the LexicalEnvironment of <var>calleeContext</var>.</li></ol></li><li>Else,<ol><li>NOTE: A separate <emu-xref href="#sec-environment-records" id="_ref_4859"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is needed to ensure that bindings created by <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_4860"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref> calls in the formal parameter list are outside the environment where parameters are declared.</li><li>Let <var>calleeEnv</var> be the LexicalEnvironment of <var>calleeContext</var>.</li><li>Let <var>env</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_4861"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>calleeEnv</var>).</li><li><emu-xref href="#assert" id="_ref_4862"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The VariableEnvironment of <var>calleeContext</var> and <var>calleeEnv</var> are the same <emu-xref href="#sec-environment-records" id="_ref_4863"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>.</li><li>Set the LexicalEnvironment of <var>calleeContext</var> to <var>env</var>.</li></ol></li><li>For each String <var>paramName</var> of <var>parameterNames</var>, do<ol><li>Let <var>alreadyDeclared</var> be !&nbsp;<var>env</var>.<emu-xref aoid="HasBinding" id="_ref_4864"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>paramName</var>).</li><li>NOTE: <emu-xref href="#early-error" id="_ref_4865"><a href="error-handling-and-language-extensions.html#early-error">Early errors</a></emu-xref> ensure that duplicate parameter names can only occur in <emu-xref href="#non-strict-function" id="_ref_4866"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref> that do not have parameter default values or rest parameters.</li><li>If <var>alreadyDeclared</var> is <emu-val>false</emu-val>, then<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_4867"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>paramName</var>, <emu-val>false</emu-val>).</li><li>If <var>hasDuplicates</var> is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="InitializeBinding" id="_ref_4868"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>paramName</var>, <emu-val>undefined</emu-val>).</li></ol></li></ol></li></ol></li><li>If <var>argumentsObjectNeeded</var> is <emu-val>true</emu-val>, then<ol><li>If <var>strict</var> is <emu-val>true</emu-val> or <var>simpleParameterList</var> is <emu-val>false</emu-val>, then<ol><li>Let <var>ao</var> be <emu-xref aoid="CreateUnmappedArgumentsObject" id="_ref_4869"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createunmappedargumentsobject">CreateUnmappedArgumentsObject</a></emu-xref>(<var>argumentsList</var>).</li></ol></li><li>Else,<ol><li>NOTE: A mapped argument object is only provided for <emu-xref href="#non-strict-function" id="_ref_4870"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref> that don't have a rest parameter, any parameter default value initializers, or any destructured parameters.</li><li>Let <var>ao</var> be <emu-xref aoid="CreateMappedArgumentsObject" id="_ref_4871"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createmappedargumentsobject">CreateMappedArgumentsObject</a></emu-xref>(<var>func</var>, <var>formals</var>, <var>argumentsList</var>, <var>env</var>).</li></ol></li><li>If <var>strict</var> is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateImmutableBinding" id="_ref_4872"><a href="executable-code-and-execution-contexts.html#abstract-createimmutablebinding">CreateImmutableBinding</a></emu-xref>(<emu-val>"arguments"</emu-val>, <emu-val>false</emu-val>).</li><li>NOTE: In <emu-xref href="#sec-strict-mode-code" id="_ref_4873"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref> <emu-xref href="#early-error" id="_ref_4874"><a href="error-handling-and-language-extensions.html#early-error">early errors</a></emu-xref> prevent attempting to assign to this binding, so its mutability is not observable.</li></ol></li><li>Else,<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_4875"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<emu-val>"arguments"</emu-val>, <emu-val>false</emu-val>).</li></ol></li><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="InitializeBinding" id="_ref_4876"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<emu-val>"arguments"</emu-val>, <var>ao</var>).</li><li>Let <var>parameterBindings</var> be the <emu-xref href="#list-concatenation" id="_ref_4877"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>parameterNames</var> and « <emu-val>"arguments"</emu-val>&nbsp;».</li></ol></li><li>Else,<ol><li>Let <var>parameterBindings</var> be <var>parameterNames</var>.</li></ol></li><li>Let <var>iteratorRecord</var> be <emu-xref aoid="CreateListIteratorRecord" id="_ref_4878"><a href="abstract-operations.html#sec-createlistiteratorRecord">CreateListIteratorRecord</a></emu-xref>(<var>argumentsList</var>).</li><li>If <var>hasDuplicates</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>usedEnv</var> be <emu-val>undefined</emu-val>.</li></ol></li><li>Else,<ol><li>Let <var>usedEnv</var> be <var>env</var>.</li></ol></li><li>NOTE: The following step cannot return a <emu-xref aoid="ReturnCompletion" id="_ref_4879"><a href="ecmascript-data-types-and-values.html#sec-returncompletion">ReturnCompletion</a></emu-xref> because the only way such a completion can arise in expression position is by use of <emu-nt id="_ref_19516"><a href="ecmascript-language-functions-and-classes.html#prod-YieldExpression">YieldExpression</a></emu-nt>, which is forbidden in parameter lists by Early Error rules in <emu-xref href="#sec-generator-function-definitions-static-semantics-early-errors" id="_ref_286"><a href="ecmascript-language-functions-and-classes.html#sec-generator-function-definitions-static-semantics-early-errors">15.5.1</a></emu-xref> and <emu-xref href="#sec-async-generator-function-definitions-static-semantics-early-errors" id="_ref_287"><a href="ecmascript-language-functions-and-classes.html#sec-async-generator-function-definitions-static-semantics-early-errors">15.6.1</a></emu-xref>.</li><li>Perform ?&nbsp;<emu-xref aoid="IteratorBindingInitialization" id="_ref_4880"><a href="syntax-directed-operations.html#sec-runtime-semantics-iteratorbindinginitialization" class="e-user-code">IteratorBindingInitialization</a></emu-xref> of <var>formals</var> with arguments <var>iteratorRecord</var> and <var>usedEnv</var>.</li><li>If <var>hasParameterExpressions</var> is <emu-val>false</emu-val>, then<ol><li>NOTE: Only a single <emu-xref href="#sec-environment-records" id="_ref_4881"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is needed for the parameters and top-level vars.</li><li>Let <var>instantiatedVarNames</var> be a copy of the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4882"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> <var>parameterBindings</var>.</li><li>For each element <var>n</var> of <var>varNames</var>, do<ol><li>If <var>instantiatedVarNames</var> does not contain <var>n</var>, then<ol><li>Append <var>n</var> to <var>instantiatedVarNames</var>.</li><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_4883"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>n</var>, <emu-val>false</emu-val>).</li><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="InitializeBinding" id="_ref_4884"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>n</var>, <emu-val>undefined</emu-val>).</li></ol></li></ol></li><li>Let <var>varEnv</var> be <var>env</var>.</li></ol></li><li>Else,<ol><li>NOTE: A separate <emu-xref href="#sec-environment-records" id="_ref_4885"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is needed to ensure that closures created by expressions in the formal parameter list do not have visibility of declarations in the function body.</li><li>Let <var>varEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_4886"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>env</var>).</li><li>Set the VariableEnvironment of <var>calleeContext</var> to <var>varEnv</var>.</li><li>Let <var>instantiatedVarNames</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4887"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>n</var> of <var>varNames</var>, do<ol><li>If <var>instantiatedVarNames</var> does not contain <var>n</var>, then<ol><li>Append <var>n</var> to <var>instantiatedVarNames</var>.</li><li>Perform !&nbsp;<var>varEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_4888"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>n</var>, <emu-val>false</emu-val>).</li><li>If <var>parameterBindings</var> does not contain <var>n</var>, or if <var>functionNames</var> contains <var>n</var>, then<ol><li>Let <var>initialValue</var> be <emu-val>undefined</emu-val>.</li></ol></li><li>Else,<ol><li>Let <var>initialValue</var> be !&nbsp;<var>env</var>.<emu-xref aoid="GetBindingValue" id="_ref_4889"><a href="executable-code-and-execution-contexts.html#abstract-getbindingvalue">GetBindingValue</a></emu-xref>(<var>n</var>, <emu-val>false</emu-val>).</li></ol></li><li>Perform !&nbsp;<var>varEnv</var>.<emu-xref aoid="InitializeBinding" id="_ref_4890"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>n</var>, <var>initialValue</var>).</li><li>NOTE: A var with the same name as a formal parameter initially has the same value as the corresponding initialized parameter.</li></ol></li></ol></li></ol></li><li>If <var>strict</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>lexEnv</var> be <var>varEnv</var>.</li></ol></li><li>Else,<ol><li id="step-functiondeclarationinstantiation-web-compat-insertion-point" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_4844"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref></div>If the <emu-xref href="#host" id="_ref_4891"><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_288"><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>For each <emu-nt id="_ref_19517"><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_19518"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> of any <emu-nt id="_ref_19519"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>, <emu-nt id="_ref_19520"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt>, or <emu-nt id="_ref_19521"><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a></emu-nt> <var>x</var> such that <var>code</var> <emu-xref aoid="Contains" id="_ref_4892"><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_4893"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of the <emu-nt id="_ref_19522"><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_19523"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt> <var>f</var> with a <emu-nt id="_ref_19524"><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_19525"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt> would not produce any Early Errors for <var>func</var> and <var>parameterNames</var> does not contain <var>F</var>, then<ol><li>NOTE: A var binding for <var>F</var> is only instantiated here if it is neither a VarDeclaredName, the name of a formal parameter, or another <emu-nt id="_ref_19526"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>.</li><li>If <var>instantiatedVarNames</var> does not contain <var>F</var> and <var>F</var> is not <emu-val>"arguments"</emu-val>, then<ol><li>Perform !&nbsp;<var>varEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_4894"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>F</var>, <emu-val>false</emu-val>).</li><li>Perform !&nbsp;<var>varEnv</var>.<emu-xref aoid="InitializeBinding" id="_ref_4895"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>F</var>, <emu-val>undefined</emu-val>).</li><li>Append <var>F</var> to <var>instantiatedVarNames</var>.</li></ol></li><li id="step-functiondeclarationinstantiation-alt-funcdecl-eval">When the <emu-nt id="_ref_19527"><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_19528"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt> <emu-xref aoid="Evaluation" id="_ref_4896"><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_289"><a href="ecmascript-language-functions-and-classes.html#sec-function-definitions-runtime-semantics-evaluation">15.2.6</a></emu-xref>:<ol><li>Let <var>fEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_4897"><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_4898"><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 !&nbsp;<var>bEnv</var>.<emu-xref aoid="GetBindingValue" id="_ref_4899"><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 !&nbsp;<var>fEnv</var>.<emu-xref aoid="SetMutableBinding" id="_ref_4900"><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>).</li><li>Return <emu-const>unused</emu-const>.</li></ol></li></ol></li></ol></li></ol></li><li>Let <var>lexEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_4901"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>varEnv</var>).</li><li>NOTE: <emu-xref href="#non-strict-function" id="_ref_4902"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">Non-strict functions</a></emu-xref> use a separate <emu-xref href="#sec-environment-records" id="_ref_4903"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> for top-level lexical declarations so that a <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_4904"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref> can determine whether any var scoped declarations introduced by the eval code conflict with pre-existing top-level lexically scoped declarations. This is not needed for <emu-xref href="#strict-function" id="_ref_4905"><a href="ordinary-and-exotic-objects-behaviours.html#strict-function">strict functions</a></emu-xref> because a strict <emu-xref href="#sec-function-calls-runtime-semantics-evaluation" id="_ref_4906"><a href="ecmascript-language-expressions.html#sec-function-calls-runtime-semantics-evaluation">direct eval</a></emu-xref> always places all declarations into a new <emu-xref href="#sec-environment-records" id="_ref_4907"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>.</li></ol></li><li>Set the LexicalEnvironment of <var>calleeContext</var> to <var>lexEnv</var>.</li><li>Let <var>lexDeclarations</var> be the <emu-xref aoid="LexicallyScopedDeclarations" id="_ref_4908"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallyscopeddeclarations">LexicallyScopedDeclarations</a></emu-xref> of <var>code</var>.</li><li>For each element <var>d</var> of <var>lexDeclarations</var>, do<ol><li>NOTE: A lexically declared name cannot be the same as a function/generator declaration, formal parameter, or a var name. 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_4909"><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_4910"><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 !&nbsp;<var>lexEnv</var>.<emu-xref aoid="CreateImmutableBinding" id="_ref_4911"><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 !&nbsp;<var>lexEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_4912"><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>Let <var>privateEnv</var> be the PrivateEnvironment of <var>calleeContext</var>.</li><li>For each <emu-xref href="#sec-syntactic-grammar" id="_ref_4913"><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_4914"><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_4915"><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>Perform !&nbsp;<var>varEnv</var>.<emu-xref aoid="SetMutableBinding" id="_ref_4916"><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><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-built-in-function-objects">
<h1><span class="secnum">10.3</span> Built-in Function Objects</h1>
<p>A built-in <emu-xref href="#function-object" id="_ref_4917"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> is an <emu-xref href="#ordinary-object" id="_ref_4918"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>; it must satisfy the requirements for <emu-xref href="#ordinary-object" id="_ref_4919"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> set out in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_290"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>.</p>
<p>In addition to the internal slots required of every <emu-xref href="#ordinary-object" id="_ref_4920"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> (see <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_291"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>), a built-in <emu-xref href="#function-object" id="_ref_4921"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> must also have the following internal slots:</p>
<ul>
<li><var class="field">[[Realm]]</var>, a <emu-xref href="#realm-record" id="_ref_4922"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref> that represents the <emu-xref href="#realm" id="_ref_4923"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> in which the function was created.</li>
<li><var class="field">[[InitialName]]</var>, a String that is the initial name of the function. It is used by <emu-xref href="#sec-function.prototype.tostring" id="_ref_292"><a href="fundamental-objects.html#sec-function.prototype.tostring">20.2.3.5</a></emu-xref>.</li>
<li><var class="field">[[Async]]</var>, a Boolean that indicates whether the function has async function call and construct behaviour in <emu-xref aoid="BuiltinCallOrConstruct" id="_ref_4924"><a href="ordinary-and-exotic-objects-behaviours.html#sec-builtincallorconstruct">BuiltinCallOrConstruct</a></emu-xref>.</li>
</ul>
<p>The initial value of a built-in <emu-xref href="#function-object" id="_ref_4925"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>'s <var class="field">[[Prototype]]</var> internal slot is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_4926"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>, unless otherwise specified.</p>
<p>A built-in <emu-xref href="#function-object" id="_ref_4927"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> must have a <var class="field">[[Call]]</var> internal method that conforms to the definition in <emu-xref href="#sec-built-in-function-objects-call-thisargument-argumentslist" id="_ref_293"><a href="ordinary-and-exotic-objects-behaviours.html#sec-built-in-function-objects-call-thisargument-argumentslist">10.3.1</a></emu-xref>.</p>
<p>A built-in <emu-xref href="#function-object" id="_ref_4928"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> has a <var class="field">[[Construct]]</var> internal method if and only if it is described as a “<emu-xref href="#constructor" id="_ref_4929"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>”, or some algorithm in this specification explicitly sets its <var class="field">[[Construct]]</var> internal method. Such a <var class="field">[[Construct]]</var> internal method must conform to the definition in <emu-xref href="#sec-built-in-function-objects-construct-argumentslist-newtarget" id="_ref_294"><a href="ordinary-and-exotic-objects-behaviours.html#sec-built-in-function-objects-construct-argumentslist-newtarget">10.3.2</a></emu-xref>.</p>
<p>An implementation may provide additional built-in <emu-xref href="#function-object" id="_ref_4930"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> that are not defined in this specification.</p>
<emu-clause id="sec-built-in-function-objects-call-thisargument-argumentslist" type="internal method">
<h1><span class="secnum">10.3.1</span> <var class="field">[[Call]]</var> ( <var>thisArgument</var>, <var>argumentsList</var> )</h1>
<p>The <var class="field">[[Call]]</var> internal method of a built-in <emu-xref href="#function-object" id="_ref_4931"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> <var>F</var> takes arguments <var>thisArgument</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4932"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4933"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4934"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4935"><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_4936"><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_4937"><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>Return ?&nbsp;<emu-xref aoid="BuiltinCallOrConstruct" id="_ref_4938"><a href="ordinary-and-exotic-objects-behaviours.html#sec-builtincallorconstruct" class="e-user-code">BuiltinCallOrConstruct</a></emu-xref>(<var>F</var>, <var>thisArgument</var>, <var>argumentsList</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-built-in-function-objects-construct-argumentslist-newtarget" type="internal method">
<h1><span class="secnum">10.3.2</span> <var class="field">[[Construct]]</var> ( <var>argumentsList</var>, <var>newTarget</var> )</h1>
<p>The <var class="field">[[Construct]]</var> internal method of a built-in <emu-xref href="#function-object" id="_ref_4939"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> <var>F</var> (when the method is present) takes arguments <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4940"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4941"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and <var>newTarget</var> (a <emu-xref href="#constructor" id="_ref_4942"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4943"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4944"><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>result</var> be ?&nbsp;<emu-xref aoid="BuiltinCallOrConstruct" id="_ref_4945"><a href="ordinary-and-exotic-objects-behaviours.html#sec-builtincallorconstruct" class="e-user-code">BuiltinCallOrConstruct</a></emu-xref>(<var>F</var>, <emu-const>uninitialized</emu-const>, <var>argumentsList</var>, <var>newTarget</var>).</li><li><emu-xref href="#assert" id="_ref_4946"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>result</var> <emu-xref href="#sec-object-type" id="_ref_4947"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Return <var>result</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-builtincallorconstruct" type="abstract operation" aoid="BuiltinCallOrConstruct">
<h1><span class="secnum">10.3.3</span> BuiltinCallOrConstruct ( <var>F</var>, <var>thisArgument</var>, <var>argumentsList</var>, <var>newTarget</var> )</h1>
<p>The abstract operation BuiltinCallOrConstruct takes arguments <var>F</var> (a built-in <emu-xref href="#function-object" id="_ref_4948"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>), <var>thisArgument</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_4949"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or <emu-const>uninitialized</emu-const>), <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4950"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_4951"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>), and <var>newTarget</var> (a <emu-xref href="#constructor" id="_ref_4952"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> or <emu-val>undefined</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_4953"><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_4954"><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_4955"><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>callerContext</var> be the <emu-xref href="#running-execution-context" id="_ref_4956"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If <var>callerContext</var> is not already suspended, suspend <var>callerContext</var>.</li><li>Let <var>calleeContext</var> be a new <emu-xref href="#sec-execution-contexts" id="_ref_4957"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref>.</li><li>Set the Function of <var>calleeContext</var> to <var>F</var>.</li><li>Let <var>calleeRealm</var> be <var>F</var>.<var class="field">[[Realm]]</var>.</li><li>Set the <emu-xref href="#realm" id="_ref_4958"><a href="executable-code-and-execution-contexts.html#realm">Realm</a></emu-xref> of <var>calleeContext</var> to <var>calleeRealm</var>.</li><li>Set the ScriptOrModule of <var>calleeContext</var> to <emu-val>null</emu-val>.</li><li>Perform any necessary <emu-xref href="#implementation-defined" id="_ref_4959"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> initialization of <var>calleeContext</var>.</li><li>Push <var>calleeContext</var> onto the <emu-xref href="#execution-context-stack" id="_ref_4960"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref>; <var>calleeContext</var> is now the <emu-xref href="#running-execution-context" id="_ref_4961"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>If <var>F</var>.<var class="field">[[Async]]</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>promiseCapability</var> be !&nbsp;<emu-xref aoid="NewPromiseCapability" id="_ref_4962"><a href="control-abstraction-objects.html#sec-newpromisecapability">NewPromiseCapability</a></emu-xref>(<emu-xref href="#sec-promise-constructor" id="_ref_4963"><a href="control-abstraction-objects.html#sec-promise-constructor">%Promise%</a></emu-xref>).</li><li>Let <var>resultsClosure</var> be a new <emu-xref href="#sec-abstract-closure" id="_ref_4964"><a href="ecmascript-data-types-and-values.html#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures <var>F</var>, <var>thisArgument</var>, <var>argumentsList</var>, and <var>newTarget</var> and performs the following steps when called:<ol><li>Let <var>result</var> be the <emu-xref href="#sec-completion-record-specification-type" id="_ref_4965"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> that is <span class="e-user-code">the result of evaluating</span> <var>F</var> in a manner that conforms to the specification of <var>F</var>. If <var>thisArgument</var> is <emu-const>uninitialized</emu-const>, the <emu-val>this</emu-val> value is uninitialized; else <var>thisArgument</var> provides the <emu-val>this</emu-val> value. <var>argumentsList</var> provides the named parameters. <var>newTarget</var> provides the NewTarget value.</li><li>NOTE: If <var>F</var> is defined in this document, “the specification of <var>F</var>” is the behaviour specified for it via algorithm steps or other means.</li><li>Return <emu-xref aoid="Completion" id="_ref_4966"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<var>result</var>).</li></ol></li><li>Perform <emu-xref aoid="AsyncFunctionStart" id="_ref_4967"><a href="control-abstraction-objects.html#sec-async-functions-abstract-operations-async-function-start" class="e-user-code">AsyncFunctionStart</a></emu-xref>(<var>promiseCapability</var>, <var>resultsClosure</var>).</li><li>Remove <var>calleeContext</var> from the <emu-xref href="#execution-context-stack" id="_ref_4968"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> and restore <var>callerContext</var> as the <emu-xref href="#running-execution-context" id="_ref_4969"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></li><li id="step-call-builtin-function-result">Let <var>result</var> be the <emu-xref href="#sec-completion-record-specification-type" id="_ref_4970"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> that is <span class="e-user-code">the result of evaluating</span> <var>F</var> in a manner that conforms to the specification of <var>F</var>. If <var>thisArgument</var> is <emu-const>uninitialized</emu-const>, the <emu-val>this</emu-val> value is uninitialized; else <var>thisArgument</var> provides the <emu-val>this</emu-val> value. <var>argumentsList</var> provides the named parameters. <var>newTarget</var> provides the NewTarget value.</li><li>NOTE: If <var>F</var> is defined in this document, “the specification of <var>F</var>” is the behaviour specified for it via algorithm steps or other means.</li><li>Remove <var>calleeContext</var> from the <emu-xref href="#execution-context-stack" id="_ref_4971"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> and restore <var>callerContext</var> as the <emu-xref href="#running-execution-context" id="_ref_4972"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>.</li><li>Return ?&nbsp;<var>result</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>When <var>calleeContext</var> is removed from the <emu-xref href="#execution-context-stack" id="_ref_4973"><a href="executable-code-and-execution-contexts.html#execution-context-stack">execution context stack</a></emu-xref> it must not be destroyed if it has been suspended and retained by an accessible Generator for later resumption.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-createbuiltinfunction" type="abstract operation" aoid="CreateBuiltinFunction">
<h1><span class="secnum">10.3.4</span> CreateBuiltinFunction ( <var>behaviour</var>, <var>length</var>, <var>name</var>, <var>additionalInternalSlotsList</var> [ , <var>realm</var> [ , <var>prototype</var> [ , <var>prefix</var> [ , <var>async</var> ] ] ] ] )</h1>
<p>The abstract operation CreateBuiltinFunction takes arguments <var>behaviour</var> (an <emu-xref href="#sec-abstract-closure" id="_ref_4974"><a href="ecmascript-data-types-and-values.html#sec-abstract-closure">Abstract Closure</a></emu-xref>, a set of algorithm steps, or some other definition of a function's behaviour provided in this specification), <var>length</var> (a non-negative <emu-xref href="#integer" id="_ref_4975"><a href="notational-conventions.html#integer">integer</a></emu-xref> or +∞), <var>name</var> (a <emu-xref href="#property-key" id="_ref_4976"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> or a <emu-xref href="#sec-private-names" id="_ref_4977"><a href="ecmascript-data-types-and-values.html#sec-private-names">Private Name</a></emu-xref>), and <var>additionalInternalSlotsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4978"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of names of internal slots) and optional arguments <var>realm</var> (a <emu-xref href="#realm-record" id="_ref_4979"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>), <var>prototype</var> (an Object or <emu-val>null</emu-val>), <var>prefix</var> (a String), and <var>async</var> (a Boolean) and returns a built-in <emu-xref href="#function-object" id="_ref_4980"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>. <var>additionalInternalSlotsList</var> contains the names of additional internal slots that must be defined as part of the object. This operation creates a built-in <emu-xref href="#function-object" id="_ref_4981"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>realm</var> is not present, set <var>realm</var> to <emu-xref href="#current-realm" id="_ref_4982"><a href="executable-code-and-execution-contexts.html#current-realm">the current Realm Record</a></emu-xref>.</li><li>If <var>prototype</var> is not present, set <var>prototype</var> to <var>realm</var>.<var class="field">[[Intrinsics]]</var>.[[<emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_4983"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>]].</li><li>If <var>async</var> is not present, set <var>async</var> to <emu-val>false</emu-val>.</li><li>Let <var>internalSlotsList</var> be a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_4984"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> containing the names of all the internal slots that <emu-xref href="#sec-built-in-function-objects" id="_ref_295"><a href="ordinary-and-exotic-objects-behaviours.html#sec-built-in-function-objects">10.3</a></emu-xref> requires for the built-in <emu-xref href="#function-object" id="_ref_4985"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> that is about to be created.</li><li>Append to <var>internalSlotsList</var> the elements of <var>additionalInternalSlotsList</var>.</li><li>Let <var>func</var> be a new built-in <emu-xref href="#function-object" id="_ref_4986"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> that, when called, performs the action described by <var>behaviour</var> using the provided arguments as the values of the corresponding parameters specified by <var>behaviour</var>. The new <emu-xref href="#function-object" id="_ref_4987"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> has internal slots whose names are the elements of <var>internalSlotsList</var>, and an <var class="field">[[InitialName]]</var> internal slot.</li><li>Set <var>func</var>.<var class="field">[[Async]]</var> to <var>async</var>.</li><li>Set <var>func</var>.<var class="field">[[Prototype]]</var> to <var>prototype</var>.</li><li>Set <var>func</var>.<var class="field">[[Extensible]]</var> to <emu-val>true</emu-val>.</li><li>Set <var>func</var>.<var class="field">[[Realm]]</var> to <var>realm</var>.</li><li>Set <var>func</var>.<var class="field">[[InitialName]]</var> to <emu-val>null</emu-val>.</li><li>Perform <emu-xref aoid="SetFunctionLength" id="_ref_4988"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionlength">SetFunctionLength</a></emu-xref>(<var>func</var>, <var>length</var>).</li><li>If <var>prefix</var> is not present, then<ol><li>Perform <emu-xref aoid="SetFunctionName" id="_ref_4989"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionname">SetFunctionName</a></emu-xref>(<var>func</var>, <var>name</var>).</li></ol></li><li>Else,<ol><li>Perform <emu-xref aoid="SetFunctionName" id="_ref_4990"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionname">SetFunctionName</a></emu-xref>(<var>func</var>, <var>name</var>, <var>prefix</var>).</li></ol></li><li>Return <var>func</var>.</li></ol></emu-alg>
<p>Each built-in function defined in this specification is created by calling the CreateBuiltinFunction abstract operation.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-built-in-exotic-object-internal-methods-and-slots">
<h1><span class="secnum">10.4</span> Built-in Exotic Object Internal Methods and Slots</h1>
<p>This specification defines several kinds of built-in <emu-xref href="#exotic-object" id="_ref_4991"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref>. These objects generally behave similar to <emu-xref href="#ordinary-object" id="_ref_4992"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> except for a few specific situations. The following <emu-xref href="#exotic-object" id="_ref_4993"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref> use the <emu-xref href="#ordinary-object" id="_ref_4994"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> internal methods except where it is explicitly specified otherwise below:</p>
<emu-clause id="sec-bound-function-exotic-objects">
<h1><span class="secnum">10.4.1</span> Bound Function Exotic Objects</h1>
<p>A <emu-xref href="#bound-function-exotic-object" id="_ref_4995"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref> is an <emu-xref href="#exotic-object" id="_ref_4996"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> that wraps another <emu-xref href="#function-object" id="_ref_4997"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>. A <emu-xref href="#bound-function-exotic-object" id="_ref_4998"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref> is callable (it has a <var class="field">[[Call]]</var> internal method and may have a <var class="field">[[Construct]]</var> internal method). Calling a <emu-xref href="#bound-function-exotic-object" id="_ref_4999"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref> generally results in a call of its wrapped function.</p>
<p>An object is a <dfn id="bound-function-exotic-object" variants="bound function exotic objects" tabindex="-1">bound function exotic object</dfn> if its <var class="field">[[Call]]</var> and (if applicable) <var class="field">[[Construct]]</var> internal methods use the following implementations, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_296"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>. These methods are installed in <emu-xref aoid="BoundFunctionCreate" id="_ref_5000"><a href="ordinary-and-exotic-objects-behaviours.html#sec-boundfunctioncreate">BoundFunctionCreate</a></emu-xref>.</p>
<p><emu-xref href="#bound-function-exotic-object" id="_ref_5001"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">Bound function exotic objects</a></emu-xref> do not have the internal slots of ECMAScript <emu-xref href="#function-object" id="_ref_5002"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> listed in <emu-xref href="#table-internal-slots-of-ecmascript-function-objects" id="_ref_297"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-ecmascript-function-objects">Table 25</a></emu-xref>. Instead they have the internal slots listed in <emu-xref href="#table-internal-slots-of-bound-function-exotic-objects" id="_ref_298"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-bound-function-exotic-objects">Table 26</a></emu-xref>, in addition to <var class="field">[[Prototype]]</var> and <var class="field">[[Extensible]]</var>.</p>
<emu-table id="table-internal-slots-of-bound-function-exotic-objects" caption="Internal Slots of Bound Function Exotic Objects" oldids="table-28"><figure><figcaption>Table 26: Internal Slots of Bound Function Exotic Objects</figcaption><span id="table-28"></span>
<table>
<thead>
<tr>
<th>
Internal Slot
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[BoundTargetFunction]]</var>
</td>
<td>
a callable Object
</td>
<td>
The wrapped <emu-xref href="#function-object" id="_ref_5003"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>.
</td>
</tr>
<tr>
<td>
<var class="field">[[BoundThis]]</var>
</td>
<td>
an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5004"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>
</td>
<td>
The value that is always passed as the <emu-val>this</emu-val> value when calling the wrapped function.
</td>
</tr>
<tr>
<td>
<var class="field">[[BoundArguments]]</var>
</td>
<td>
a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5005"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5006"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>
</td>
<td>
A list of values whose elements are used as the first arguments to any call to the wrapped function.
</td>
</tr>
</tbody></table>
</figure></emu-table>
<emu-clause id="sec-bound-function-exotic-objects-call-thisargument-argumentslist" type="internal method">
<h1><span class="secnum">10.4.1.1</span> <var class="field">[[Call]]</var> ( <var>thisArgument</var>, <var>argumentsList</var> )</h1>
<p>The <var class="field">[[Call]]</var> internal method of a <emu-xref href="#bound-function-exotic-object" id="_ref_5007"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref> <var>F</var> takes arguments <var>thisArgument</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5008"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5009"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5010"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5011"><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_5012"><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_5013"><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>target</var> be <var>F</var>.<var class="field">[[BoundTargetFunction]]</var>.</li><li>Let <var>boundThis</var> be <var>F</var>.<var class="field">[[BoundThis]]</var>.</li><li>Let <var>boundArgs</var> be <var>F</var>.<var class="field">[[BoundArguments]]</var>.</li><li>Let <var>args</var> be the <emu-xref href="#list-concatenation" id="_ref_5014"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>boundArgs</var> and <var>argumentsList</var>.</li><li>Return ?&nbsp;<emu-xref aoid="Call" id="_ref_5015"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>target</var>, <var>boundThis</var>, <var>args</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-bound-function-exotic-objects-construct-argumentslist-newtarget" type="internal method">
<h1><span class="secnum">10.4.1.2</span> <var class="field">[[Construct]]</var> ( <var>argumentsList</var>, <var>newTarget</var> )</h1>
<p>The <var class="field">[[Construct]]</var> internal method of a <emu-xref href="#bound-function-exotic-object" id="_ref_5016"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref> <var>F</var> takes arguments <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5017"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5018"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and <var>newTarget</var> (a <emu-xref href="#constructor" id="_ref_5019"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5020"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5021"><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>target</var> be <var>F</var>.<var class="field">[[BoundTargetFunction]]</var>.</li><li><emu-xref href="#assert" id="_ref_5022"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsConstructor" id="_ref_5023"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>target</var>) is <emu-val>true</emu-val>.</li><li>Let <var>boundArgs</var> be <var>F</var>.<var class="field">[[BoundArguments]]</var>.</li><li>Let <var>args</var> be the <emu-xref href="#list-concatenation" id="_ref_5024"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>boundArgs</var> and <var>argumentsList</var>.</li><li>If <emu-xref aoid="SameValue" id="_ref_5025"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>F</var>, <var>newTarget</var>) is <emu-val>true</emu-val>, set <var>newTarget</var> to <var>target</var>.</li><li>Return ?&nbsp;<emu-xref aoid="Construct" id="_ref_5026"><a href="abstract-operations.html#sec-construct" class="e-user-code">Construct</a></emu-xref>(<var>target</var>, <var>args</var>, <var>newTarget</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-boundfunctioncreate" type="abstract operation" aoid="BoundFunctionCreate">
<h1><span class="secnum">10.4.1.3</span> BoundFunctionCreate ( <var>targetFunction</var>, <var>boundThis</var>, <var>boundArgs</var> )</h1>
<p>The abstract operation BoundFunctionCreate takes arguments <var>targetFunction</var> (a <emu-xref href="#function-object" id="_ref_5027"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>), <var>boundThis</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5028"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>boundArgs</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5029"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5030"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5031"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#function-object" id="_ref_5032"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5033"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It is used to specify the creation of new <emu-xref href="#bound-function-exotic-object" id="_ref_5034"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic objects</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>proto</var> be ?&nbsp;<span class="e-user-code"><var>targetFunction</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>Let <var>internalSlotsList</var> be the <emu-xref href="#list-concatenation" id="_ref_5035"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of « <var class="field">[[Prototype]]</var>, <var class="field">[[Extensible]]</var>&nbsp;» and the internal slots listed in <emu-xref href="#table-internal-slots-of-bound-function-exotic-objects" id="_ref_299"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-bound-function-exotic-objects">Table 26</a></emu-xref>.</li><li>Let <var>obj</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5036"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref>(<var>internalSlotsList</var>).</li><li>Set <var>obj</var>.<var class="field">[[Prototype]]</var> to <var>proto</var>.</li><li>Set <var>obj</var>.<var class="field">[[Call]]</var> as specified in <emu-xref href="#sec-bound-function-exotic-objects-call-thisargument-argumentslist" id="_ref_300"><a href="ordinary-and-exotic-objects-behaviours.html#sec-bound-function-exotic-objects-call-thisargument-argumentslist">10.4.1.1</a></emu-xref>.</li><li>If <emu-xref aoid="IsConstructor" id="_ref_5037"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>targetFunction</var>) is <emu-val>true</emu-val>, then<ol><li>Set <var>obj</var>.<var class="field">[[Construct]]</var> as specified in <emu-xref href="#sec-bound-function-exotic-objects-construct-argumentslist-newtarget" id="_ref_301"><a href="ordinary-and-exotic-objects-behaviours.html#sec-bound-function-exotic-objects-construct-argumentslist-newtarget">10.4.1.2</a></emu-xref>.</li></ol></li><li>Set <var>obj</var>.<var class="field">[[BoundTargetFunction]]</var> to <var>targetFunction</var>.</li><li>Set <var>obj</var>.<var class="field">[[BoundThis]]</var> to <var>boundThis</var>.</li><li>Set <var>obj</var>.<var class="field">[[BoundArguments]]</var> to <var>boundArgs</var>.</li><li>Return <var>obj</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-array-exotic-objects">
<h1><span class="secnum">10.4.2</span> Array Exotic Objects</h1>
<p>An Array is an <emu-xref href="#exotic-object" id="_ref_5038"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> that gives special treatment to <emu-xref href="#array-index" id="_ref_5039"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> <emu-xref href="#property-key" id="_ref_5040"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> (see <emu-xref href="#sec-object-type" id="_ref_302"><a href="ecmascript-data-types-and-values.html#sec-object-type">6.1.7</a></emu-xref>). A property whose <emu-xref href="#property-name" id="_ref_5041"><a href="ecmascript-data-types-and-values.html#property-name">property name</a></emu-xref> is an <emu-xref href="#array-index" id="_ref_5042"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> is also called an <em>element</em>. Every Array has a non-configurable <emu-val>"length"</emu-val> property whose value is always a non-negative <emu-xref href="#integral-number" id="_ref_5043"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> whose <emu-xref href="#mathematical-value" id="_ref_5044"><a href="notational-conventions.html#mathematical-value">mathematical value</a></emu-xref> is strictly less than 2<sup>32</sup>. The value of the <emu-val>"length"</emu-val> property is numerically greater than the name of every own property whose name is an <emu-xref href="#array-index" id="_ref_5045"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>; whenever an own property of an Array is created or changed, other properties are adjusted as necessary to maintain this invariant. Specifically, whenever an own property is added whose name is an <emu-xref href="#array-index" id="_ref_5046"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>, the value of the <emu-val>"length"</emu-val> property is changed, if necessary, to be one more than the numeric value of that <emu-xref href="#array-index" id="_ref_5047"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>; and whenever the value of the <emu-val>"length"</emu-val> property is changed, every own property whose name is an <emu-xref href="#array-index" id="_ref_5048"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> whose value is not smaller than the new length is deleted. This constraint applies only to own properties of an Array and is unaffected by <emu-val>"length"</emu-val> or <emu-xref href="#array-index" id="_ref_5049"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> properties that may be inherited from its prototypes.</p>
<p>An object is an <dfn id="array-exotic-object" variants="Array exotic objects" tabindex="-1">Array exotic object</dfn> (or simply, an Array) if its <var class="field">[[DefineOwnProperty]]</var> internal method uses the following implementation, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_303"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>. These methods are installed in <emu-xref aoid="ArrayCreate" id="_ref_5050"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arraycreate">ArrayCreate</a></emu-xref>.</p>
<emu-clause id="sec-array-exotic-objects-defineownproperty-p-desc" type="internal method">
<h1><span class="secnum">10.4.2.1</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of an <emu-xref href="#array-exotic-object" id="_ref_5051"><a href="ordinary-and-exotic-objects-behaviours.html#array-exotic-object">Array exotic object</a></emu-xref> <var>A</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5052"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5053"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5054"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5055"><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>If <var>P</var> is <emu-val>"length"</emu-val>, return ?&nbsp;<emu-xref aoid="ArraySetLength" id="_ref_5056"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arraysetlength" class="e-user-code">ArraySetLength</a></emu-xref>(<var>A</var>, <var>Desc</var>).</li><li>If <var>P</var> is an <emu-xref href="#array-index" id="_ref_5057"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>, then<ol><li>Let <var>lengthDesc</var> be <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_5058"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>).</li><li><emu-xref href="#assert" id="_ref_5059"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lengthDesc</var> is not <emu-val>undefined</emu-val>.</li><li><emu-xref href="#assert" id="_ref_5060"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsDataDescriptor" id="_ref_5061"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>lengthDesc</var>) is <emu-val>true</emu-val>.</li><li><emu-xref href="#assert" id="_ref_5062"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lengthDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>.</li><li>Let <var>length</var> be <var>lengthDesc</var>.<var class="field">[[Value]]</var>.</li><li><emu-xref href="#assert" id="_ref_5063"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>length</var> is a non-negative <emu-xref href="#integral-number" id="_ref_5064"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>.</li><li>Let <var>index</var> be !&nbsp;<emu-xref aoid="ToUint32" id="_ref_5065"><a href="abstract-operations.html#sec-touint32">ToUint32</a></emu-xref>(<var>P</var>).</li><li>If <var>index</var><var>length</var> and <var>lengthDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>succeeded</var> be !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5066"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <var>P</var>, <var>Desc</var>).</li><li>If <var>succeeded</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>index</var><var>length</var>, then<ol><li>Set <var>lengthDesc</var>.<var class="field">[[Value]]</var> to <var>index</var> + <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>Set <var>succeeded</var> to !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5067"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, <var>lengthDesc</var>).</li><li><emu-xref href="#assert" id="_ref_5068"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>succeeded</var> is <emu-val>true</emu-val>.</li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></li><li>Return ?&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5069"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty" class="e-user-code">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <var>P</var>, <var>Desc</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-arraycreate" type="abstract operation" aoid="ArrayCreate">
<h1><span class="secnum">10.4.2.2</span> ArrayCreate ( <var>length</var> [ , <var>proto</var> ] )</h1>
<p>The abstract operation ArrayCreate takes argument <var>length</var> (a non-negative <emu-xref href="#integer" id="_ref_5070"><a href="notational-conventions.html#integer">integer</a></emu-xref>) and optional argument <var>proto</var> (an Object) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5071"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#array-exotic-object" id="_ref_5072"><a href="ordinary-and-exotic-objects-behaviours.html#array-exotic-object">Array exotic object</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5073"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It is used to specify the creation of new Arrays. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>length</var> &gt; 2<sup>32</sup> - 1, throw a <emu-val>RangeError</emu-val> exception.</li><li>If <var>proto</var> is not present, set <var>proto</var> to <emu-xref href="#sec-properties-of-the-array-prototype-object" id="_ref_5074"><a href="indexed-collections.html#sec-properties-of-the-array-prototype-object">%Array.prototype%</a></emu-xref>.</li><li>Let <var>A</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5075"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref><var class="field">[[Prototype]]</var>, <var class="field">[[Extensible]]</var>&nbsp;»).</li><li>Set <var>A</var>.<var class="field">[[Prototype]]</var> to <var>proto</var>.</li><li>Set <var>A</var>.<var class="field">[[DefineOwnProperty]]</var> as specified in <emu-xref href="#sec-array-exotic-objects-defineownproperty-p-desc" id="_ref_304"><a href="ordinary-and-exotic-objects-behaviours.html#sec-array-exotic-objects-defineownproperty-p-desc">10.4.2.1</a></emu-xref>.</li><li>Perform !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5076"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <emu-xref aoid="𝔽" id="_ref_5077"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>length</var>), <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>false</emu-val>&nbsp;}).</li><li>Return <var>A</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-arrayspeciescreate" type="abstract operation" aoid="ArraySpeciesCreate">
<h1><span class="secnum">10.4.2.3</span> ArraySpeciesCreate ( <var>originalArray</var>, <var>length</var> )</h1>
<p>The abstract operation ArraySpeciesCreate takes arguments <var>originalArray</var> (an Object) and <var>length</var> (a non-negative <emu-xref href="#integer" id="_ref_5078"><a href="notational-conventions.html#integer">integer</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5079"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5080"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It is used to specify the creation of a new Array or similar object using a <emu-xref href="#constructor" id="_ref_5081"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> function that is derived from <var>originalArray</var>. It does not enforce that the <emu-xref href="#constructor" id="_ref_5082"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> function returns an Array. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>isArray</var> be ?&nbsp;<emu-xref aoid="IsArray" id="_ref_5083"><a href="abstract-operations.html#sec-isarray">IsArray</a></emu-xref>(<var>originalArray</var>).</li><li>If <var>isArray</var> is <emu-val>false</emu-val>, return ?&nbsp;<emu-xref aoid="ArrayCreate" id="_ref_5084"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arraycreate">ArrayCreate</a></emu-xref>(<var>length</var>).</li><li>Let <var>C</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_5085"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>originalArray</var>, <emu-val>"constructor"</emu-val>).</li><li>If <emu-xref aoid="IsConstructor" id="_ref_5086"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>C</var>) is <emu-val>true</emu-val>, then<ol><li>Let <var>thisRealm</var> be <emu-xref href="#current-realm" id="_ref_5087"><a href="executable-code-and-execution-contexts.html#current-realm">the current Realm Record</a></emu-xref>.</li><li>Let <var>realmC</var> be ?&nbsp;<emu-xref aoid="GetFunctionRealm" id="_ref_5088"><a href="abstract-operations.html#sec-getfunctionrealm">GetFunctionRealm</a></emu-xref>(<var>C</var>).</li><li>If <var>thisRealm</var> and <var>realmC</var> are not the same <emu-xref href="#realm-record" id="_ref_5089"><a href="executable-code-and-execution-contexts.html#realm-record">Realm Record</a></emu-xref>, then<ol><li>If <emu-xref aoid="SameValue" id="_ref_5090"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>C</var>, <var>realmC</var>.<var class="field">[[Intrinsics]]</var>.[[<emu-xref href="#sec-array-constructor" id="_ref_5091"><a href="indexed-collections.html#sec-array-constructor">%Array%</a></emu-xref>]]) is <emu-val>true</emu-val>, set <var>C</var> to <emu-val>undefined</emu-val>.</li></ol></li></ol></li><li>If <var>C</var> <emu-xref href="#sec-object-type" id="_ref_5092"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>, then<ol><li>Set <var>C</var> to ?&nbsp;<emu-xref aoid="Get" id="_ref_5093"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>C</var>, <emu-xref href="#sec-well-known-symbols" id="_ref_5094"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.species%</a></emu-xref>).</li><li>If <var>C</var> is <emu-val>null</emu-val>, set <var>C</var> to <emu-val>undefined</emu-val>.</li></ol></li><li>If <var>C</var> is <emu-val>undefined</emu-val>, return ?&nbsp;<emu-xref aoid="ArrayCreate" id="_ref_5095"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arraycreate">ArrayCreate</a></emu-xref>(<var>length</var>).</li><li>If <emu-xref aoid="IsConstructor" id="_ref_5096"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>C</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return ?&nbsp;<emu-xref aoid="Construct" id="_ref_5097"><a href="abstract-operations.html#sec-construct" class="e-user-code">Construct</a></emu-xref>(<var>C</var>, « <emu-xref aoid="𝔽" id="_ref_5098"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>length</var>)&nbsp;»).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>originalArray</var> was created using the standard built-in Array <emu-xref href="#constructor" id="_ref_5099"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> for a <emu-xref href="#realm" id="_ref_5100"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> that is not the <emu-xref href="#realm" id="_ref_5101"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> of the <emu-xref href="#running-execution-context" id="_ref_5102"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>, then a new Array is created using the <emu-xref href="#realm" id="_ref_5103"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref> of the <emu-xref href="#running-execution-context" id="_ref_5104"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>. This maintains compatibility with Web browsers that have historically had that behaviour for the <code>Array.prototype</code> methods that now are defined using ArraySpeciesCreate.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-arraysetlength" type="abstract operation" aoid="ArraySetLength">
<h1><span class="secnum">10.4.2.4</span> ArraySetLength ( <var>A</var>, <var>Desc</var> )</h1>
<p>The abstract operation ArraySetLength takes arguments <var>A</var> (an Array) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5105"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5106"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5107"><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>If <var>Desc</var> does not have a <var class="field">[[Value]]</var> field, then<ol><li>Return !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5108"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, <var>Desc</var>).</li></ol></li><li>Let <var>newLenDesc</var> be a copy of <var>Desc</var>.</li><li id="step-arraysetlength-newlen">Let <var>newLen</var> be ?&nbsp;<emu-xref aoid="ToUint32" id="_ref_5109"><a href="abstract-operations.html#sec-touint32" class="e-user-code">ToUint32</a></emu-xref>(<var>Desc</var>.<var class="field">[[Value]]</var>).</li><li id="step-arraysetlength-numberlen">Let <var>numberLen</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_5110"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>Desc</var>.<var class="field">[[Value]]</var>).</li><li>If <emu-xref aoid="SameValueZero" id="_ref_5111"><a href="abstract-operations.html#sec-samevaluezero">SameValueZero</a></emu-xref>(<var>newLen</var>, <var>numberLen</var>) is <emu-val>false</emu-val>, throw a <emu-val>RangeError</emu-val> exception.</li><li>Set <var>newLenDesc</var>.<var class="field">[[Value]]</var> to <var>newLen</var>.</li><li>Let <var>oldLenDesc</var> be <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_5112"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>).</li><li><emu-xref href="#assert" id="_ref_5113"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>oldLenDesc</var> is not <emu-val>undefined</emu-val>.</li><li><emu-xref href="#assert" id="_ref_5114"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsDataDescriptor" id="_ref_5115"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>oldLenDesc</var>) is <emu-val>true</emu-val>.</li><li><emu-xref href="#assert" id="_ref_5116"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>oldLenDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>.</li><li>Let <var>oldLen</var> be <var>oldLenDesc</var>.<var class="field">[[Value]]</var>.</li><li>If <var>newLen</var><var>oldLen</var>, then<ol><li>Return !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5117"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, <var>newLenDesc</var>).</li></ol></li><li>If <var>oldLenDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>newLenDesc</var> does not have a <var class="field">[[Writable]]</var> field or <var>newLenDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>newWritable</var> be <emu-val>true</emu-val>.</li></ol></li><li>Else,<ol><li>NOTE: Setting the <var class="field">[[Writable]]</var> attribute to <emu-val>false</emu-val> is deferred in case any elements cannot be deleted.</li><li>Let <var>newWritable</var> be <emu-val>false</emu-val>.</li><li>Set <var>newLenDesc</var>.<var class="field">[[Writable]]</var> to <emu-val>true</emu-val>.</li></ol></li><li>Let <var>succeeded</var> be !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5118"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, <var>newLenDesc</var>).</li><li>If <var>succeeded</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>For each own <emu-xref href="#property-key" id="_ref_5119"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>A</var> such that <var>P</var> is an <emu-xref href="#array-index" id="_ref_5120"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> and !&nbsp;<emu-xref aoid="ToUint32" id="_ref_5121"><a href="abstract-operations.html#sec-touint32">ToUint32</a></emu-xref>(<var>P</var>) ≥ <var>newLen</var>, in descending numeric index order, do<ol><li>Let <var>deleteSucceeded</var> be !&nbsp;<var>A</var>.<var class="field">[[Delete]]</var>(<var>P</var>).</li><li>If <var>deleteSucceeded</var> is <emu-val>false</emu-val>, then<ol><li>Set <var>newLenDesc</var>.<var class="field">[[Value]]</var> to !&nbsp;<emu-xref aoid="ToUint32" id="_ref_5122"><a href="abstract-operations.html#sec-touint32">ToUint32</a></emu-xref>(<var>P</var>) + <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>newWritable</var> is <emu-val>false</emu-val>, set <var>newLenDesc</var>.<var class="field">[[Writable]]</var> to <emu-val>false</emu-val>.</li><li>Perform !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5123"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, <var>newLenDesc</var>).</li><li>Return <emu-val>false</emu-val>.</li></ol></li></ol></li><li>If <var>newWritable</var> is <emu-val>false</emu-val>, then<ol><li>Set <var>succeeded</var> to !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5124"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>A</var>, <emu-val>"length"</emu-val>, PropertyDescriptor { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>&nbsp;}).</li><li><emu-xref href="#assert" id="_ref_5125"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>succeeded</var> is <emu-val>true</emu-val>.</li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>In steps <emu-xref href="#step-arraysetlength-newlen" id="_ref_305"><a href="ordinary-and-exotic-objects-behaviours.html#step-arraysetlength-newlen">3</a></emu-xref> and <emu-xref href="#step-arraysetlength-numberlen" id="_ref_306"><a href="ordinary-and-exotic-objects-behaviours.html#step-arraysetlength-numberlen">4</a></emu-xref>, if <var>Desc</var>.<var class="field">[[Value]]</var> is an object then its <code>valueOf</code> method is called twice. This is legacy behaviour that was specified with this effect starting with the 2<sup>nd</sup> Edition of this specification.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-string-exotic-objects">
<h1><span class="secnum">10.4.3</span> String Exotic Objects</h1>
<p>A String object is an <emu-xref href="#exotic-object" id="_ref_5126"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> that encapsulates a String value and exposes virtual <emu-xref href="#integer-index" id="_ref_5127"><a href="ecmascript-data-types-and-values.html#integer-index">integer-indexed</a></emu-xref> <emu-xref href="#sec-object-type" id="_ref_5128"><a href="ecmascript-data-types-and-values.html#sec-object-type">data properties</a></emu-xref> corresponding to the individual code unit elements of the String value. <emu-xref href="#string-exotic-object" id="_ref_5129"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic objects</a></emu-xref> always have a <emu-xref href="#sec-object-type" id="_ref_5130"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref> named <emu-val>"length"</emu-val> whose value is the length of the encapsulated String value. Both the code unit <emu-xref href="#sec-object-type" id="_ref_5131"><a href="ecmascript-data-types-and-values.html#sec-object-type">data properties</a></emu-xref> and the <emu-val>"length"</emu-val> property are non-writable and non-configurable.</p>
<p>An object is a <dfn id="string-exotic-object" variants="String exotic objects" tabindex="-1">String exotic object</dfn> (or simply, a String object) if its <var class="field">[[GetOwnProperty]]</var>, <var class="field">[[DefineOwnProperty]]</var>, and <var class="field">[[OwnPropertyKeys]]</var> internal methods use the following implementations, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_307"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>. These methods are installed in <emu-xref aoid="StringCreate" id="_ref_5132"><a href="ordinary-and-exotic-objects-behaviours.html#sec-stringcreate">StringCreate</a></emu-xref>.</p>
<p><emu-xref href="#string-exotic-object" id="_ref_5133"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic objects</a></emu-xref> have the same internal slots as <emu-xref href="#ordinary-object" id="_ref_5134"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref>. They also have a <var class="field">[[StringData]]</var> internal slot.</p>
<emu-clause id="sec-string-exotic-objects-getownproperty-p" type="internal method">
<h1><span class="secnum">10.4.3.1</span> <var class="field">[[GetOwnProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[GetOwnProperty]]</var> internal method of a <emu-xref href="#string-exotic-object" id="_ref_5135"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic object</a></emu-xref> <var>S</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5136"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5137"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5138"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>desc</var> be <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_5139"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>S</var>, <var>P</var>).</li><li>If <var>desc</var> is not <emu-val>undefined</emu-val>, return <var>desc</var>.</li><li>Return <emu-xref aoid="StringGetOwnProperty" id="_ref_5140"><a href="ordinary-and-exotic-objects-behaviours.html#sec-stringgetownproperty">StringGetOwnProperty</a></emu-xref>(<var>S</var>, <var>P</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-string-exotic-objects-defineownproperty-p-desc" type="internal method">
<h1><span class="secnum">10.4.3.2</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of a <emu-xref href="#string-exotic-object" id="_ref_5141"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic object</a></emu-xref> <var>S</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5142"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5143"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5144"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>stringDesc</var> be <emu-xref aoid="StringGetOwnProperty" id="_ref_5145"><a href="ordinary-and-exotic-objects-behaviours.html#sec-stringgetownproperty">StringGetOwnProperty</a></emu-xref>(<var>S</var>, <var>P</var>).</li><li>If <var>stringDesc</var> is not <emu-val>undefined</emu-val>, then<ol><li>Let <var>extensible</var> be <var>S</var>.<var class="field">[[Extensible]]</var>.</li><li>Return <emu-xref aoid="IsCompatiblePropertyDescriptor" id="_ref_5146"><a href="ordinary-and-exotic-objects-behaviours.html#sec-iscompatiblepropertydescriptor">IsCompatiblePropertyDescriptor</a></emu-xref>(<var>extensible</var>, <var>Desc</var>, <var>stringDesc</var>).</li></ol></li><li>Return !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5147"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>S</var>, <var>P</var>, <var>Desc</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-string-exotic-objects-ownpropertykeys" type="internal method">
<h1><span class="secnum">10.4.3.3</span> <var class="field">[[OwnPropertyKeys]]</var> ( )</h1>
<p>The <var class="field">[[OwnPropertyKeys]]</var> internal method of a <emu-xref href="#string-exotic-object" id="_ref_5148"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic object</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5149"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5150"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_5151"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>keys</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5152"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Let <var>str</var> be <var>O</var>.<var class="field">[[StringData]]</var>.</li><li><emu-xref href="#assert" id="_ref_5153"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>str</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5154"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>.</li><li>Let <var>len</var> be the length of <var>str</var>.</li><li>For each <emu-xref href="#integer" id="_ref_5155"><a href="notational-conventions.html#integer">integer</a></emu-xref> <var>i</var> such that 0 ≤ <var>i</var> &lt; <var>len</var>, in ascending order, do<ol><li>Append !&nbsp;<emu-xref aoid="ToString" id="_ref_5156"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_5157"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>i</var>)) to <var>keys</var>.</li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_5158"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> is an <emu-xref href="#array-index" id="_ref_5159"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> and !&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_5160"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>P</var>) ≥ <var>len</var>, in ascending numeric index order, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_5161"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5162"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref> and <var>P</var> is not an <emu-xref href="#array-index" id="_ref_5163"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref>, in ascending chronological order of property creation, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_5164"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5165"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, in ascending chronological order of property creation, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>Return <var>keys</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-stringcreate" type="abstract operation" aoid="StringCreate">
<h1><span class="secnum">10.4.3.4</span> StringCreate ( <var>value</var>, <var>prototype</var> )</h1>
<p>The abstract operation StringCreate takes arguments <var>value</var> (a String) and <var>prototype</var> (an Object) and returns a <emu-xref href="#string-exotic-object" id="_ref_5166"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic object</a></emu-xref>. It is used to specify the creation of new <emu-xref href="#string-exotic-object" id="_ref_5167"><a href="ordinary-and-exotic-objects-behaviours.html#string-exotic-object">String exotic objects</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>S</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5168"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref><var class="field">[[Prototype]]</var>, <var class="field">[[Extensible]]</var>, <var class="field">[[StringData]]</var>&nbsp;»).</li><li>Set <var>S</var>.<var class="field">[[Prototype]]</var> to <var>prototype</var>.</li><li>Set <var>S</var>.<var class="field">[[StringData]]</var> to <var>value</var>.</li><li>Set <var>S</var>.<var class="field">[[GetOwnProperty]]</var> as specified in <emu-xref href="#sec-string-exotic-objects-getownproperty-p" id="_ref_308"><a href="ordinary-and-exotic-objects-behaviours.html#sec-string-exotic-objects-getownproperty-p">10.4.3.1</a></emu-xref>.</li><li>Set <var>S</var>.<var class="field">[[DefineOwnProperty]]</var> as specified in <emu-xref href="#sec-string-exotic-objects-defineownproperty-p-desc" id="_ref_309"><a href="ordinary-and-exotic-objects-behaviours.html#sec-string-exotic-objects-defineownproperty-p-desc">10.4.3.2</a></emu-xref>.</li><li>Set <var>S</var>.<var class="field">[[OwnPropertyKeys]]</var> as specified in <emu-xref href="#sec-string-exotic-objects-ownpropertykeys" id="_ref_310"><a href="ordinary-and-exotic-objects-behaviours.html#sec-string-exotic-objects-ownpropertykeys">10.4.3.3</a></emu-xref>.</li><li>Let <var>length</var> be the length of <var>value</var>.</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5169"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>S</var>, <emu-val>"length"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <emu-xref aoid="𝔽" id="_ref_5170"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>length</var>), <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>&nbsp;}).</li><li>Return <var>S</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-stringgetownproperty" type="abstract operation" aoid="StringGetOwnProperty">
<h1><span class="secnum">10.4.3.5</span> StringGetOwnProperty ( <var>S</var>, <var>P</var> )</h1>
<p>The abstract operation StringGetOwnProperty takes arguments <var>S</var> (an Object that has a <var class="field">[[StringData]]</var> internal slot) and <var>P</var> (a <emu-xref href="#property-key" id="_ref_5171"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5172"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5173"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is not a String</a></emu-xref>, return <emu-val>undefined</emu-val>.</li><li>Let <var>index</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5174"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>index</var> is not an <emu-xref href="#integral-number" id="_ref_5175"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, return <emu-val>undefined</emu-val>.</li><li>If <var>index</var> is <emu-val>-0</emu-val><sub>𝔽</sub> or <var>index</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>undefined</emu-val>.</li><li>Let <var>str</var> be <var>S</var>.<var class="field">[[StringData]]</var>.</li><li><emu-xref href="#assert" id="_ref_5176"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>str</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5177"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>.</li><li>Let <var>len</var> be the length of <var>str</var>.</li><li>If <emu-xref aoid="" id="_ref_5178"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>index</var>) ≥ <var>len</var>, return <emu-val>undefined</emu-val>.</li><li>Let <var>resultStr</var> be the <emu-xref href="#substring" id="_ref_5179"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>str</var> from <emu-xref aoid="" id="_ref_5180"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>index</var>) to <emu-xref aoid="" id="_ref_5181"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>index</var>) + 1.</li><li>Return the PropertyDescriptor { <var class="field">[[Value]]</var>: <var>resultStr</var>, <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val>&nbsp;}.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-arguments-exotic-objects">
<h1><span class="secnum">10.4.4</span> Arguments Exotic Objects</h1>
<p>Most ECMAScript functions make an arguments object available to their code. Depending upon the characteristics of the function definition, its arguments object is either an <emu-xref href="#ordinary-object" id="_ref_5182"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> or an <emu-xref href="#arguments-exotic-object" id="_ref_5183"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref>. An <emu-xref href="#arguments-exotic-object" id="_ref_5184"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> is an <emu-xref href="#exotic-object" id="_ref_5185"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> whose <emu-xref href="#array-index" id="_ref_5186"><a href="ecmascript-data-types-and-values.html#array-index">array index</a></emu-xref> properties map to the formal parameters bindings of an invocation of its associated ECMAScript function.</p>
<p>An object is an <dfn id="arguments-exotic-object" variants="arguments exotic objects" tabindex="-1">arguments exotic object</dfn> if its internal methods use the following implementations, with the ones not specified here using those found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_311"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>. These methods are installed in <emu-xref aoid="CreateMappedArgumentsObject" id="_ref_5187"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createmappedargumentsobject">CreateMappedArgumentsObject</a></emu-xref>.</p>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>While <emu-xref aoid="CreateUnmappedArgumentsObject" id="_ref_5188"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createunmappedargumentsobject">CreateUnmappedArgumentsObject</a></emu-xref> is grouped into this clause, it creates an <emu-xref href="#ordinary-object" id="_ref_5189"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>, not an <emu-xref href="#arguments-exotic-object" id="_ref_5190"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref>.</p>
</div></emu-note>
<p><emu-xref href="#arguments-exotic-object" id="_ref_5191"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">Arguments exotic objects</a></emu-xref> have the same internal slots as <emu-xref href="#ordinary-object" id="_ref_5192"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref>. They also have a <var class="field">[[ParameterMap]]</var> internal slot. Ordinary arguments objects also have a <var class="field">[[ParameterMap]]</var> internal slot whose value is always <emu-val>undefined</emu-val>. For ordinary argument objects the <var class="field">[[ParameterMap]]</var> internal slot is only used by <code>Object.prototype.toString</code> (<emu-xref href="#sec-object.prototype.tostring" id="_ref_312"><a href="fundamental-objects.html#sec-object.prototype.tostring">20.1.3.6</a></emu-xref>) to identify them as such.</p>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The <emu-xref href="#integer-index" id="_ref_5193"><a href="ecmascript-data-types-and-values.html#integer-index">integer-indexed</a></emu-xref> <emu-xref href="#sec-object-type" id="_ref_5194"><a href="ecmascript-data-types-and-values.html#sec-object-type">data properties</a></emu-xref> of an <emu-xref href="#arguments-exotic-object" id="_ref_5195"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> whose numeric name values are less than the number of formal parameters of the corresponding <emu-xref href="#function-object" id="_ref_5196"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> initially share their values with the corresponding argument bindings in the function's <emu-xref href="#sec-execution-contexts" id="_ref_5197"><a href="executable-code-and-execution-contexts.html#sec-execution-contexts">execution context</a></emu-xref>. This means that changing the property changes the corresponding value of the argument binding and vice-versa. This correspondence is broken if such a property is deleted and then redefined or if the property is changed into an <emu-xref href="#sec-object-type" id="_ref_5198"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref>. If the arguments object is an <emu-xref href="#ordinary-object" id="_ref_5199"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>, the values of its properties are simply a copy of the arguments passed to the function and there is no dynamic linkage between the property values and the formal parameter values.</p>
</div></emu-note>
<emu-note><span class="note">Note 3</span><div class="note-contents">
<p>The ParameterMap object and its property values are used as a device for specifying the arguments object correspondence to argument bindings. The ParameterMap object and the objects that are the values of its properties are not directly observable from ECMAScript code. An ECMAScript implementation does not need to actually create or use such objects to implement the specified semantics.</p>
</div></emu-note>
<emu-note><span class="note">Note 4</span><div class="note-contents">
<p>Ordinary arguments objects define a non-configurable <emu-xref href="#sec-object-type" id="_ref_5200"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> named <emu-val>"callee"</emu-val> which throws a <emu-val>TypeError</emu-val> exception on access. The <emu-val>"callee"</emu-val> property has a more specific meaning for <emu-xref href="#arguments-exotic-object" id="_ref_5201"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic objects</a></emu-xref>, which are created only for some class of <emu-xref href="#non-strict-function" id="_ref_5202"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref>. The definition of this property in the ordinary variant exists to ensure that it is not defined in any other manner by conforming ECMAScript implementations.</p>
</div></emu-note>
<emu-note><span class="note">Note 5</span><div class="note-contents">
<p>ECMAScript implementations of <emu-xref href="#arguments-exotic-object" id="_ref_5203"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic objects</a></emu-xref> have historically contained an <emu-xref href="#sec-object-type" id="_ref_5204"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> named <emu-val>"caller"</emu-val>. Prior to ECMAScript 2017, this specification included the definition of a throwing <emu-val>"caller"</emu-val> property on ordinary arguments objects. Since implementations do not contain this extension any longer, ECMAScript 2017 dropped the requirement for a throwing <emu-val>"caller"</emu-val> accessor.</p>
</div></emu-note>
<emu-clause id="sec-arguments-exotic-objects-getownproperty-p" type="internal method">
<h1><span class="secnum">10.4.4.1</span> <var class="field">[[GetOwnProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[GetOwnProperty]]</var> internal method of an <emu-xref href="#arguments-exotic-object" id="_ref_5205"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> <var>args</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5206"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5207"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5208"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>desc</var> be <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_5209"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>args</var>, <var>P</var>).</li><li>If <var>desc</var> is <emu-val>undefined</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Let <var>map</var> be <var>args</var>.<var class="field">[[ParameterMap]]</var>.</li><li>Let <var>isMapped</var> be !&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_5210"><a href="abstract-operations.html#sec-hasownproperty">HasOwnProperty</a></emu-xref>(<var>map</var>, <var>P</var>).</li><li>If <var>isMapped</var> is <emu-val>true</emu-val>, then<ol><li>Set <var>desc</var>.<var class="field">[[Value]]</var> to !&nbsp;<emu-xref aoid="Get" id="_ref_5211"><a href="abstract-operations.html#sec-get-o-p">Get</a></emu-xref>(<var>map</var>, <var>P</var>).</li></ol></li><li>Return <var>desc</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-arguments-exotic-objects-defineownproperty-p-desc" type="internal method">
<h1><span class="secnum">10.4.4.2</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of an <emu-xref href="#arguments-exotic-object" id="_ref_5212"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> <var>args</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5213"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5214"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5215"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>map</var> be <var>args</var>.<var class="field">[[ParameterMap]]</var>.</li><li>Let <var>isMapped</var> be !&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_5216"><a href="abstract-operations.html#sec-hasownproperty">HasOwnProperty</a></emu-xref>(<var>map</var>, <var>P</var>).</li><li>Let <var>newArgDesc</var> be <var>Desc</var>.</li><li>If <var>isMapped</var> is <emu-val>true</emu-val> and <emu-xref aoid="IsDataDescriptor" id="_ref_5217"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, then<ol><li>If <var>Desc</var> does not have a <var class="field">[[Value]]</var> field, <var>Desc</var> has a <var class="field">[[Writable]]</var> field, and <var>Desc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, then<ol><li>Set <var>newArgDesc</var> to a copy of <var>Desc</var>.</li><li>Set <var>newArgDesc</var>.<var class="field">[[Value]]</var> to !&nbsp;<emu-xref aoid="Get" id="_ref_5218"><a href="abstract-operations.html#sec-get-o-p">Get</a></emu-xref>(<var>map</var>, <var>P</var>).</li></ol></li></ol></li><li>Let <var>allowed</var> be !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5219"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>args</var>, <var>P</var>, <var>newArgDesc</var>).</li><li>If <var>allowed</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>isMapped</var> is <emu-val>true</emu-val>, then<ol><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_5220"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>map</var>.<var class="field">[[Delete]]</var>(<var>P</var>).</li></ol></li><li>Else,<ol><li>If <var>Desc</var> has a <var class="field">[[Value]]</var> field, then<ol><li><emu-xref href="#assert" id="_ref_5221"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The following Set will succeed, since formal parameters mapped by arguments objects are always writable.</li><li>Perform !&nbsp;<emu-xref aoid="Set" id="_ref_5222"><a href="abstract-operations.html#sec-set-o-p-v-throw">Set</a></emu-xref>(<var>map</var>, <var>P</var>, <var>Desc</var>.<var class="field">[[Value]]</var>, <emu-val>false</emu-val>).</li></ol></li><li>If <var>Desc</var> has a <var class="field">[[Writable]]</var> field and <var>Desc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, then<ol><li>Perform !&nbsp;<var>map</var>.<var class="field">[[Delete]]</var>(<var>P</var>).</li></ol></li></ol></li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-arguments-exotic-objects-get-p-receiver" type="internal method">
<h1><span class="secnum">10.4.4.3</span> <var class="field">[[Get]]</var> ( <var>P</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Get]]</var> internal method of an <emu-xref href="#arguments-exotic-object" id="_ref_5223"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> <var>args</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5224"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5225"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5226"><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_5227"><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_5228"><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>map</var> be <var>args</var>.<var class="field">[[ParameterMap]]</var>.</li><li>Let <var>isMapped</var> be !&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_5229"><a href="abstract-operations.html#sec-hasownproperty">HasOwnProperty</a></emu-xref>(<var>map</var>, <var>P</var>).</li><li>If <var>isMapped</var> is <emu-val>false</emu-val>, return ?&nbsp;<emu-xref aoid="OrdinaryGet" id="_ref_5230"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryget" class="e-user-code">OrdinaryGet</a></emu-xref>(<var>args</var>, <var>P</var>, <var>Receiver</var>).</li><li><emu-xref href="#assert" id="_ref_5231"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>map</var> contains a formal parameter mapping for <var>P</var>.</li><li>Return !&nbsp;<emu-xref aoid="Get" id="_ref_5232"><a href="abstract-operations.html#sec-get-o-p">Get</a></emu-xref>(<var>map</var>, <var>P</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-arguments-exotic-objects-set-p-v-receiver" type="internal method">
<h1><span class="secnum">10.4.4.4</span> <var class="field">[[Set]]</var> ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Set]]</var> internal method of an <emu-xref href="#arguments-exotic-object" id="_ref_5233"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> <var>args</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5234"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5235"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5236"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5237"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5238"><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>If <emu-xref aoid="SameValue" id="_ref_5239"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>args</var>, <var>Receiver</var>) is <emu-val>false</emu-val>, then<ol><li>Let <var>isMapped</var> be <emu-val>false</emu-val>.</li></ol></li><li>Else,<ol><li>Let <var>map</var> be <var>args</var>.<var class="field">[[ParameterMap]]</var>.</li><li>Let <var>isMapped</var> be !&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_5240"><a href="abstract-operations.html#sec-hasownproperty">HasOwnProperty</a></emu-xref>(<var>map</var>, <var>P</var>).</li></ol></li><li>If <var>isMapped</var> is <emu-val>true</emu-val>, then<ol><li><emu-xref href="#assert" id="_ref_5241"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The following Set will succeed, since formal parameters mapped by arguments objects are always writable.</li><li>Perform !&nbsp;<emu-xref aoid="Set" id="_ref_5242"><a href="abstract-operations.html#sec-set-o-p-v-throw">Set</a></emu-xref>(<var>map</var>, <var>P</var>, <var>V</var>, <emu-val>false</emu-val>).</li></ol></li><li>Return ?&nbsp;<emu-xref aoid="OrdinarySet" id="_ref_5243"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryset" class="e-user-code">OrdinarySet</a></emu-xref>(<var>args</var>, <var>P</var>, <var>V</var>, <var>Receiver</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-arguments-exotic-objects-delete-p" type="internal method">
<h1><span class="secnum">10.4.4.5</span> <var class="field">[[Delete]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[Delete]]</var> internal method of an <emu-xref href="#arguments-exotic-object" id="_ref_5244"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref> <var>args</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5245"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5246"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5247"><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>map</var> be <var>args</var>.<var class="field">[[ParameterMap]]</var>.</li><li>Let <var>isMapped</var> be !&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_5248"><a href="abstract-operations.html#sec-hasownproperty">HasOwnProperty</a></emu-xref>(<var>map</var>, <var>P</var>).</li><li>Let <var>result</var> be ?&nbsp;<emu-xref aoid="OrdinaryDelete" id="_ref_5249"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydelete" class="e-user-code">OrdinaryDelete</a></emu-xref>(<var>args</var>, <var>P</var>).</li><li>If <var>result</var> is <emu-val>true</emu-val> and <var>isMapped</var> is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>map</var>.<var class="field">[[Delete]]</var>(<var>P</var>).</li></ol></li><li>Return <var>result</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-createunmappedargumentsobject" type="abstract operation" aoid="CreateUnmappedArgumentsObject">
<h1><span class="secnum">10.4.4.6</span> CreateUnmappedArgumentsObject ( <var>argumentsList</var> )</h1>
<p>The abstract operation CreateUnmappedArgumentsObject takes argument <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5250"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5251"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns an <emu-xref href="#ordinary-object" id="_ref_5252"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>len</var> be the number of elements in <var>argumentsList</var>.</li><li>Let <var>obj</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_5253"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_5254"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>, « <var class="field">[[ParameterMap]]</var>&nbsp;»).</li><li>Set <var>obj</var>.<var class="field">[[ParameterMap]]</var> to <emu-val>undefined</emu-val>.</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5255"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>obj</var>, <emu-val>"length"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <emu-xref aoid="𝔽" id="_ref_5256"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>len</var>), <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>&nbsp;}).</li><li>Let <var>index</var> be 0.</li><li>Repeat, while <var>index</var> &lt; <var>len</var>,<ol><li>Let <var>val</var> be <var>argumentsList</var>[<var>index</var>].</li><li>Perform !&nbsp;<emu-xref aoid="CreateDataPropertyOrThrow" id="_ref_5257"><a href="abstract-operations.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>obj</var>, !&nbsp;<emu-xref aoid="ToString" id="_ref_5258"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_5259"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>index</var>)), <var>val</var>).</li><li>Set <var>index</var> to <var>index</var> + 1.</li></ol></li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5260"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>obj</var>, <emu-xref href="#sec-well-known-symbols" id="_ref_5261"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.iterator%</a></emu-xref>, PropertyDescriptor { <var class="field">[[Value]]</var>: %Array.prototype.values%, <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>&nbsp;}).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5262"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>obj</var>, <emu-val>"callee"</emu-val>, PropertyDescriptor { <var class="field">[[Get]]</var>: <emu-xref href="#sec-%throwtypeerror%" id="_ref_5263"><a href="ordinary-and-exotic-objects-behaviours.html#sec-%throwtypeerror%">%ThrowTypeError%</a></emu-xref>, <var class="field">[[Set]]</var>: <emu-xref href="#sec-%throwtypeerror%" id="_ref_5264"><a href="ordinary-and-exotic-objects-behaviours.html#sec-%throwtypeerror%">%ThrowTypeError%</a></emu-xref>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val>&nbsp;}).</li><li>Return <var>obj</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-createmappedargumentsobject" type="abstract operation" aoid="CreateMappedArgumentsObject">
<h1><span class="secnum">10.4.4.7</span> CreateMappedArgumentsObject ( <var>func</var>, <var>formals</var>, <var>argumentsList</var>, <var>env</var> )</h1>
<p>The abstract operation CreateMappedArgumentsObject takes arguments <var>func</var> (an Object), <var>formals</var> (a <emu-xref href="#sec-syntactic-grammar" id="_ref_5265"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5266"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5267"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>), and <var>env</var> (an <emu-xref href="#sec-environment-records" id="_ref_5268"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>) and returns an <emu-xref href="#arguments-exotic-object" id="_ref_5269"><a href="ordinary-and-exotic-objects-behaviours.html#arguments-exotic-object">arguments exotic object</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_5270"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>formals</var> does not contain a rest parameter, any binding patterns, or any initializers. It may contain duplicate identifiers.</li><li>Let <var>len</var> be the number of elements in <var>argumentsList</var>.</li><li>Let <var>obj</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5271"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref><var class="field">[[Prototype]]</var>, <var class="field">[[Extensible]]</var>, <var class="field">[[ParameterMap]]</var>&nbsp;»).</li><li>Set <var>obj</var>.<var class="field">[[GetOwnProperty]]</var> as specified in <emu-xref href="#sec-arguments-exotic-objects-getownproperty-p" id="_ref_313"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arguments-exotic-objects-getownproperty-p">10.4.4.1</a></emu-xref>.</li><li>Set <var>obj</var>.<var class="field">[[DefineOwnProperty]]</var> as specified in <emu-xref href="#sec-arguments-exotic-objects-defineownproperty-p-desc" id="_ref_314"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arguments-exotic-objects-defineownproperty-p-desc">10.4.4.2</a></emu-xref>.</li><li>Set <var>obj</var>.<var class="field">[[Get]]</var> as specified in <emu-xref href="#sec-arguments-exotic-objects-get-p-receiver" id="_ref_315"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arguments-exotic-objects-get-p-receiver">10.4.4.3</a></emu-xref>.</li><li>Set <var>obj</var>.<var class="field">[[Set]]</var> as specified in <emu-xref href="#sec-arguments-exotic-objects-set-p-v-receiver" id="_ref_316"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arguments-exotic-objects-set-p-v-receiver">10.4.4.4</a></emu-xref>.</li><li>Set <var>obj</var>.<var class="field">[[Delete]]</var> as specified in <emu-xref href="#sec-arguments-exotic-objects-delete-p" id="_ref_317"><a href="ordinary-and-exotic-objects-behaviours.html#sec-arguments-exotic-objects-delete-p">10.4.4.5</a></emu-xref>.</li><li>Set <var>obj</var>.<var class="field">[[Prototype]]</var> to <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_5272"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li><li>Let <var>map</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_5273"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-val>null</emu-val>).</li><li>Set <var>obj</var>.<var class="field">[[ParameterMap]]</var> to <var>map</var>.</li><li>Let <var>parameterNames</var> be the <emu-xref aoid="BoundNames" id="_ref_5274"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>formals</var>.</li><li>Let <var>numberOfParameters</var> be the number of elements in <var>parameterNames</var>.</li><li>Let <var>index</var> be 0.</li><li>Repeat, while <var>index</var> &lt; <var>len</var>,<ol><li>Let <var>val</var> be <var>argumentsList</var>[<var>index</var>].</li><li>Perform !&nbsp;<emu-xref aoid="CreateDataPropertyOrThrow" id="_ref_5275"><a href="abstract-operations.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>obj</var>, !&nbsp;<emu-xref aoid="ToString" id="_ref_5276"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_5277"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>index</var>)), <var>val</var>).</li><li>Set <var>index</var> to <var>index</var> + 1.</li></ol></li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5278"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>obj</var>, <emu-val>"length"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <emu-xref aoid="𝔽" id="_ref_5279"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>len</var>), <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>&nbsp;}).</li><li>Let <var>mappedNames</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5280"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Set <var>index</var> to <var>numberOfParameters</var> - 1.</li><li>Repeat, while <var>index</var> ≥ 0,<ol><li>Let <var>name</var> be <var>parameterNames</var>[<var>index</var>].</li><li>If <var>mappedNames</var> does not contain <var>name</var>, then<ol><li>Append <var>name</var> to <var>mappedNames</var>.</li><li>If <var>index</var> &lt; <var>len</var>, then<ol><li>Let <var>g</var> be <emu-xref aoid="MakeArgGetter" id="_ref_5281"><a href="ordinary-and-exotic-objects-behaviours.html#sec-makearggetter">MakeArgGetter</a></emu-xref>(<var>name</var>, <var>env</var>).</li><li>Let <var>p</var> be <emu-xref aoid="MakeArgSetter" id="_ref_5282"><a href="ordinary-and-exotic-objects-behaviours.html#sec-makeargsetter">MakeArgSetter</a></emu-xref>(<var>name</var>, <var>env</var>).</li><li>Perform !&nbsp;<var>map</var>.<var class="field">[[DefineOwnProperty]]</var>(! <emu-xref aoid="ToString" id="_ref_5283"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_5284"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>index</var>)), PropertyDescriptor { <var class="field">[[Set]]</var>: <var>p</var>, <var class="field">[[Get]]</var>: <var>g</var>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}).</li></ol></li></ol></li><li>Set <var>index</var> to <var>index</var> - 1.</li></ol></li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5285"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>obj</var>, <emu-xref href="#sec-well-known-symbols" id="_ref_5286"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.iterator%</a></emu-xref>, PropertyDescriptor { <var class="field">[[Value]]</var>: %Array.prototype.values%, <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>&nbsp;}).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_5287"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>obj</var>, <emu-val>"callee"</emu-val>, PropertyDescriptor { <var class="field">[[Value]]</var>: <var>func</var>, <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>&nbsp;}).</li><li>Return <var>obj</var>.</li></ol></emu-alg>
<emu-clause id="sec-makearggetter" type="abstract operation" aoid="MakeArgGetter">
<h1><span class="secnum">10.4.4.7.1</span> MakeArgGetter ( <var>name</var>, <var>env</var> )</h1>
<p>The abstract operation MakeArgGetter takes arguments <var>name</var> (a String) and <var>env</var> (an <emu-xref href="#sec-environment-records" id="_ref_5288"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>) and returns a <emu-xref href="#function-object" id="_ref_5289"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>. It creates a built-in <emu-xref href="#function-object" id="_ref_5290"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> that when executed returns the value bound for <var>name</var> in <var>env</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>getterClosure</var> be a new <emu-xref href="#sec-abstract-closure" id="_ref_5291"><a href="ecmascript-data-types-and-values.html#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures <var>name</var> and <var>env</var> and performs the following steps when called:<ol><li>Return <emu-xref aoid="NormalCompletion" id="_ref_5292"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(! <var>env</var>.<emu-xref aoid="GetBindingValue" id="_ref_5293"><a href="executable-code-and-execution-contexts.html#abstract-getbindingvalue">GetBindingValue</a></emu-xref>(<var>name</var>, <emu-val>false</emu-val>)).</li></ol></li><li>Let <var>getter</var> be <emu-xref aoid="CreateBuiltinFunction" id="_ref_5294"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>getterClosure</var>, 0, <emu-val>""</emu-val>, «&nbsp;»).</li><li>NOTE: <var>getter</var> is never directly accessible to ECMAScript code.</li><li>Return <var>getter</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-makeargsetter" type="abstract operation" aoid="MakeArgSetter">
<h1><span class="secnum">10.4.4.7.2</span> MakeArgSetter ( <var>name</var>, <var>env</var> )</h1>
<p>The abstract operation MakeArgSetter takes arguments <var>name</var> (a String) and <var>env</var> (an <emu-xref href="#sec-environment-records" id="_ref_5295"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>) and returns a <emu-xref href="#function-object" id="_ref_5296"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>. It creates a built-in <emu-xref href="#function-object" id="_ref_5297"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> that when executed sets the value bound for <var>name</var> in <var>env</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>setterClosure</var> be a new <emu-xref href="#sec-abstract-closure" id="_ref_5298"><a href="ecmascript-data-types-and-values.html#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>value</var>) that captures <var>name</var> and <var>env</var> and performs the following steps when called:<ol><li>Return <emu-xref aoid="NormalCompletion" id="_ref_5299"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(! <var>env</var>.<emu-xref aoid="SetMutableBinding" id="_ref_5300"><a href="executable-code-and-execution-contexts.html#abstract-setmutablebinding">SetMutableBinding</a></emu-xref>(<var>name</var>, <var>value</var>, <emu-val>false</emu-val>)).</li></ol></li><li>Let <var>setter</var> be <emu-xref aoid="CreateBuiltinFunction" id="_ref_5301"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>setterClosure</var>, 1, <emu-val>""</emu-val>, «&nbsp;»).</li><li>NOTE: <var>setter</var> is never directly accessible to ECMAScript code.</li><li>Return <var>setter</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-typedarray-exotic-objects" oldids="sec-integer-indexed-exotic-objects"><span id="sec-integer-indexed-exotic-objects"></span>
<h1><span class="secnum">10.4.5</span> TypedArray Exotic Objects</h1>
<p>A <emu-xref href="#typedarray" id="_ref_5302"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> is an <emu-xref href="#exotic-object" id="_ref_5303"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> that performs special handling of <emu-xref href="#property-key" id="_ref_5304"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> that are <emu-xref href="#sec-canonicalnumericindexstring" id="_ref_5305"><a href="abstract-operations.html#sec-canonicalnumericindexstring">canonical numeric strings</a></emu-xref>, using the subset that are in-bounds <emu-xref href="#integer-index" id="_ref_5306"><a href="ecmascript-data-types-and-values.html#integer-index">integer indices</a></emu-xref> to index elements of uniform type and enforcing the invariant that the remainder are absent without incurring prototype chain traversal.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Because <emu-xref aoid="ToString" id="_ref_5307"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<var>n</var>) for any Number <var>n</var> is a <emu-xref href="#sec-canonicalnumericindexstring" id="_ref_5308"><a href="abstract-operations.html#sec-canonicalnumericindexstring">canonical numeric string</a></emu-xref>, an implementation may treat Numbers as <emu-xref href="#property-key" id="_ref_5309"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> for <emu-xref href="#typedarray" id="_ref_5310"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArrays</a></emu-xref> without actually performing the string conversion.</p>
</div></emu-note>
<p><emu-xref href="#typedarray" id="_ref_5311"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArrays</a></emu-xref> have the same internal slots as <emu-xref href="#ordinary-object" id="_ref_5312"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> and additionally <var class="field">[[ViewedArrayBuffer]]</var>, <var class="field">[[TypedArrayName]]</var>, <var class="field">[[ContentType]]</var>, <var class="field">[[ByteLength]]</var>, <var class="field">[[ByteOffset]]</var>, and <var class="field">[[ArrayLength]]</var> internal slots.</p>
<p>An object is a <dfn id="typedarray" oldids="integer-indexed-exotic-object" variants="TypedArrays" tabindex="-1"><span id="integer-indexed-exotic-object"></span>TypedArray</dfn> if its <var class="field">[[PreventExtensions]]</var>, <var class="field">[[GetOwnProperty]]</var>, <var class="field">[[HasProperty]]</var>, <var class="field">[[DefineOwnProperty]]</var>, <var class="field">[[Get]]</var>, <var class="field">[[Set]]</var>, <var class="field">[[Delete]]</var>, and <var class="field">[[OwnPropertyKeys]]</var>, internal methods use the definitions in this section, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_318"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>. These methods are installed by <emu-xref aoid="TypedArrayCreate" id="_ref_5313"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraycreate">TypedArrayCreate</a></emu-xref>.</p>
<emu-clause id="sec-typedarray-preventextensions" type="internal method">
<h1><span class="secnum">10.4.5.1</span> <var class="field">[[PreventExtensions]]</var> ( )</h1>
<p>The <var class="field">[[PreventExtensions]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5314"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5315"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>NOTE: The extensibility-related invariants specified in <emu-xref href="#sec-invariants-of-the-essential-internal-methods" id="_ref_319"><a href="ecmascript-data-types-and-values.html#sec-invariants-of-the-essential-internal-methods">6.1.7.3</a></emu-xref> do not allow this method to return <emu-val>true</emu-val> when <var>O</var> can gain (or lose and then regain) properties, which might occur for properties with <emu-xref href="#integer-index" id="_ref_5316"><a href="ecmascript-data-types-and-values.html#integer-index">integer index</a></emu-xref> names when its underlying buffer is resized.</li><li>If <emu-xref aoid="IsTypedArrayFixedLength" id="_ref_5317"><a href="ordinary-and-exotic-objects-behaviours.html#sec-istypedarrayfixedlength">IsTypedArrayFixedLength</a></emu-xref>(<var>O</var>) is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Return <emu-xref aoid="OrdinaryPreventExtensions" id="_ref_5318"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarypreventextensions">OrdinaryPreventExtensions</a></emu-xref>(<var>O</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-getownproperty" oldids="sec-integer-indexed-exotic-objects-getownproperty-p" type="internal method"><span id="sec-integer-indexed-exotic-objects-getownproperty-p"></span>
<h1><span class="secnum">10.4.5.2</span> <var class="field">[[GetOwnProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[GetOwnProperty]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5319"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5320"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5321"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5322"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5323"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Let <var>numericIndex</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5324"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>numericIndex</var> is not <emu-val>undefined</emu-val>, then<ol><li>Let <var>value</var> be <emu-xref aoid="TypedArrayGetElement" id="_ref_5325"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraygetelement">TypedArrayGetElement</a></emu-xref>(<var>O</var>, <var>numericIndex</var>).</li><li>If <var>value</var> is <emu-val>undefined</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Return the PropertyDescriptor { <var class="field">[[Value]]</var>: <var>value</var>, <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}.</li></ol></li></ol></li><li>Return <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_5326"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-hasproperty" oldids="sec-integer-indexed-exotic-objects-hasproperty-p" type="internal method"><span id="sec-integer-indexed-exotic-objects-hasproperty-p"></span>
<h1><span class="secnum">10.4.5.3</span> <var class="field">[[HasProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[HasProperty]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5327"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5328"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5329"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5330"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5331"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Let <var>numericIndex</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5332"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>numericIndex</var> is not <emu-val>undefined</emu-val>, return <emu-xref aoid="IsValidIntegerIndex" id="_ref_5333"><a href="ordinary-and-exotic-objects-behaviours.html#sec-isvalidintegerindex">IsValidIntegerIndex</a></emu-xref>(<var>O</var>, <var>numericIndex</var>).</li></ol></li><li>Return ?&nbsp;<emu-xref aoid="OrdinaryHasProperty" id="_ref_5334"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryhasproperty" class="e-user-code">OrdinaryHasProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-defineownproperty" oldids="sec-integer-indexed-exotic-objects-defineownproperty-p-desc" type="internal method"><span id="sec-integer-indexed-exotic-objects-defineownproperty-p-desc"></span>
<h1><span class="secnum">10.4.5.4</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5335"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5336"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5337"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5338"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5339"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5340"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Let <var>numericIndex</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5341"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>numericIndex</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="IsValidIntegerIndex" id="_ref_5342"><a href="ordinary-and-exotic-objects-behaviours.html#sec-isvalidintegerindex">IsValidIntegerIndex</a></emu-xref>(<var>O</var>, <var>numericIndex</var>) is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Configurable]]</var> field and <var>Desc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has an <var class="field">[[Enumerable]]</var> field and <var>Desc</var>.<var class="field">[[Enumerable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_5343"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Writable]]</var> field and <var>Desc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Value]]</var> field, perform ?&nbsp;<emu-xref aoid="TypedArraySetElement" id="_ref_5344"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraysetelement" class="e-user-code">TypedArraySetElement</a></emu-xref>(<var>O</var>, <var>numericIndex</var>, <var>Desc</var>.<var class="field">[[Value]]</var>).</li><li>Return <emu-val>true</emu-val>.</li></ol></li></ol></li><li>Return !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5345"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>, <var>Desc</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-get" oldids="sec-integer-indexed-exotic-objects-get-p-receiver" type="internal method"><span id="sec-integer-indexed-exotic-objects-get-p-receiver"></span>
<h1><span class="secnum">10.4.5.5</span> <var class="field">[[Get]]</var> ( <var>P</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Get]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5346"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5347"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5348"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5349"><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_5350"><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_5351"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5352"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Let <var>numericIndex</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5353"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>numericIndex</var> is not <emu-val>undefined</emu-val>, then<ol><li>Return <emu-xref aoid="TypedArrayGetElement" id="_ref_5354"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraygetelement">TypedArrayGetElement</a></emu-xref>(<var>O</var>, <var>numericIndex</var>).</li></ol></li></ol></li><li>Return ?&nbsp;<emu-xref aoid="OrdinaryGet" id="_ref_5355"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryget" class="e-user-code">OrdinaryGet</a></emu-xref>(<var>O</var>, <var>P</var>, <var>Receiver</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-set" oldids="sec-integer-indexed-exotic-objects-set-p-v-receiver" type="internal method"><span id="sec-integer-indexed-exotic-objects-set-p-v-receiver"></span>
<h1><span class="secnum">10.4.5.6</span> <var class="field">[[Set]]</var> ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Set]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5356"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5357"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5358"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5359"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5360"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5361"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5362"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Let <var>numericIndex</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5363"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>numericIndex</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="SameValue" id="_ref_5364"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>O</var>, <var>Receiver</var>) is <emu-val>true</emu-val>, then<ol><li>Perform ?&nbsp;<emu-xref aoid="TypedArraySetElement" id="_ref_5365"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraysetelement" class="e-user-code">TypedArraySetElement</a></emu-xref>(<var>O</var>, <var>numericIndex</var>, <var>V</var>).</li><li>Return <emu-val>true</emu-val>.</li></ol></li><li>If <emu-xref aoid="IsValidIntegerIndex" id="_ref_5366"><a href="ordinary-and-exotic-objects-behaviours.html#sec-isvalidintegerindex">IsValidIntegerIndex</a></emu-xref>(<var>O</var>, <var>numericIndex</var>) is <emu-val>false</emu-val>, return <emu-val>true</emu-val>.</li></ol></li></ol></li><li>Return ?&nbsp;<emu-xref aoid="OrdinarySet" id="_ref_5367"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryset" class="e-user-code">OrdinarySet</a></emu-xref>(<var>O</var>, <var>P</var>, <var>V</var>, <var>Receiver</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-delete" oldids="sec-integer-indexed-exotic-objects-delete-p" type="internal method"><span id="sec-integer-indexed-exotic-objects-delete-p"></span>
<h1><span class="secnum">10.4.5.7</span> <var class="field">[[Delete]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[Delete]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5368"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5369"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5370"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5371"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Let <var>numericIndex</var> be <emu-xref aoid="CanonicalNumericIndexString" id="_ref_5372"><a href="abstract-operations.html#sec-canonicalnumericindexstring">CanonicalNumericIndexString</a></emu-xref>(<var>P</var>).</li><li>If <var>numericIndex</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="IsValidIntegerIndex" id="_ref_5373"><a href="ordinary-and-exotic-objects-behaviours.html#sec-isvalidintegerindex">IsValidIntegerIndex</a></emu-xref>(<var>O</var>, <var>numericIndex</var>) is <emu-val>false</emu-val>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></li></ol></li><li>Return !&nbsp;<emu-xref aoid="OrdinaryDelete" id="_ref_5374"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydelete">OrdinaryDelete</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-ownpropertykeys" oldids="sec-integer-indexed-exotic-objects-ownpropertykeys" type="internal method"><span id="sec-integer-indexed-exotic-objects-ownpropertykeys"></span>
<h1><span class="secnum">10.4.5.8</span> <var class="field">[[OwnPropertyKeys]]</var> ( )</h1>
<p>The <var class="field">[[OwnPropertyKeys]]</var> internal method of a <emu-xref href="#typedarray" id="_ref_5375"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5376"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5377"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_5378"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>taRecord</var> be <emu-xref aoid="MakeTypedArrayWithBufferWitnessRecord" id="_ref_5379"><a href="ordinary-and-exotic-objects-behaviours.html#sec-maketypedarraywithbufferwitnessrecord">MakeTypedArrayWithBufferWitnessRecord</a></emu-xref>(<var>O</var>, <emu-const>seq-cst</emu-const>).</li><li>Let <var>keys</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5380"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>If <emu-xref aoid="IsTypedArrayOutOfBounds" id="_ref_5381"><a href="ordinary-and-exotic-objects-behaviours.html#sec-istypedarrayoutofbounds">IsTypedArrayOutOfBounds</a></emu-xref>(<var>taRecord</var>) is <emu-val>false</emu-val>, then<ol><li>Let <var>length</var> be <emu-xref aoid="TypedArrayLength" id="_ref_5382"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraylength">TypedArrayLength</a></emu-xref>(<var>taRecord</var>).</li><li>For each <emu-xref href="#integer" id="_ref_5383"><a href="notational-conventions.html#integer">integer</a></emu-xref> <var>i</var> such that 0 ≤ <var>i</var> &lt; <var>length</var>, in ascending order, do<ol><li>Append !&nbsp;<emu-xref aoid="ToString" id="_ref_5384"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_5385"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>i</var>)) to <var>keys</var>.</li></ol></li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_5386"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_5387"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref> and <var>P</var> is not an <emu-xref href="#integer-index" id="_ref_5388"><a href="ecmascript-data-types-and-values.html#integer-index">integer index</a></emu-xref>, in ascending chronological order of property creation, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>For each own <emu-xref href="#property-key" id="_ref_5389"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> <var>P</var> of <var>O</var> such that <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5390"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, in ascending chronological order of property creation, do<ol><li>Append <var>P</var> to <var>keys</var>.</li></ol></li><li>Return <var>keys</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarray-with-buffer-witness-records" oldids="sec-integer-indexed-object-with-buffer-witness-records"><span id="sec-integer-indexed-object-with-buffer-witness-records"></span>
<h1><span class="secnum">10.4.5.9</span> TypedArray With Buffer Witness Records</h1>
<p>An <dfn variants="TypedArray With Buffer Witness Records" tabindex="-1">TypedArray With Buffer Witness Record</dfn> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5391"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> value used to encapsulate a <emu-xref href="#typedarray" id="_ref_5392"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> along with a cached byte length of the viewed buffer. It is used to help ensure there is a single <emu-xref href="#sec-memory-model-fundamentals" id="_ref_5393"><a href="memory-model.html#sec-memory-model-fundamentals">ReadSharedMemory</a></emu-xref> event of the byte length data block when the viewed buffer is a <emu-xref href="#sec-fixed-length-and-growable-sharedarraybuffer-objects" id="_ref_5394"><a href="structured-data.html#sec-fixed-length-and-growable-sharedarraybuffer-objects">growable SharedArrayBuffer</a></emu-xref>.</p>
<p>TypedArray With Buffer Witness Records have the fields listed in <emu-xref href="#table-typedarray-with-buffer-witness-record-fields" id="_ref_320"><a href="ordinary-and-exotic-objects-behaviours.html#table-typedarray-with-buffer-witness-record-fields">Table 27</a></emu-xref>.</p>
<emu-table id="table-typedarray-with-buffer-witness-record-fields" oldids="table-integer-indexed-object-with-buffer-witness-record-fields" caption="TypedArray With Buffer Witness Record Fields"><figure><figcaption>Table 27: <emu-xref href="#sec-typedarray-with-buffer-witness-records" id="_ref_5395"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-with-buffer-witness-records">TypedArray With Buffer Witness Record</a></emu-xref> Fields</figcaption><span id="table-integer-indexed-object-with-buffer-witness-record-fields"></span>
<table>
<thead>
<tr>
<th>
Field Name
</th>
<th>
Value
</th>
<th>
Meaning
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[Object]]</var>
</td>
<td>
a <emu-xref href="#typedarray" id="_ref_5396"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>
</td>
<td>
The <emu-xref href="#typedarray" id="_ref_5397"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> whose buffer's byte length is loaded.
</td>
</tr>
<tr>
<td>
<var class="field">[[CachedBufferByteLength]]</var>
</td>
<td>
a non-negative <emu-xref href="#integer" id="_ref_5398"><a href="notational-conventions.html#integer">integer</a></emu-xref> or <emu-const>detached</emu-const>
</td>
<td>
The byte length of the object's <var class="field">[[ViewedArrayBuffer]]</var> when the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5399"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> was created.
</td>
</tr>
</tbody></table>
</figure></emu-table>
</emu-clause>
<emu-clause id="sec-maketypedarraywithbufferwitnessrecord" oldids="sec-makeintegerindexedobjectwithbufferwitnessrecord" type="abstract operation" aoid="MakeTypedArrayWithBufferWitnessRecord"><span id="sec-makeintegerindexedobjectwithbufferwitnessrecord"></span>
<h1><span class="secnum">10.4.5.10</span> MakeTypedArrayWithBufferWitnessRecord ( <var>obj</var>, <var>order</var> )</h1>
<p>The abstract operation MakeTypedArrayWithBufferWitnessRecord takes arguments <var>obj</var> (a <emu-xref href="#typedarray" id="_ref_5400"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>) and <var>order</var> (<emu-const>seq-cst</emu-const> or <emu-const>unordered</emu-const>) and returns a <emu-xref href="#sec-typedarray-with-buffer-witness-records" id="_ref_5401"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-with-buffer-witness-records">TypedArray With Buffer Witness Record</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>buffer</var> be <var>obj</var>.<var class="field">[[ViewedArrayBuffer]]</var>.</li><li>If <emu-xref aoid="IsDetachedBuffer" id="_ref_5402"><a href="structured-data.html#sec-isdetachedbuffer">IsDetachedBuffer</a></emu-xref>(<var>buffer</var>) is <emu-val>true</emu-val>, then<ol><li>Let <var>byteLength</var> be <emu-const>detached</emu-const>.</li></ol></li><li>Else,<ol><li>Let <var>byteLength</var> be <emu-xref aoid="ArrayBufferByteLength" id="_ref_5403"><a href="structured-data.html#sec-arraybufferbytelength">ArrayBufferByteLength</a></emu-xref>(<var>buffer</var>, <var>order</var>).</li></ol></li><li>Return the <emu-xref href="#sec-typedarray-with-buffer-witness-records" id="_ref_5404"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-with-buffer-witness-records">TypedArray With Buffer Witness Record</a></emu-xref> { <var class="field">[[Object]]</var>: <var>obj</var>, <var class="field">[[CachedBufferByteLength]]</var>: <var>byteLength</var>&nbsp;}.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarraycreate" oldids="sec-integerindexedobjectcreate" type="abstract operation" aoid="TypedArrayCreate"><span id="sec-integerindexedobjectcreate"></span>
<h1><span class="secnum">10.4.5.11</span> TypedArrayCreate ( <var>prototype</var> )</h1>
<p>The abstract operation TypedArrayCreate takes argument <var>prototype</var> (an Object) and returns a <emu-xref href="#typedarray" id="_ref_5405"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>. It is used to specify the creation of new <emu-xref href="#typedarray" id="_ref_5406"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArrays</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>internalSlotsList</var> be « <var class="field">[[Prototype]]</var>, <var class="field">[[Extensible]]</var>, <var class="field">[[ViewedArrayBuffer]]</var>, <var class="field">[[TypedArrayName]]</var>, <var class="field">[[ContentType]]</var>, <var class="field">[[ByteLength]]</var>, <var class="field">[[ByteOffset]]</var>, <var class="field">[[ArrayLength]]</var>&nbsp;».</li><li>Let <var>A</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5407"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref>(<var>internalSlotsList</var>).</li><li>Set <var>A</var>.<var class="field">[[PreventExtensions]]</var> as specified in <emu-xref href="#sec-typedarray-preventextensions" id="_ref_321"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-preventextensions">10.4.5.1</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[GetOwnProperty]]</var> as specified in <emu-xref href="#sec-typedarray-getownproperty" id="_ref_322"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-getownproperty">10.4.5.2</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[HasProperty]]</var> as specified in <emu-xref href="#sec-typedarray-hasproperty" id="_ref_323"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-hasproperty">10.4.5.3</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[DefineOwnProperty]]</var> as specified in <emu-xref href="#sec-typedarray-defineownproperty" id="_ref_324"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-defineownproperty">10.4.5.4</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[Get]]</var> as specified in <emu-xref href="#sec-typedarray-get" id="_ref_325"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-get">10.4.5.5</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[Set]]</var> as specified in <emu-xref href="#sec-typedarray-set" id="_ref_326"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-set">10.4.5.6</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[Delete]]</var> as specified in <emu-xref href="#sec-typedarray-delete" id="_ref_327"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-delete">10.4.5.7</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[OwnPropertyKeys]]</var> as specified in <emu-xref href="#sec-typedarray-ownpropertykeys" id="_ref_328"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-ownpropertykeys">10.4.5.8</a></emu-xref>.</li><li>Set <var>A</var>.<var class="field">[[Prototype]]</var> to <var>prototype</var>.</li><li>Return <var>A</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarraybytelength" oldids="sec-integerindexedobjectbytelength" type="abstract operation" aoid="TypedArrayByteLength"><span id="sec-integerindexedobjectbytelength"></span>
<h1><span class="secnum">10.4.5.12</span> TypedArrayByteLength ( <var>taRecord</var> )</h1>
<p>The abstract operation TypedArrayByteLength takes argument <var>taRecord</var> (a <emu-xref href="#sec-typedarray-with-buffer-witness-records" id="_ref_5408"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-with-buffer-witness-records">TypedArray With Buffer Witness Record</a></emu-xref>) and returns a non-negative <emu-xref href="#integer" id="_ref_5409"><a href="notational-conventions.html#integer">integer</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_5410"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsTypedArrayOutOfBounds" id="_ref_5411"><a href="ordinary-and-exotic-objects-behaviours.html#sec-istypedarrayoutofbounds">IsTypedArrayOutOfBounds</a></emu-xref>(<var>taRecord</var>) is <emu-val>false</emu-val>.</li><li>Let <var>O</var> be <var>taRecord</var>.<var class="field">[[Object]]</var>.</li><li>If <var>O</var>.<var class="field">[[ByteLength]]</var> is not <emu-const>auto</emu-const>, return <var>O</var>.<var class="field">[[ByteLength]]</var>.</li><li>Let <var>length</var> be <emu-xref aoid="TypedArrayLength" id="_ref_5412"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraylength">TypedArrayLength</a></emu-xref>(<var>taRecord</var>).</li><li>Let <var>elementSize</var> be <emu-xref aoid="TypedArrayElementSize" id="_ref_5413"><a href="indexed-collections.html#sec-typedarrayelementsize">TypedArrayElementSize</a></emu-xref>(<var>O</var>).</li><li>NOTE: The returned byte length is always an <emu-xref href="#integer" id="_ref_5414"><a href="notational-conventions.html#integer">integer</a></emu-xref> multiple of <var>elementSize</var>, even when the underlying buffer has been resized to a non-<emu-xref href="#integer" id="_ref_5415"><a href="notational-conventions.html#integer">integer</a></emu-xref> multiple.</li><li>Return <var>length</var> × <var>elementSize</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarraylength" oldids="sec-integerindexedobjectlength" type="abstract operation" aoid="TypedArrayLength"><span id="sec-integerindexedobjectlength"></span>
<h1><span class="secnum">10.4.5.13</span> TypedArrayLength ( <var>taRecord</var> )</h1>
<p>The abstract operation TypedArrayLength takes argument <var>taRecord</var> (a <emu-xref href="#sec-typedarray-with-buffer-witness-records" id="_ref_5416"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-with-buffer-witness-records">TypedArray With Buffer Witness Record</a></emu-xref>) and returns a non-negative <emu-xref href="#integer" id="_ref_5417"><a href="notational-conventions.html#integer">integer</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_5418"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsTypedArrayOutOfBounds" id="_ref_5419"><a href="ordinary-and-exotic-objects-behaviours.html#sec-istypedarrayoutofbounds">IsTypedArrayOutOfBounds</a></emu-xref>(<var>taRecord</var>) is <emu-val>false</emu-val>.</li><li>Let <var>O</var> be <var>taRecord</var>.<var class="field">[[Object]]</var>.</li><li>If <var>O</var>.<var class="field">[[ArrayLength]]</var> is not <emu-const>auto</emu-const>, return <var>O</var>.<var class="field">[[ArrayLength]]</var>.</li><li><emu-xref href="#assert" id="_ref_5420"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsFixedLengthArrayBuffer" id="_ref_5421"><a href="structured-data.html#sec-isfixedlengtharraybuffer">IsFixedLengthArrayBuffer</a></emu-xref>(<var>O</var>.<var class="field">[[ViewedArrayBuffer]]</var>) is <emu-val>false</emu-val>.</li><li>Let <var>byteOffset</var> be <var>O</var>.<var class="field">[[ByteOffset]]</var>.</li><li>Let <var>elementSize</var> be <emu-xref aoid="TypedArrayElementSize" id="_ref_5422"><a href="indexed-collections.html#sec-typedarrayelementsize">TypedArrayElementSize</a></emu-xref>(<var>O</var>).</li><li>Let <var>byteLength</var> be <var>taRecord</var>.<var class="field">[[CachedBufferByteLength]]</var>.</li><li><emu-xref href="#assert" id="_ref_5423"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>byteLength</var> is not <emu-const>detached</emu-const>.</li><li>Return <emu-xref aoid="floor" id="_ref_5424"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>((<var>byteLength</var> - <var>byteOffset</var>) / <var>elementSize</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-istypedarrayoutofbounds" oldids="sec-isintegerindexedobjectoutofbounds" type="abstract operation" aoid="IsTypedArrayOutOfBounds"><span id="sec-isintegerindexedobjectoutofbounds"></span>
<h1><span class="secnum">10.4.5.14</span> IsTypedArrayOutOfBounds ( <var>taRecord</var> )</h1>
<p>The abstract operation IsTypedArrayOutOfBounds takes argument <var>taRecord</var> (a <emu-xref href="#sec-typedarray-with-buffer-witness-records" id="_ref_5425"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarray-with-buffer-witness-records">TypedArray With Buffer Witness Record</a></emu-xref>) and returns a Boolean. It checks if any of the object's numeric properties reference a value at an index not contained within the underlying buffer's bounds. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be <var>taRecord</var>.<var class="field">[[Object]]</var>.</li><li>Let <var>bufferByteLength</var> be <var>taRecord</var>.<var class="field">[[CachedBufferByteLength]]</var>.</li><li>If <emu-xref aoid="IsDetachedBuffer" id="_ref_5426"><a href="structured-data.html#sec-isdetachedbuffer">IsDetachedBuffer</a></emu-xref>(<var>O</var>.<var class="field">[[ViewedArrayBuffer]]</var>) is <emu-val>true</emu-val>, then<ol><li><emu-xref href="#assert" id="_ref_5427"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>bufferByteLength</var> is <emu-const>detached</emu-const>.</li><li>Return <emu-val>true</emu-val>.</li></ol></li><li><emu-xref href="#assert" id="_ref_5428"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>bufferByteLength</var> is a non-negative <emu-xref href="#integer" id="_ref_5429"><a href="notational-conventions.html#integer">integer</a></emu-xref>.</li><li>Let <var>byteOffsetStart</var> be <var>O</var>.<var class="field">[[ByteOffset]]</var>.</li><li>If <var>O</var>.<var class="field">[[ArrayLength]]</var> is <emu-const>auto</emu-const>, then<ol><li>Let <var>byteOffsetEnd</var> be <var>bufferByteLength</var>.</li></ol></li><li>Else,<ol><li>Let <var>elementSize</var> be <emu-xref aoid="TypedArrayElementSize" id="_ref_5430"><a href="indexed-collections.html#sec-typedarrayelementsize">TypedArrayElementSize</a></emu-xref>(<var>O</var>).</li><li>Let <var>arrayByteLength</var> be <var>O</var>.<var class="field">[[ArrayLength]]</var> × <var>elementSize</var>.</li><li>Let <var>byteOffsetEnd</var> be <var>byteOffsetStart</var> + <var>arrayByteLength</var>.</li></ol></li><li>NOTE: A 0-length <emu-xref href="#typedarray" id="_ref_5431"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> whose <var class="field">[[ByteOffset]]</var> is <var>bufferByteLength</var> is not considered out-of-bounds.</li><li>If <var>byteOffsetStart</var> &gt; <var>bufferByteLength</var> or <var>byteOffsetEnd</var> &gt; <var>bufferByteLength</var>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-istypedarrayfixedlength" type="abstract operation" aoid="IsTypedArrayFixedLength">
<h1><span class="secnum">10.4.5.15</span> IsTypedArrayFixedLength ( <var>O</var> )</h1>
<p>The abstract operation IsTypedArrayFixedLength takes argument <var>O</var> (a <emu-xref href="#typedarray" id="_ref_5432"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var>.<var class="field">[[ArrayLength]]</var> is <emu-const>auto</emu-const>, return <emu-val>false</emu-val>.</li><li>Let <var>buffer</var> be <var>O</var>.<var class="field">[[ViewedArrayBuffer]]</var>.</li><li>If <emu-xref aoid="IsFixedLengthArrayBuffer" id="_ref_5433"><a href="structured-data.html#sec-isfixedlengtharraybuffer">IsFixedLengthArrayBuffer</a></emu-xref>(<var>buffer</var>) is <emu-val>false</emu-val> and <emu-xref aoid="IsSharedArrayBuffer" id="_ref_5434"><a href="structured-data.html#sec-issharedarraybuffer">IsSharedArrayBuffer</a></emu-xref>(<var>buffer</var>) is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-isvalidintegerindex" type="abstract operation" aoid="IsValidIntegerIndex">
<h1><span class="secnum">10.4.5.16</span> IsValidIntegerIndex ( <var>O</var>, <var>index</var> )</h1>
<p>The abstract operation IsValidIntegerIndex takes arguments <var>O</var> (a <emu-xref href="#typedarray" id="_ref_5435"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>) and <var>index</var> (a Number) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <emu-xref aoid="IsDetachedBuffer" id="_ref_5436"><a href="structured-data.html#sec-isdetachedbuffer">IsDetachedBuffer</a></emu-xref>(<var>O</var>.<var class="field">[[ViewedArrayBuffer]]</var>) is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>index</var> is not an <emu-xref href="#integral-number" id="_ref_5437"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, return <emu-val>false</emu-val>.</li><li>If <var>index</var> is <emu-val>-0</emu-val><sub>𝔽</sub> or <var>index</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>false</emu-val>.</li><li>Let <var>taRecord</var> be <emu-xref aoid="MakeTypedArrayWithBufferWitnessRecord" id="_ref_5438"><a href="ordinary-and-exotic-objects-behaviours.html#sec-maketypedarraywithbufferwitnessrecord">MakeTypedArrayWithBufferWitnessRecord</a></emu-xref>(<var>O</var>, <emu-const>unordered</emu-const>).</li><li>NOTE: Bounds checking is not a synchronizing operation when <var>O</var>'s backing buffer is a <emu-xref href="#sec-fixed-length-and-growable-sharedarraybuffer-objects" id="_ref_5439"><a href="structured-data.html#sec-fixed-length-and-growable-sharedarraybuffer-objects">growable SharedArrayBuffer</a></emu-xref>.</li><li>If <emu-xref aoid="IsTypedArrayOutOfBounds" id="_ref_5440"><a href="ordinary-and-exotic-objects-behaviours.html#sec-istypedarrayoutofbounds">IsTypedArrayOutOfBounds</a></emu-xref>(<var>taRecord</var>) is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>length</var> be <emu-xref aoid="TypedArrayLength" id="_ref_5441"><a href="ordinary-and-exotic-objects-behaviours.html#sec-typedarraylength">TypedArrayLength</a></emu-xref>(<var>taRecord</var>).</li><li>If <emu-xref aoid="" id="_ref_5442"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>index</var>) ≥ <var>length</var>, return <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarraygetelement" oldids="sec-integerindexedelementget" type="abstract operation" aoid="TypedArrayGetElement"><span id="sec-integerindexedelementget"></span>
<h1><span class="secnum">10.4.5.17</span> TypedArrayGetElement ( <var>O</var>, <var>index</var> )</h1>
<p>The abstract operation TypedArrayGetElement takes arguments <var>O</var> (a <emu-xref href="#typedarray" id="_ref_5443"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>) and <var>index</var> (a Number) and returns a Number, a BigInt, or <emu-val>undefined</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <emu-xref aoid="IsValidIntegerIndex" id="_ref_5444"><a href="ordinary-and-exotic-objects-behaviours.html#sec-isvalidintegerindex">IsValidIntegerIndex</a></emu-xref>(<var>O</var>, <var>index</var>) is <emu-val>false</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Let <var>offset</var> be <var>O</var>.<var class="field">[[ByteOffset]]</var>.</li><li>Let <var>elementSize</var> be <emu-xref aoid="TypedArrayElementSize" id="_ref_5445"><a href="indexed-collections.html#sec-typedarrayelementsize">TypedArrayElementSize</a></emu-xref>(<var>O</var>).</li><li>Let <var>byteIndexInBuffer</var> be (<emu-xref aoid="" id="_ref_5446"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>index</var>) × <var>elementSize</var>) + <var>offset</var>.</li><li>Let <var>elementType</var> be <emu-xref aoid="TypedArrayElementType" id="_ref_5447"><a href="indexed-collections.html#sec-typedarrayelementtype">TypedArrayElementType</a></emu-xref>(<var>O</var>).</li><li>Return <emu-xref aoid="GetValueFromBuffer" id="_ref_5448"><a href="structured-data.html#sec-getvaluefrombuffer">GetValueFromBuffer</a></emu-xref>(<var>O</var>.<var class="field">[[ViewedArrayBuffer]]</var>, <var>byteIndexInBuffer</var>, <var>elementType</var>, <emu-val>true</emu-val>, <emu-const>unordered</emu-const>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-typedarraysetelement" oldids="sec-integerindexedelementset" type="abstract operation" aoid="TypedArraySetElement"><span id="sec-integerindexedelementset"></span>
<h1><span class="secnum">10.4.5.18</span> TypedArraySetElement ( <var>O</var>, <var>index</var>, <var>value</var> )</h1>
<p>The abstract operation TypedArraySetElement takes arguments <var>O</var> (a <emu-xref href="#typedarray" id="_ref_5449"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>), <var>index</var> (a Number), and <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5450"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5451"><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_5452"><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>If <var>O</var>.<var class="field">[[ContentType]]</var> is <emu-const>bigint</emu-const>, let <var>numValue</var> be ?&nbsp;<emu-xref aoid="ToBigInt" id="_ref_5453"><a href="abstract-operations.html#sec-tobigint" class="e-user-code">ToBigInt</a></emu-xref>(<var>value</var>).</li><li>Else, let <var>numValue</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_5454"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>value</var>).</li><li>If <emu-xref aoid="IsValidIntegerIndex" id="_ref_5455"><a href="ordinary-and-exotic-objects-behaviours.html#sec-isvalidintegerindex">IsValidIntegerIndex</a></emu-xref>(<var>O</var>, <var>index</var>) is <emu-val>true</emu-val>, then<ol><li>Let <var>offset</var> be <var>O</var>.<var class="field">[[ByteOffset]]</var>.</li><li>Let <var>elementSize</var> be <emu-xref aoid="TypedArrayElementSize" id="_ref_5456"><a href="indexed-collections.html#sec-typedarrayelementsize">TypedArrayElementSize</a></emu-xref>(<var>O</var>).</li><li>Let <var>byteIndexInBuffer</var> be (<emu-xref aoid="" id="_ref_5457"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>index</var>) × <var>elementSize</var>) + <var>offset</var>.</li><li>Let <var>elementType</var> be <emu-xref aoid="TypedArrayElementType" id="_ref_5458"><a href="indexed-collections.html#sec-typedarrayelementtype">TypedArrayElementType</a></emu-xref>(<var>O</var>).</li><li>Perform <emu-xref aoid="SetValueInBuffer" id="_ref_5459"><a href="structured-data.html#sec-setvalueinbuffer">SetValueInBuffer</a></emu-xref>(<var>O</var>.<var class="field">[[ViewedArrayBuffer]]</var>, <var>byteIndexInBuffer</var>, <var>elementType</var>, <var>numValue</var>, <emu-val>true</emu-val>, <emu-const>unordered</emu-const>).</li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This operation always appears to succeed, but it has no effect when attempting to write past the end of a <emu-xref href="#typedarray" id="_ref_5460"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> or to a <emu-xref href="#typedarray" id="_ref_5461"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> which is backed by a detached ArrayBuffer.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-isarraybufferviewoutofbounds" type="abstract operation" aoid="IsArrayBufferViewOutOfBounds">
<h1><span class="secnum">10.4.5.19</span> IsArrayBufferViewOutOfBounds ( <var>O</var> )</h1>
<p>The abstract operation IsArrayBufferViewOutOfBounds takes argument <var>O</var> (a <emu-xref href="#typedarray" id="_ref_5462"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref> or a DataView) and returns a Boolean. It checks if either any of a <emu-xref href="#typedarray" id="_ref_5463"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>'s numeric properties or a DataView object's methods can reference a value at an index not contained within the underlying data block's bounds. This abstract operation exists as a convenience for upstream specifications. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> has a <var class="field">[[DataView]]</var> internal slot, then<ol><li>Let <var>viewRecord</var> be <emu-xref aoid="MakeDataViewWithBufferWitnessRecord" id="_ref_5464"><a href="structured-data.html#sec-makedataviewwithbufferwitnessrecord">MakeDataViewWithBufferWitnessRecord</a></emu-xref>(<var>O</var>, <emu-const>seq-cst</emu-const>).</li><li>Return <emu-xref aoid="IsViewOutOfBounds" id="_ref_5465"><a href="structured-data.html#sec-isviewoutofbounds">IsViewOutOfBounds</a></emu-xref>(<var>viewRecord</var>).</li></ol></li><li>Let <var>taRecord</var> be <emu-xref aoid="MakeTypedArrayWithBufferWitnessRecord" id="_ref_5466"><a href="ordinary-and-exotic-objects-behaviours.html#sec-maketypedarraywithbufferwitnessrecord">MakeTypedArrayWithBufferWitnessRecord</a></emu-xref>(<var>O</var>, <emu-const>seq-cst</emu-const>).</li><li>Return <emu-xref aoid="IsTypedArrayOutOfBounds" id="_ref_5467"><a href="ordinary-and-exotic-objects-behaviours.html#sec-istypedarrayoutofbounds">IsTypedArrayOutOfBounds</a></emu-xref>(<var>taRecord</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects">
<h1><span class="secnum">10.4.6</span> Module Namespace Exotic Objects</h1>
<p>A <emu-xref href="#module-namespace-exotic-object" id="_ref_5468"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> is an <emu-xref href="#exotic-object" id="_ref_5469"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> that exposes the bindings exported from an ECMAScript <emu-nt id="_ref_19529"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt> (See <emu-xref href="#sec-exports" id="_ref_329"><a href="ecmascript-language-scripts-and-modules.html#sec-exports">16.2.3</a></emu-xref>). There is a one-to-one correspondence between the String-keyed own properties of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5470"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> and the binding names exported by the <emu-nt id="_ref_19530"><a href="ecmascript-language-scripts-and-modules.html#prod-Module">Module</a></emu-nt>. The exported bindings include any bindings that are indirectly exported using <code>export *</code> export items. Each String-valued own <emu-xref href="#property-key" id="_ref_5471"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> is the <emu-xref aoid="StringValue" id="_ref_5472"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of the corresponding exported binding name. These are the only String-keyed properties of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5473"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref>. Each such property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }. <emu-xref href="#module-namespace-exotic-object" id="_ref_5474"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">Module namespace exotic objects</a></emu-xref> are not extensible.</p>
<p>An object is a <dfn id="module-namespace-exotic-object" variants="module namespace exotic objects" tabindex="-1">module namespace exotic object</dfn> if its <var class="field">[[GetPrototypeOf]]</var>, <var class="field">[[SetPrototypeOf]]</var>, <var class="field">[[IsExtensible]]</var>, <var class="field">[[PreventExtensions]]</var>, <var class="field">[[GetOwnProperty]]</var>, <var class="field">[[DefineOwnProperty]]</var>, <var class="field">[[HasProperty]]</var>, <var class="field">[[Get]]</var>, <var class="field">[[Set]]</var>, <var class="field">[[Delete]]</var>, and <var class="field">[[OwnPropertyKeys]]</var> internal methods use the definitions in this section, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots" id="_ref_330"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinary-object-internal-methods-and-internal-slots">10.1</a></emu-xref>. These methods are installed by <emu-xref aoid="ModuleNamespaceCreate" id="_ref_5475"><a href="ordinary-and-exotic-objects-behaviours.html#sec-modulenamespacecreate">ModuleNamespaceCreate</a></emu-xref>.</p>
<p><emu-xref href="#module-namespace-exotic-object" id="_ref_5476"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">Module namespace exotic objects</a></emu-xref> have the internal slots defined in <emu-xref href="#table-internal-slots-of-module-namespace-exotic-objects" id="_ref_331"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-module-namespace-exotic-objects">Table 28</a></emu-xref>.</p>
<emu-table id="table-internal-slots-of-module-namespace-exotic-objects" caption="Internal Slots of Module Namespace Exotic Objects" oldids="table-29"><figure><figcaption>Table 28: Internal Slots of Module Namespace Exotic Objects</figcaption><span id="table-29"></span>
<table>
<thead>
<tr>
<th>
Internal Slot
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[Module]]</var>
</td>
<td>
a <emu-xref href="#sec-abstract-module-records" id="_ref_5477"><a href="ecmascript-language-scripts-and-modules.html#sec-abstract-module-records">Module Record</a></emu-xref>
</td>
<td>
The <emu-xref href="#sec-abstract-module-records" id="_ref_5478"><a href="ecmascript-language-scripts-and-modules.html#sec-abstract-module-records">Module Record</a></emu-xref> whose exports this namespace exposes.
</td>
</tr>
<tr>
<td>
<var class="field">[[Exports]]</var>
</td>
<td>
a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5479"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings
</td>
<td>
A <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5480"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> whose elements are the String values of the exported names exposed as own properties of this object. The list is sorted according to <emu-xref href="#lexicographic-code-unit-order" id="_ref_5481"><a href="ecmascript-data-types-and-values.html#lexicographic-code-unit-order">lexicographic code unit order</a></emu-xref>.
</td>
</tr>
</tbody></table>
</figure></emu-table>
<emu-clause id="sec-module-namespace-exotic-objects-getprototypeof" type="internal method">
<h1><span class="secnum">10.4.6.1</span> <var class="field">[[GetPrototypeOf]]</var> ( )</h1>
<p>The <var class="field">[[GetPrototypeOf]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5482"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5483"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-val>null</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-val>null</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-setprototypeof-v" type="internal method">
<h1><span class="secnum">10.4.6.2</span> <var class="field">[[SetPrototypeOf]]</var> ( <var>V</var> )</h1>
<p>The <var class="field">[[SetPrototypeOf]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5484"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes argument <var>V</var> (an Object or <emu-val>null</emu-val>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5485"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>Return !&nbsp;<emu-xref aoid="SetImmutablePrototype" id="_ref_5486"><a href="ordinary-and-exotic-objects-behaviours.html#sec-set-immutable-prototype">SetImmutablePrototype</a></emu-xref>(<var>O</var>, <var>V</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-isextensible" type="internal method">
<h1><span class="secnum">10.4.6.3</span> <var class="field">[[IsExtensible]]</var> ( )</h1>
<p>The <var class="field">[[IsExtensible]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5487"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5488"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-val>false</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-preventextensions" type="internal method">
<h1><span class="secnum">10.4.6.4</span> <var class="field">[[PreventExtensions]]</var> ( )</h1>
<p>The <var class="field">[[PreventExtensions]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5489"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5490"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-val>true</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-getownproperty-p" type="internal method">
<h1><span class="secnum">10.4.6.5</span> <var class="field">[[GetOwnProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[GetOwnProperty]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5491"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5492"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5493"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5494"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>, or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5495"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5496"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, return <emu-xref aoid="OrdinaryGetOwnProperty" id="_ref_5497"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li><li>Let <var>exports</var> be <var>O</var>.<var class="field">[[Exports]]</var>.</li><li>If <var>exports</var> does not contain <var>P</var>, return <emu-val>undefined</emu-val>.</li><li>Let <var>value</var> be ?&nbsp;<var>O</var>.<var class="field">[[Get]]</var>(<var>P</var>, <var>O</var>).</li><li>Return PropertyDescriptor { <var class="field">[[Value]]</var>: <var>value</var>, <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val>&nbsp;}.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-defineownproperty-p-desc" type="internal method">
<h1><span class="secnum">10.4.6.6</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5498"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5499"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5500"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5501"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5502"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5503"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, return !&nbsp;<emu-xref aoid="OrdinaryDefineOwnProperty" id="_ref_5504"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>, <var>Desc</var>).</li><li>Let <var>current</var> be ?&nbsp;<var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>).</li><li>If <var>current</var> is <emu-val>undefined</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Configurable]]</var> field and <var>Desc</var>.<var class="field">[[Configurable]]</var> is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has an <var class="field">[[Enumerable]]</var> field and <var>Desc</var>.<var class="field">[[Enumerable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_5505"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>Desc</var>) is <emu-val>true</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Writable]]</var> field and <var>Desc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>If <var>Desc</var> has a <var class="field">[[Value]]</var> field, return <emu-xref aoid="SameValue" id="_ref_5506"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>Desc</var>.<var class="field">[[Value]]</var>, <var>current</var>.<var class="field">[[Value]]</var>).</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-hasproperty-p" type="internal method">
<h1><span class="secnum">10.4.6.7</span> <var class="field">[[HasProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[HasProperty]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5507"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5508"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5509"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5510"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, return !&nbsp;<emu-xref aoid="OrdinaryHasProperty" id="_ref_5511"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryhasproperty">OrdinaryHasProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li><li>Let <var>exports</var> be <var>O</var>.<var class="field">[[Exports]]</var>.</li><li>If <var>exports</var> contains <var>P</var>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-get-p-receiver" type="internal method">
<h1><span class="secnum">10.4.6.8</span> <var class="field">[[Get]]</var> ( <var>P</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Get]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5512"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5513"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5514"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5515"><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_5516"><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_5517"><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>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5518"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, then<ol><li>Return !&nbsp;<emu-xref aoid="OrdinaryGet" id="_ref_5519"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryget">OrdinaryGet</a></emu-xref>(<var>O</var>, <var>P</var>, <var>Receiver</var>).</li></ol></li><li>Let <var>exports</var> be <var>O</var>.<var class="field">[[Exports]]</var>.</li><li>If <var>exports</var> does not contain <var>P</var>, return <emu-val>undefined</emu-val>.</li><li>Let <var>m</var> be <var>O</var>.<var class="field">[[Module]]</var>.</li><li>Let <var>binding</var> be <var>m</var>.<emu-xref aoid="ResolveExport" id="_ref_5520"><a href="ecmascript-language-scripts-and-modules.html#abstract-resolveexport">ResolveExport</a></emu-xref>(<var>P</var>).</li><li><emu-xref href="#assert" id="_ref_5521"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>binding</var> is a <emu-xref href="#resolvedbinding-record" id="_ref_5522"><a href="ecmascript-language-scripts-and-modules.html#resolvedbinding-record">ResolvedBinding Record</a></emu-xref>.</li><li>Let <var>targetModule</var> be <var>binding</var>.<var class="field">[[Module]]</var>.</li><li><emu-xref href="#assert" id="_ref_5523"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>targetModule</var> is not <emu-val>undefined</emu-val>.</li><li>If <var>binding</var>.<var class="field">[[BindingName]]</var> is <emu-const>namespace</emu-const>, then<ol><li>Return <emu-xref aoid="GetModuleNamespace" id="_ref_5524"><a href="ecmascript-language-scripts-and-modules.html#sec-getmodulenamespace">GetModuleNamespace</a></emu-xref>(<var>targetModule</var>).</li></ol></li><li>Let <var>targetEnv</var> be <var>targetModule</var>.<var class="field">[[Environment]]</var>.</li><li>If <var>targetEnv</var> is <emu-const>empty</emu-const>, throw a <emu-val>ReferenceError</emu-val> exception.</li><li>Return ?&nbsp;<var>targetEnv</var>.<emu-xref aoid="GetBindingValue" id="_ref_5525"><a href="executable-code-and-execution-contexts.html#abstract-getbindingvalue">GetBindingValue</a></emu-xref>(<var>binding</var>.<var class="field">[[BindingName]]</var>, <emu-val>true</emu-val>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><emu-xref aoid="ResolveExport" id="_ref_5526"><a href="ecmascript-language-scripts-and-modules.html#abstract-resolveexport">ResolveExport</a></emu-xref> is side-effect free. Each time this operation is called with a specific <var>exportName</var>, <var>resolveSet</var> pair as arguments it must return the same result. An implementation might choose to pre-compute or cache the <emu-xref aoid="ResolveExport" id="_ref_5527"><a href="ecmascript-language-scripts-and-modules.html#abstract-resolveexport">ResolveExport</a></emu-xref> results for the <var class="field">[[Exports]]</var> of each <emu-xref href="#module-namespace-exotic-object" id="_ref_5528"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-set-p-v-receiver" type="internal method">
<h1><span class="secnum">10.4.6.9</span> <var class="field">[[Set]]</var> ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Set]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5529"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5530"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5531"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5532"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5533"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-val>false</emu-val>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-delete-p" type="internal method">
<h1><span class="secnum">10.4.6.10</span> <var class="field">[[Delete]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[Delete]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5534"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5535"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5536"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>P</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_5537"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, then<ol><li>Return !&nbsp;<emu-xref aoid="OrdinaryDelete" id="_ref_5538"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarydelete">OrdinaryDelete</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></li><li>Let <var>exports</var> be <var>O</var>.<var class="field">[[Exports]]</var>.</li><li>If <var>exports</var> contains <var>P</var>, return <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-module-namespace-exotic-objects-ownpropertykeys" type="internal method">
<h1><span class="secnum">10.4.6.11</span> <var class="field">[[OwnPropertyKeys]]</var> ( )</h1>
<p>The <var class="field">[[OwnPropertyKeys]]</var> internal method of a <emu-xref href="#module-namespace-exotic-object" id="_ref_5539"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref> <var>O</var> takes no arguments and returns a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5540"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5541"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_5542"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>exports</var> be <var>O</var>.<var class="field">[[Exports]]</var>.</li><li>Let <var>symbolKeys</var> be <emu-xref aoid="OrdinaryOwnPropertyKeys" id="_ref_5543"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryownpropertykeys">OrdinaryOwnPropertyKeys</a></emu-xref>(<var>O</var>).</li><li>Return the <emu-xref href="#list-concatenation" id="_ref_5544"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>exports</var> and <var>symbolKeys</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-modulenamespacecreate" type="abstract operation" aoid="ModuleNamespaceCreate">
<h1><span class="secnum">10.4.6.12</span> ModuleNamespaceCreate ( <var>module</var>, <var>exports</var> )</h1>
<p>The abstract operation ModuleNamespaceCreate takes arguments <var>module</var> (a <emu-xref href="#sec-abstract-module-records" id="_ref_5545"><a href="ecmascript-language-scripts-and-modules.html#sec-abstract-module-records">Module Record</a></emu-xref>) and <var>exports</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5546"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns a <emu-xref href="#module-namespace-exotic-object" id="_ref_5547"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref>. It is used to specify the creation of new <emu-xref href="#module-namespace-exotic-object" id="_ref_5548"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic objects</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_5549"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>module</var>.<var class="field">[[Namespace]]</var> is <emu-const>empty</emu-const>.</li><li>Let <var>internalSlotsList</var> be the internal slots listed in <emu-xref href="#table-internal-slots-of-module-namespace-exotic-objects" id="_ref_332"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-module-namespace-exotic-objects">Table 28</a></emu-xref>.</li><li>Let <var>M</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5550"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref>(<var>internalSlotsList</var>).</li><li>Set <var>M</var>'s essential internal methods to the definitions specified in <emu-xref href="#sec-module-namespace-exotic-objects" id="_ref_333"><a href="ordinary-and-exotic-objects-behaviours.html#sec-module-namespace-exotic-objects">10.4.6</a></emu-xref>.</li><li>Set <var>M</var>.<var class="field">[[Module]]</var> to <var>module</var>.</li><li>Let <var>sortedExports</var> be a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5551"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> whose elements are the elements of <var>exports</var>, sorted according to <emu-xref href="#lexicographic-code-unit-order" id="_ref_5552"><a href="ecmascript-data-types-and-values.html#lexicographic-code-unit-order">lexicographic code unit order</a></emu-xref>.</li><li>Set <var>M</var>.<var class="field">[[Exports]]</var> to <var>sortedExports</var>.</li><li>Create own properties of <var>M</var> corresponding to the definitions in <emu-xref href="#sec-module-namespace-objects" id="_ref_334"><a href="reflection.html#sec-module-namespace-objects">28.3</a></emu-xref>.</li><li>Set <var>module</var>.<var class="field">[[Namespace]]</var> to <var>M</var>.</li><li>Return <var>M</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-immutable-prototype-exotic-objects">
<h1><span class="secnum">10.4.7</span> Immutable Prototype Exotic Objects</h1>
<p>An <emu-xref href="#immutable-prototype-exotic-object" id="_ref_5553"><a href="ordinary-and-exotic-objects-behaviours.html#immutable-prototype-exotic-object">immutable prototype exotic object</a></emu-xref> is an <emu-xref href="#exotic-object" id="_ref_5554"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> that has a <var class="field">[[Prototype]]</var> internal slot that will not change once it is initialized.</p>
<p>An object is an <dfn id="immutable-prototype-exotic-object" variants="immutable prototype exotic objects" tabindex="-1">immutable prototype exotic object</dfn> if its <var class="field">[[SetPrototypeOf]]</var> internal method uses the following implementation. (Its other essential internal methods may use any implementation, depending on the specific <emu-xref href="#immutable-prototype-exotic-object" id="_ref_5555"><a href="ordinary-and-exotic-objects-behaviours.html#immutable-prototype-exotic-object">immutable prototype exotic object</a></emu-xref> in question.)</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Unlike other <emu-xref href="#exotic-object" id="_ref_5556"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref>, there is not a dedicated creation abstract operation provided for <emu-xref href="#immutable-prototype-exotic-object" id="_ref_5557"><a href="ordinary-and-exotic-objects-behaviours.html#immutable-prototype-exotic-object">immutable prototype exotic objects</a></emu-xref>. This is because they are only used by <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_5558"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref> and by <emu-xref href="#host-environment" id="_ref_5559"><a href="overview.html#host-environment">host environments</a></emu-xref>, and in <emu-xref href="#host-environment" id="_ref_5560"><a href="overview.html#host-environment">host environments</a></emu-xref>, the relevant objects are potentially exotic in other ways and thus need their own dedicated creation operation.</p>
</div></emu-note>
<emu-clause id="sec-immutable-prototype-exotic-objects-setprototypeof-v" type="internal method">
<h1><span class="secnum">10.4.7.1</span> <var class="field">[[SetPrototypeOf]]</var> ( <var>V</var> )</h1>
<p>The <var class="field">[[SetPrototypeOf]]</var> internal method of an <emu-xref href="#immutable-prototype-exotic-object" id="_ref_5561"><a href="ordinary-and-exotic-objects-behaviours.html#immutable-prototype-exotic-object">immutable prototype exotic object</a></emu-xref> <var>O</var> takes argument <var>V</var> (an Object or <emu-val>null</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5562"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5563"><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>Return ?&nbsp;<emu-xref aoid="SetImmutablePrototype" id="_ref_5564"><a href="ordinary-and-exotic-objects-behaviours.html#sec-set-immutable-prototype" class="e-user-code">SetImmutablePrototype</a></emu-xref>(<var>O</var>, <var>V</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-set-immutable-prototype" type="abstract operation" aoid="SetImmutablePrototype">
<h1><span class="secnum">10.4.7.2</span> SetImmutablePrototype ( <var>O</var>, <var>V</var> )</h1>
<p>The abstract operation SetImmutablePrototype takes arguments <var>O</var> (an Object) and <var>V</var> (an Object or <emu-val>null</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5565"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5566"><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>current</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <emu-xref aoid="SameValue" id="_ref_5567"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>V</var>, <var>current</var>) is <emu-val>true</emu-val>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots">
<h1><span class="secnum">10.5</span> Proxy Object Internal Methods and Internal Slots</h1>
<p>A Proxy object is an <emu-xref href="#exotic-object" id="_ref_5568"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref> whose essential internal methods are partially implemented using ECMAScript code. Every Proxy object has an internal slot called <var class="field">[[ProxyHandler]]</var>. The value of <var class="field">[[ProxyHandler]]</var> is an object, called the proxy's <em>handler object</em>, or <emu-val>null</emu-val>. Methods (see <emu-xref href="#table-proxy-handler-methods" id="_ref_335"><a href="ordinary-and-exotic-objects-behaviours.html#table-proxy-handler-methods">Table 29</a></emu-xref>) of a handler object may be used to augment the implementation for one or more of the Proxy object's internal methods. Every Proxy object also has an internal slot called <var class="field">[[ProxyTarget]]</var> whose value is either an object or <emu-val>null</emu-val>. This object is called the proxy's <em>target object</em>.</p>
<p>An object is a <dfn id="proxy-exotic-object" variants="Proxy exotic objects" tabindex="-1">Proxy exotic object</dfn> if its essential internal methods (including <var class="field">[[Call]]</var> and <var class="field">[[Construct]]</var>, if applicable) use the definitions in this section. These internal methods are installed in <emu-xref aoid="ProxyCreate" id="_ref_5569"><a href="ordinary-and-exotic-objects-behaviours.html#sec-proxycreate">ProxyCreate</a></emu-xref>.</p>
<emu-table id="table-proxy-handler-methods" caption="Proxy Handler Methods" oldids="table-30"><figure><figcaption>Table 29: Proxy Handler Methods</figcaption><span id="table-30"></span>
<table>
<thead>
<tr>
<th>
Internal Method
</th>
<th>
Handler Method
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[GetPrototypeOf]]</var>
</td>
<td>
<code>getPrototypeOf</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[SetPrototypeOf]]</var>
</td>
<td>
<code>setPrototypeOf</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[IsExtensible]]</var>
</td>
<td>
<code>isExtensible</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[PreventExtensions]]</var>
</td>
<td>
<code>preventExtensions</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[GetOwnProperty]]</var>
</td>
<td>
<code>getOwnPropertyDescriptor</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[DefineOwnProperty]]</var>
</td>
<td>
<code>defineProperty</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[HasProperty]]</var>
</td>
<td>
<code>has</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[Get]]</var>
</td>
<td>
<code>get</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[Set]]</var>
</td>
<td>
<code>set</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[Delete]]</var>
</td>
<td>
<code>deleteProperty</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[OwnPropertyKeys]]</var>
</td>
<td>
<code>ownKeys</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[Call]]</var>
</td>
<td>
<code>apply</code>
</td>
</tr>
<tr>
<td>
<var class="field">[[Construct]]</var>
</td>
<td>
<code>construct</code>
</td>
</tr>
</tbody></table>
</figure></emu-table>
<p>When a handler method is called to provide the implementation of a Proxy object internal method, the handler method is passed the proxy's target object as a parameter. A proxy's handler object does not necessarily have a method corresponding to every essential internal method. Invoking an internal method on the proxy results in the invocation of the corresponding internal method on the proxy's target object if the handler object does not have a method corresponding to the internal trap.</p>
<p>The <var class="field">[[ProxyHandler]]</var> and <var class="field">[[ProxyTarget]]</var> internal slots of a Proxy object are always initialized when the object is created and typically may not be modified. Some Proxy objects are created in a manner that permits them to be subsequently <em>revoked</em>. When a proxy is revoked, its <var class="field">[[ProxyHandler]]</var> and <var class="field">[[ProxyTarget]]</var> internal slots are set to <emu-val>null</emu-val> causing subsequent invocations of internal methods on that Proxy object to throw a <emu-val>TypeError</emu-val> exception.</p>
<p>Because Proxy objects permit the implementation of internal methods to be provided by arbitrary ECMAScript code, it is possible to define a Proxy object whose handler methods violates the invariants defined in <emu-xref href="#sec-invariants-of-the-essential-internal-methods" id="_ref_336"><a href="ecmascript-data-types-and-values.html#sec-invariants-of-the-essential-internal-methods">6.1.7.3</a></emu-xref>. Some of the internal method invariants defined in <emu-xref href="#sec-invariants-of-the-essential-internal-methods" id="_ref_337"><a href="ecmascript-data-types-and-values.html#sec-invariants-of-the-essential-internal-methods">6.1.7.3</a></emu-xref> are essential integrity invariants. These invariants are explicitly enforced by the Proxy object internal methods specified in this section. An ECMAScript implementation must be robust in the presence of all possible invariant violations.</p>
<p>In the following algorithm descriptions, assume <var>O</var> is an ECMAScript Proxy object, <var>P</var> is a <emu-xref href="#property-key" id="_ref_5570"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> value, <var>V</var> is any <emu-xref href="#sec-ecmascript-language-types" id="_ref_5571"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> and <var>Desc</var> is a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5572"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> record.</p>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-getprototypeof" type="internal method">
<h1><span class="secnum">10.5.1</span> <var class="field">[[GetPrototypeOf]]</var> ( )</h1>
<p>The <var class="field">[[GetPrototypeOf]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5573"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes no arguments and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5574"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either an Object or <emu-val>null</emu-val>, or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5575"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5576"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5577"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5578"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5579"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"getPrototypeOf"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li></ol></li><li>Let <var>handlerProto</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_5580"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>&nbsp;»).</li><li>If <var>handlerProto</var> <emu-xref href="#sec-object-type" id="_ref_5581"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> and <var>handlerProto</var> is not <emu-val>null</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5582"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>extensibleTarget</var> is <emu-val>true</emu-val>, return <var>handlerProto</var>.</li><li>Let <var>targetProto</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <emu-xref aoid="SameValue" id="_ref_5583"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>handlerProto</var>, <var>targetProto</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>handlerProto</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[GetPrototypeOf]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[GetPrototypeOf]]</var> must be either an Object or <emu-val>null</emu-val>.
</li>
<li>
If the target object is not extensible, <var class="field">[[GetPrototypeOf]]</var> applied to the Proxy object must return the same value as <var class="field">[[GetPrototypeOf]]</var> applied to the Proxy object's target object.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v" type="internal method">
<h1><span class="secnum">10.5.2</span> <var class="field">[[SetPrototypeOf]]</var> ( <var>V</var> )</h1>
<p>The <var class="field">[[SetPrototypeOf]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5584"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes argument <var>V</var> (an Object or <emu-val>null</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5585"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5586"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5587"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5588"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5589"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5590"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"setPrototypeOf"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[SetPrototypeOf]]</var>(<var>V</var>)</span>.</li></ol></li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5591"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5592"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>V</var>&nbsp;»)).</li><li>If <var>booleanTrapResult</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5593"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>extensibleTarget</var> is <emu-val>true</emu-val>, return <emu-val>true</emu-val>.</li><li>Let <var>targetProto</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <emu-xref aoid="SameValue" id="_ref_5594"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>V</var>, <var>targetProto</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[SetPrototypeOf]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[SetPrototypeOf]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5595"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
If the target object is not extensible, the argument value must be the same as the result of <var class="field">[[GetPrototypeOf]]</var> applied to target object.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-isextensible" type="internal method">
<h1><span class="secnum">10.5.3</span> <var class="field">[[IsExtensible]]</var> ( )</h1>
<p>The <var class="field">[[IsExtensible]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5596"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes no arguments and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5597"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5598"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5599"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5600"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5601"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5602"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"isExtensible"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5603"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li></ol></li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5604"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5605"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>&nbsp;»)).</li><li>Let <var>targetResult</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5606"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>booleanTrapResult</var> is not <var>targetResult</var>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>booleanTrapResult</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[IsExtensible]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[IsExtensible]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5607"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
<var class="field">[[IsExtensible]]</var> applied to the Proxy object must return the same value as <var class="field">[[IsExtensible]]</var> applied to the Proxy object's target object with the same argument.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-preventextensions" type="internal method">
<h1><span class="secnum">10.5.4</span> <var class="field">[[PreventExtensions]]</var> ( )</h1>
<p>The <var class="field">[[PreventExtensions]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5608"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes no arguments and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5609"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5610"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5611"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5612"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5613"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5614"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"preventExtensions"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[PreventExtensions]]</var>()</span>.</li></ol></li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5615"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5616"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>&nbsp;»)).</li><li>If <var>booleanTrapResult</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5617"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>extensibleTarget</var> is <emu-val>true</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>Return <var>booleanTrapResult</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[PreventExtensions]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[PreventExtensions]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5618"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
<var class="field">[[PreventExtensions]]</var> applied to the Proxy object only returns <emu-val>true</emu-val> if <var class="field">[[IsExtensible]]</var> applied to the Proxy object's target object is <emu-val>false</emu-val>.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p" type="internal method">
<h1><span class="secnum">10.5.5</span> <var class="field">[[GetOwnProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[GetOwnProperty]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5619"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5620"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5621"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5622"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> or <emu-val>undefined</emu-val>, or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5623"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5624"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5625"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5626"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5627"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"getOwnPropertyDescriptor"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li></ol></li><li>Let <var>trapResultObj</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_5628"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>P</var>&nbsp;»).</li><li>If <var>trapResultObj</var> <emu-xref href="#sec-object-type" id="_ref_5629"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> and <var>trapResultObj</var> is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>targetDesc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>trapResultObj</var> is <emu-val>undefined</emu-val>, then<ol><li>If <var>targetDesc</var> is <emu-val>undefined</emu-val>, return <emu-val>undefined</emu-val>.</li><li>If <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5630"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>extensibleTarget</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <emu-val>undefined</emu-val>.</li></ol></li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5631"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>Let <var>resultDesc</var> be ?&nbsp;<emu-xref aoid="ToPropertyDescriptor" id="_ref_5632"><a href="ecmascript-data-types-and-values.html#sec-topropertydescriptor" class="e-user-code">ToPropertyDescriptor</a></emu-xref>(<var>trapResultObj</var>).</li><li>Perform <emu-xref aoid="CompletePropertyDescriptor" id="_ref_5633"><a href="ecmascript-data-types-and-values.html#sec-completepropertydescriptor">CompletePropertyDescriptor</a></emu-xref>(<var>resultDesc</var>).</li><li>Let <var>valid</var> be <emu-xref aoid="IsCompatiblePropertyDescriptor" id="_ref_5634"><a href="ordinary-and-exotic-objects-behaviours.html#sec-iscompatiblepropertydescriptor">IsCompatiblePropertyDescriptor</a></emu-xref>(<var>extensibleTarget</var>, <var>resultDesc</var>, <var>targetDesc</var>).</li><li>If <var>valid</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>resultDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <var>targetDesc</var> is <emu-val>undefined</emu-val> or <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>true</emu-val>, then<ol><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>If <var>resultDesc</var> has a <var class="field">[[Writable]]</var> field and <var>resultDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, then<ol><li><emu-xref href="#assert" id="_ref_5635"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>targetDesc</var> has a <var class="field">[[Writable]]</var> field.</li><li>If <var>targetDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>true</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li></ol></li><li>Return <var>resultDesc</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[GetOwnProperty]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[GetOwnProperty]]</var> must be either an Object or <emu-val>undefined</emu-val>.
</li>
<li>
A property cannot be reported as non-existent, if it exists as a non-configurable own property of the target object.
</li>
<li>
A property cannot be reported as non-existent, if it exists as an own property of a non-extensible target object.
</li>
<li>
A property cannot be reported as existent, if it does not exist as an own property of the target object and the target object is not extensible.
</li>
<li>
A property cannot be reported as non-configurable, unless it exists as a non-configurable own property of the target object.
</li>
<li>
A property cannot be reported as both non-configurable and non-writable, unless it exists as a non-configurable, non-writable own property of the target object.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc" type="internal method">
<h1><span class="secnum">10.5.6</span> <var class="field">[[DefineOwnProperty]]</var> ( <var>P</var>, <var>Desc</var> )</h1>
<p>The <var class="field">[[DefineOwnProperty]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5636"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5637"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Desc</var> (a <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5638"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5639"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5640"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5641"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5642"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5643"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5644"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"defineProperty"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[DefineOwnProperty]]</var>(<var>P</var>, <var>Desc</var>)</span>.</li></ol></li><li>Let <var>descObj</var> be <emu-xref aoid="FromPropertyDescriptor" id="_ref_5645"><a href="ecmascript-data-types-and-values.html#sec-frompropertydescriptor">FromPropertyDescriptor</a></emu-xref>(<var>Desc</var>).</li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5646"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5647"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>P</var>, <var>descObj</var>&nbsp;»)).</li><li>If <var>booleanTrapResult</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>targetDesc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5648"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>Desc</var> has a <var class="field">[[Configurable]]</var> field and <var>Desc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, then<ol><li>Let <var>settingConfigFalse</var> be <emu-val>true</emu-val>.</li></ol></li><li>Else,<ol><li>Let <var>settingConfigFalse</var> be <emu-val>false</emu-val>.</li></ol></li><li>If <var>targetDesc</var> is <emu-val>undefined</emu-val>, then<ol><li>If <var>extensibleTarget</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>settingConfigFalse</var> is <emu-val>true</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>Else,<ol><li>If <emu-xref aoid="IsCompatiblePropertyDescriptor" id="_ref_5649"><a href="ordinary-and-exotic-objects-behaviours.html#sec-iscompatiblepropertydescriptor">IsCompatiblePropertyDescriptor</a></emu-xref>(<var>extensibleTarget</var>, <var>Desc</var>, <var>targetDesc</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>settingConfigFalse</var> is <emu-val>true</emu-val> and <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>true</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <emu-xref aoid="IsDataDescriptor" id="_ref_5650"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>targetDesc</var>) is <emu-val>true</emu-val>, <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, and <var>targetDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>true</emu-val>, then<ol><li>If <var>Desc</var> has a <var class="field">[[Writable]]</var> field and <var>Desc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[DefineOwnProperty]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[DefineOwnProperty]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5651"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
A property cannot be added, if the target object is not extensible.
</li>
<li>
A property cannot be non-configurable, unless there exists a corresponding non-configurable own property of the target object.
</li>
<li>
A non-configurable property cannot be non-writable, unless there exists a corresponding non-configurable, non-writable own property of the target object.
</li>
<li>
If a property has a corresponding target object property then applying the <emu-xref href="#sec-property-descriptor-specification-type" id="_ref_5652"><a href="ecmascript-data-types-and-values.html#sec-property-descriptor-specification-type">Property Descriptor</a></emu-xref> of the property to the target object using <var class="field">[[DefineOwnProperty]]</var> will not throw an exception.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p" type="internal method">
<h1><span class="secnum">10.5.7</span> <var class="field">[[HasProperty]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[HasProperty]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5653"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5654"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5655"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5656"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5657"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5658"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5659"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5660"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"has"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[HasProperty]]</var>(<var>P</var>)</span>.</li></ol></li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5661"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5662"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>P</var>&nbsp;»)).</li><li>If <var>booleanTrapResult</var> is <emu-val>false</emu-val>, then<ol><li>Let <var>targetDesc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>targetDesc</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5663"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>extensibleTarget</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li></ol></li><li>Return <var>booleanTrapResult</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[HasProperty]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[HasProperty]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5664"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
A property cannot be reported as non-existent, if it exists as a non-configurable own property of the target object.
</li>
<li>
A property cannot be reported as non-existent, if it exists as an own property of the target object and the target object is not extensible.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver" type="internal method">
<h1><span class="secnum">10.5.8</span> <var class="field">[[Get]]</var> ( <var>P</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Get]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5665"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5666"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5667"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5668"><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_5669"><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_5670"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5671"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5672"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5673"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5674"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"get"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[Get]]</var>(<var>P</var>, <var>Receiver</var>)</span>.</li></ol></li><li>Let <var>trapResult</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_5675"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>P</var>, <var>Receiver</var>&nbsp;»).</li><li>Let <var>targetDesc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>targetDesc</var> is not <emu-val>undefined</emu-val> and <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <emu-xref aoid="IsDataDescriptor" id="_ref_5676"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>targetDesc</var>) is <emu-val>true</emu-val> and <var>targetDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <emu-xref aoid="SameValue" id="_ref_5677"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>trapResult</var>, <var>targetDesc</var>.<var class="field">[[Value]]</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_5678"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>targetDesc</var>) is <emu-val>true</emu-val> and <var>targetDesc</var>.<var class="field">[[Get]]</var> is <emu-val>undefined</emu-val>, then<ol><li>If <var>trapResult</var> is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li></ol></li><li>Return <var>trapResult</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[Get]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The value reported for a property must be the same as the value of the corresponding target object property if the target object property is a non-writable, non-configurable own <emu-xref href="#sec-object-type" id="_ref_5679"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref>.
</li>
<li>
The value reported for a property must be <emu-val>undefined</emu-val> if the corresponding target object property is a non-configurable own <emu-xref href="#sec-object-type" id="_ref_5680"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> that has <emu-val>undefined</emu-val> as its <var class="field">[[Get]]</var> attribute.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver" type="internal method">
<h1><span class="secnum">10.5.9</span> <var class="field">[[Set]]</var> ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</h1>
<p>The <var class="field">[[Set]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5681"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes arguments <var>P</var> (a <emu-xref href="#property-key" id="_ref_5682"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>), <var>V</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5683"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), and <var>Receiver</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5684"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5685"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5686"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5687"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5688"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5689"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5690"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"set"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[Set]]</var>(<var>P</var>, <var>V</var>, <var>Receiver</var>)</span>.</li></ol></li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5691"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5692"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>P</var>, <var>V</var>, <var>Receiver</var>&nbsp;»)).</li><li>If <var>booleanTrapResult</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>targetDesc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>targetDesc</var> is not <emu-val>undefined</emu-val> and <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <emu-xref aoid="IsDataDescriptor" id="_ref_5693"><a href="ecmascript-data-types-and-values.html#sec-isdatadescriptor">IsDataDescriptor</a></emu-xref>(<var>targetDesc</var>) is <emu-val>true</emu-val> and <var>targetDesc</var>.<var class="field">[[Writable]]</var> is <emu-val>false</emu-val>, then<ol><li>If <emu-xref aoid="SameValue" id="_ref_5694"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>V</var>, <var>targetDesc</var>.<var class="field">[[Value]]</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_5695"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>targetDesc</var>) is <emu-val>true</emu-val>, then<ol><li>If <var>targetDesc</var>.<var class="field">[[Set]]</var> is <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li></ol></li></ol></li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[Set]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[Set]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5696"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
Cannot change the value of a property to be different from the value of the corresponding target object property if the corresponding target object property is a non-writable, non-configurable own <emu-xref href="#sec-object-type" id="_ref_5697"><a href="ecmascript-data-types-and-values.html#sec-object-type">data property</a></emu-xref>.
</li>
<li>
Cannot set the value of a property if the corresponding target object property is a non-configurable own <emu-xref href="#sec-object-type" id="_ref_5698"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> that has <emu-val>undefined</emu-val> as its <var class="field">[[Set]]</var> attribute.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-delete-p" type="internal method">
<h1><span class="secnum">10.5.10</span> <var class="field">[[Delete]]</var> ( <var>P</var> )</h1>
<p>The <var class="field">[[Delete]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5699"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes argument <var>P</var> (a <emu-xref href="#property-key" id="_ref_5700"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5701"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5702"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5703"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5704"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5705"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5706"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"deleteProperty"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[Delete]]</var>(<var>P</var>)</span>.</li></ol></li><li>Let <var>booleanTrapResult</var> be <emu-xref aoid="ToBoolean" id="_ref_5707"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_5708"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>P</var>&nbsp;»)).</li><li>If <var>booleanTrapResult</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li><li>Let <var>targetDesc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>P</var>)</span>.</li><li>If <var>targetDesc</var> is <emu-val>undefined</emu-val>, return <emu-val>true</emu-val>.</li><li>If <var>targetDesc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5709"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>If <var>extensibleTarget</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[Delete]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[Delete]]</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_5710"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref> value.
</li>
<li>
A property cannot be reported as deleted, if it exists as a non-configurable own property of the target object.
</li>
<li>
A property cannot be reported as deleted, if it exists as an own property of the target object and the target object is non-extensible.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys" type="internal method">
<h1><span class="secnum">10.5.11</span> <var class="field">[[OwnPropertyKeys]]</var> ( )</h1>
<p>The <var class="field">[[OwnPropertyKeys]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5711"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes no arguments and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5712"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5713"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_5714"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5715"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5716"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5717"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5718"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5719"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"ownKeys"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li></ol></li><li>Let <var>trapResultArray</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_5720"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>&nbsp;»).</li><li>Let <var>trapResult</var> be ?&nbsp;<emu-xref aoid="CreateListFromArrayLike" id="_ref_5721"><a href="abstract-operations.html#sec-createlistfromarraylike" class="e-user-code">CreateListFromArrayLike</a></emu-xref>(<var>trapResultArray</var>, <emu-const>property-key</emu-const>).</li><li>If <var>trapResult</var> contains any duplicate entries, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>extensibleTarget</var> be ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_5722"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>target</var>).</li><li>Let <var>targetKeys</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li><li><emu-xref href="#assert" id="_ref_5723"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>targetKeys</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5724"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_5725"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>.</li><li><emu-xref href="#assert" id="_ref_5726"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>targetKeys</var> contains no duplicate entries.</li><li>Let <var>targetConfigurableKeys</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5727"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Let <var>targetNonconfigurableKeys</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5728"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>key</var> of <var>targetKeys</var>, do<ol><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>target</var>.<var class="field">[[GetOwnProperty]]</var>(<var>key</var>)</span>.</li><li>If <var>desc</var> is not <emu-val>undefined</emu-val> and <var>desc</var>.<var class="field">[[Configurable]]</var> is <emu-val>false</emu-val>, then<ol><li>Append <var>key</var> to <var>targetNonconfigurableKeys</var>.</li></ol></li><li>Else,<ol><li>Append <var>key</var> to <var>targetConfigurableKeys</var>.</li></ol></li></ol></li><li>If <var>extensibleTarget</var> is <emu-val>true</emu-val> and <var>targetNonconfigurableKeys</var> is empty, then<ol><li>Return <var>trapResult</var>.</li></ol></li><li>Let <var>uncheckedResultKeys</var> be a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5729"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> whose elements are the elements of <var>trapResult</var>.</li><li>For each element <var>key</var> of <var>targetNonconfigurableKeys</var>, do<ol><li>If <var>uncheckedResultKeys</var> does not contain <var>key</var>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Remove <var>key</var> from <var>uncheckedResultKeys</var>.</li></ol></li><li>If <var>extensibleTarget</var> is <emu-val>true</emu-val>, return <var>trapResult</var>.</li><li>For each element <var>key</var> of <var>targetConfigurableKeys</var>, do<ol><li>If <var>uncheckedResultKeys</var> does not contain <var>key</var>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Remove <var>key</var> from <var>uncheckedResultKeys</var>.</li></ol></li><li>If <var>uncheckedResultKeys</var> is not empty, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>trapResult</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var class="field">[[OwnPropertyKeys]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[OwnPropertyKeys]]</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5730"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.
</li>
<li>
The returned <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5731"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> contains no duplicate entries.
</li>
<li>
Each element of the returned <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5732"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> is a <emu-xref href="#property-key" id="_ref_5733"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>.
</li>
<li>
The result <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5734"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> must contain the keys of all non-configurable own properties of the target object.
</li>
<li>
If the target object is not extensible, then the result <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5735"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> must contain all the keys of the own properties of the target object and no other values.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist" type="internal method">
<h1><span class="secnum">10.5.12</span> <var class="field">[[Call]]</var> ( <var>thisArgument</var>, <var>argumentsList</var> )</h1>
<p>The <var class="field">[[Call]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5736"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes arguments <var>thisArgument</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5737"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5738"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5739"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5740"><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_5741"><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_5742"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5743"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5744"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5745"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5746"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"apply"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<emu-xref aoid="Call" id="_ref_5747"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>target</var>, <var>thisArgument</var>, <var>argumentsList</var>).</li></ol></li><li>Let <var>argArray</var> be <emu-xref aoid="CreateArrayFromList" id="_ref_5748"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>argumentsList</var>).</li><li>Return ?&nbsp;<emu-xref aoid="Call" id="_ref_5749"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>thisArgument</var>, <var>argArray</var>&nbsp;»).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>A <emu-xref href="#proxy-exotic-object" id="_ref_5750"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> only has a <var class="field">[[Call]]</var> internal method if the initial value of its <var class="field">[[ProxyTarget]]</var> internal slot is an object that has a <var class="field">[[Call]]</var> internal method.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget" type="internal method">
<h1><span class="secnum">10.5.13</span> <var class="field">[[Construct]]</var> ( <var>argumentsList</var>, <var>newTarget</var> )</h1>
<p>The <var class="field">[[Construct]]</var> internal method of a <emu-xref href="#proxy-exotic-object" id="_ref_5751"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> <var>O</var> takes arguments <var>argumentsList</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_5752"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-ecmascript-language-types" id="_ref_5753"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>) and <var>newTarget</var> (a <emu-xref href="#constructor" id="_ref_5754"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5755"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an Object or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5756"><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>Perform ?&nbsp;<emu-xref aoid="ValidateNonRevokedProxy" id="_ref_5757"><a href="ordinary-and-exotic-objects-behaviours.html#sec-validatenonrevokedproxy">ValidateNonRevokedProxy</a></emu-xref>(<var>O</var>).</li><li>Let <var>target</var> be <var>O</var>.<var class="field">[[ProxyTarget]]</var>.</li><li><emu-xref href="#assert" id="_ref_5758"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <emu-xref aoid="IsConstructor" id="_ref_5759"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>target</var>) is <emu-val>true</emu-val>.</li><li>Let <var>handler</var> be <var>O</var>.<var class="field">[[ProxyHandler]]</var>.</li><li><emu-xref href="#assert" id="_ref_5760"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5761"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li>Let <var>trap</var> be ?&nbsp;<emu-xref aoid="GetMethod" id="_ref_5762"><a href="abstract-operations.html#sec-getmethod" class="e-user-code">GetMethod</a></emu-xref>(<var>handler</var>, <emu-val>"construct"</emu-val>).</li><li>If <var>trap</var> is <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<emu-xref aoid="Construct" id="_ref_5763"><a href="abstract-operations.html#sec-construct" class="e-user-code">Construct</a></emu-xref>(<var>target</var>, <var>argumentsList</var>, <var>newTarget</var>).</li></ol></li><li>Let <var>argArray</var> be <emu-xref aoid="CreateArrayFromList" id="_ref_5764"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>argumentsList</var>).</li><li>Let <var>newObj</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_5765"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>trap</var>, <var>handler</var>, « <var>target</var>, <var>argArray</var>, <var>newTarget</var>&nbsp;»).</li><li>If <var>newObj</var> <emu-xref href="#sec-object-type" id="_ref_5766"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>newObj</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>A <emu-xref href="#proxy-exotic-object" id="_ref_5767"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> only has a <var class="field">[[Construct]]</var> internal method if the initial value of its <var class="field">[[ProxyTarget]]</var> internal slot is an object that has a <var class="field">[[Construct]]</var> internal method.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p><var class="field">[[Construct]]</var> for Proxy objects enforces the following invariants:</p>
<ul>
<li>
The result of <var class="field">[[Construct]]</var> must be an Object.
</li>
</ul>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-validatenonrevokedproxy" type="abstract operation" aoid="ValidateNonRevokedProxy">
<h1><span class="secnum">10.5.14</span> ValidateNonRevokedProxy ( <var>proxy</var> )</h1>
<p>The abstract operation ValidateNonRevokedProxy takes argument <var>proxy</var> (a <emu-xref href="#proxy-exotic-object" id="_ref_5768"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5769"><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_5770"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It throws a <emu-val>TypeError</emu-val> exception if <var>proxy</var> has been revoked. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>proxy</var>.<var class="field">[[ProxyTarget]]</var> is <emu-val>null</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li><emu-xref href="#assert" id="_ref_5771"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>proxy</var>.<var class="field">[[ProxyHandler]]</var> is not <emu-val>null</emu-val>.</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-proxycreate" type="abstract operation" aoid="ProxyCreate">
<h1><span class="secnum">10.5.15</span> ProxyCreate ( <var>target</var>, <var>handler</var> )</h1>
<p>The abstract operation ProxyCreate takes arguments <var>target</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5772"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>handler</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_5773"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5774"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#proxy-exotic-object" id="_ref_5775"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_5776"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It is used to specify the creation of new Proxy objects. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>target</var> <emu-xref href="#sec-object-type" id="_ref_5777"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>handler</var> <emu-xref href="#sec-object-type" id="_ref_5778"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>P</var> be <emu-xref aoid="MakeBasicObject" id="_ref_5779"><a href="abstract-operations.html#sec-makebasicobject">MakeBasicObject</a></emu-xref><var class="field">[[ProxyHandler]]</var>, <var class="field">[[ProxyTarget]]</var>&nbsp;»).</li><li>Set <var>P</var>'s essential internal methods, except for <var class="field">[[Call]]</var> and <var class="field">[[Construct]]</var>, to the definitions specified in <emu-xref href="#sec-proxy-object-internal-methods-and-internal-slots" id="_ref_338"><a href="ordinary-and-exotic-objects-behaviours.html#sec-proxy-object-internal-methods-and-internal-slots">10.5</a></emu-xref>.</li><li>If <emu-xref aoid="IsCallable" id="_ref_5780"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>target</var>) is <emu-val>true</emu-val>, then<ol><li>Set <var>P</var>.<var class="field">[[Call]]</var> as specified in <emu-xref href="#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist" id="_ref_339"><a href="ordinary-and-exotic-objects-behaviours.html#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist">10.5.12</a></emu-xref>.</li><li>If <emu-xref aoid="IsConstructor" id="_ref_5781"><a href="abstract-operations.html#sec-isconstructor">IsConstructor</a></emu-xref>(<var>target</var>) is <emu-val>true</emu-val>, then<ol><li>Set <var>P</var>.<var class="field">[[Construct]]</var> as specified in <emu-xref href="#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget" id="_ref_340"><a href="ordinary-and-exotic-objects-behaviours.html#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget">10.5.13</a></emu-xref>.</li></ol></li></ol></li><li>Set <var>P</var>.<var class="field">[[ProxyTarget]]</var> to <var>target</var>.</li><li>Set <var>P</var>.<var class="field">[[ProxyHandler]]</var> to <var>handler</var>.</li><li>Return <var>P</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause></div></body></html>