Files
ask262/spec-built/multipage/fundamental-objects.html
T

1120 lines
182 KiB
HTML
Raw 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-fundamental-objects"></head>
<body><div id="spec-container"><emu-clause id="sec-fundamental-objects">
<h1><span class="secnum">20</span> Fundamental Objects</h1>
<emu-clause id="sec-object-objects">
<h1><span class="secnum">20.1</span> Object Objects</h1>
<emu-clause id="sec-object-constructor">
<h1><span class="secnum">20.1.1</span> The Object Constructor</h1>
<p>The Object <emu-xref href="#constructor" id="_ref_9730"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Object%</dfn>.</li>
<li>is the initial value of the <emu-val>"Object"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_9731"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates a new <emu-xref href="#ordinary-object" id="_ref_9732"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> when called as a <emu-xref href="#constructor" id="_ref_9733"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>performs a type conversion when called as a function rather than as a <emu-xref href="#constructor" id="_ref_9734"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition.</li>
</ul>
<emu-clause id="sec-object-value" type="built-in function">
<h1><span class="secnum">20.1.1.1</span> Object ( <var>value</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is neither <emu-val>undefined</emu-val> nor the <emu-xref href="#active-function-object" id="_ref_9735"><a href="executable-code-and-execution-contexts.html#active-function-object">active function object</a></emu-xref>, then<ol><li>Return ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_9736"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(NewTarget, <emu-val>"%Object.prototype%"</emu-val>).</li></ol></li><li>If <var>value</var> is either <emu-val>undefined</emu-val> or <emu-val>null</emu-val>, return <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9737"><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_9738"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>).</li><li>Return !&nbsp;<emu-xref aoid="ToObject" id="_ref_9739"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>value</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-object-constructor">
<h1><span class="secnum">20.1.2</span> Properties of the Object Constructor</h1>
<p>The Object <emu-xref href="#constructor" id="_ref_9740"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_9741"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has the following additional properties:</li>
</ul>
<emu-clause id="sec-object.assign" type="built-in function">
<h1><span class="secnum">20.1.2.1</span> Object.assign ( <var>target</var>, ...<var>sources</var> )</h1>
<p>This function copies the values of all of the enumerable own properties from one or more source objects to a <var>target</var> object.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>to</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9742"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>target</var>).</li><li>If only one argument was passed, return <var>to</var>.</li><li>For each element <var>nextSource</var> of <var>sources</var>, do<ol><li>If <var>nextSource</var> is neither <emu-val>undefined</emu-val> nor <emu-val>null</emu-val>, then<ol><li>Let <var>from</var> be !&nbsp;<emu-xref aoid="ToObject" id="_ref_9743"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>nextSource</var>).</li><li>Let <var>keys</var> be ?&nbsp;<span class="e-user-code"><var>from</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li><li>For each element <var>nextKey</var> of <var>keys</var>, do<ol><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>from</var>.<var class="field">[[GetOwnProperty]]</var>(<var>nextKey</var>)</span>.</li><li>If <var>desc</var> is not <emu-val>undefined</emu-val> and <var>desc</var>.<var class="field">[[Enumerable]]</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>propValue</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_9744"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>from</var>, <var>nextKey</var>).</li><li>Perform ?&nbsp;<emu-xref aoid="Set" id="_ref_9745"><a href="abstract-operations.html#sec-set-o-p-v-throw" class="e-user-code">Set</a></emu-xref>(<var>to</var>, <var>nextKey</var>, <var>propValue</var>, <emu-val>true</emu-val>).</li></ol></li></ol></li></ol></li></ol></li><li>Return <var>to</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this function is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
</emu-clause>
<emu-clause id="sec-object.create" type="built-in function">
<h1><span class="secnum">20.1.2.2</span> Object.create ( <var>O</var>, <var>Properties</var> )</h1>
<p>This function creates a new object with a specified prototype.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9746"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> and <var>O</var> is not <emu-val>null</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>obj</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9747"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<var>O</var>).</li><li>If <var>Properties</var> is not <emu-val>undefined</emu-val>, then<ol><li>Return ?&nbsp;<emu-xref aoid="ObjectDefineProperties" id="_ref_9748"><a href="fundamental-objects.html#sec-objectdefineproperties" class="e-user-code">ObjectDefineProperties</a></emu-xref>(<var>obj</var>, <var>Properties</var>).</li></ol></li><li>Return <var>obj</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.defineproperties" type="built-in function">
<h1><span class="secnum">20.1.2.3</span> Object.defineProperties ( <var>O</var>, <var>Properties</var> )</h1>
<p>This function adds own properties and/or updates the attributes of existing own properties of an object.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9749"><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 ?&nbsp;<emu-xref aoid="ObjectDefineProperties" id="_ref_9750"><a href="fundamental-objects.html#sec-objectdefineproperties" class="e-user-code">ObjectDefineProperties</a></emu-xref>(<var>O</var>, <var>Properties</var>).</li></ol></emu-alg>
<emu-clause id="sec-objectdefineproperties" type="abstract operation" aoid="ObjectDefineProperties">
<h1><span class="secnum">20.1.2.3.1</span> ObjectDefineProperties ( <var>O</var>, <var>Properties</var> )</h1>
<p>The abstract operation ObjectDefineProperties takes arguments <var>O</var> (an Object) and <var>Properties</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_9751"><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_9752"><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_9753"><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>props</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9754"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>Properties</var>).</li><li>Let <var>keys</var> be ?&nbsp;<span class="e-user-code"><var>props</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li><li>Let <var>descriptors</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9755"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>nextKey</var> of <var>keys</var>, do<ol><li>Let <var>propDesc</var> be ?&nbsp;<span class="e-user-code"><var>props</var>.<var class="field">[[GetOwnProperty]]</var>(<var>nextKey</var>)</span>.</li><li>If <var>propDesc</var> is not <emu-val>undefined</emu-val> and <var>propDesc</var>.<var class="field">[[Enumerable]]</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>descObj</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_9756"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>props</var>, <var>nextKey</var>).</li><li>Let <var>desc</var> be ?&nbsp;<emu-xref aoid="ToPropertyDescriptor" id="_ref_9757"><a href="ecmascript-data-types-and-values.html#sec-topropertydescriptor" class="e-user-code">ToPropertyDescriptor</a></emu-xref>(<var>descObj</var>).</li><li>Append the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9758"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> { <var class="field">[[Key]]</var>: <var>nextKey</var>, <var class="field">[[Descriptor]]</var>: <var>desc</var>&nbsp;} to <var>descriptors</var>.</li></ol></li></ol></li><li>For each element <var>property</var> of <var>descriptors</var>, do<ol><li>Perform ?&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_9759"><a href="abstract-operations.html#sec-definepropertyorthrow" class="e-user-code">DefinePropertyOrThrow</a></emu-xref>(<var>O</var>, <var>property</var>.<var class="field">[[Key]]</var>, <var>property</var>.<var class="field">[[Descriptor]]</var>).</li></ol></li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-object.defineproperty" type="built-in function">
<h1><span class="secnum">20.1.2.4</span> Object.defineProperty ( <var>O</var>, <var>P</var>, <var>Attributes</var> )</h1>
<p>This function adds an own property and/or updates the attributes of an existing own property of an object.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9760"><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>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9761"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Let <var>desc</var> be ?&nbsp;<emu-xref aoid="ToPropertyDescriptor" id="_ref_9762"><a href="ecmascript-data-types-and-values.html#sec-topropertydescriptor" class="e-user-code">ToPropertyDescriptor</a></emu-xref>(<var>Attributes</var>).</li><li>Perform ?&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_9763"><a href="abstract-operations.html#sec-definepropertyorthrow" class="e-user-code">DefinePropertyOrThrow</a></emu-xref>(<var>O</var>, <var>key</var>, <var>desc</var>).</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.entries" type="built-in function">
<h1><span class="secnum">20.1.2.5</span> Object.entries ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9764"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>entryList</var> be ?&nbsp;<emu-xref aoid="EnumerableOwnProperties" id="_ref_9765"><a href="abstract-operations.html#sec-enumerableownproperties" class="e-user-code">EnumerableOwnProperties</a></emu-xref>(<var>obj</var>, <emu-const>key+value</emu-const>).</li><li>Return <emu-xref aoid="CreateArrayFromList" id="_ref_9766"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>entryList</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.freeze" type="built-in function">
<h1><span class="secnum">20.1.2.6</span> Object.freeze ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9767"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <var>O</var>.</li><li>Let <var>status</var> be ?&nbsp;<emu-xref aoid="SetIntegrityLevel" id="_ref_9768"><a href="abstract-operations.html#sec-setintegritylevel" class="e-user-code">SetIntegrityLevel</a></emu-xref>(<var>O</var>, <emu-const>frozen</emu-const>).</li><li>If <var>status</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.fromentries" oldids="sec-create-data-property-on-object-functions" type="built-in function"><span id="sec-create-data-property-on-object-functions"></span>
<h1><span class="secnum">20.1.2.7</span> Object.fromEntries ( <var>iterable</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="RequireObjectCoercible" id="_ref_9769"><a href="abstract-operations.html#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(<var>iterable</var>).</li><li>Let <var>obj</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9770"><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_9771"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>).</li><li><emu-xref href="#assert" id="_ref_9772"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>obj</var> is an extensible <emu-xref href="#ordinary-object" id="_ref_9773"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> with no own properties.</li><li>Let <var>closure</var> be a new <emu-xref href="#sec-abstract-closure" id="_ref_9774"><a href="ecmascript-data-types-and-values.html#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>key</var>, <var>value</var>) that captures <var>obj</var> and performs the following steps when called:<ol><li>Let <var>propertyKey</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9775"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>key</var>).</li><li>Perform !&nbsp;<emu-xref aoid="CreateDataPropertyOrThrow" id="_ref_9776"><a href="abstract-operations.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>obj</var>, <var>propertyKey</var>, <var>value</var>).</li><li>Return <emu-xref aoid="NormalCompletion" id="_ref_9777"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li></ol></li><li>Let <var>adder</var> be <emu-xref aoid="CreateBuiltinFunction" id="_ref_9778"><a href="ordinary-and-exotic-objects-behaviours.html#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>closure</var>, 2, <emu-val>""</emu-val>, «&nbsp;»).</li><li>Return ?&nbsp;<emu-xref aoid="AddEntriesFromIterable" id="_ref_9779"><a href="keyed-collections.html#sec-add-entries-from-iterable" class="e-user-code">AddEntriesFromIterable</a></emu-xref>(<var>obj</var>, <var>iterable</var>, <var>adder</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
The function created for <var>adder</var> is never directly accessible to ECMAScript code.
</div></emu-note>
</emu-clause>
<emu-clause id="sec-object.getownpropertydescriptor" type="built-in function">
<h1><span class="secnum">20.1.2.8</span> Object.getOwnPropertyDescriptor ( <var>O</var>, <var>P</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9780"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9781"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>obj</var>.<var class="field">[[GetOwnProperty]]</var>(<var>key</var>)</span>.</li><li>Return <emu-xref aoid="FromPropertyDescriptor" id="_ref_9782"><a href="ecmascript-data-types-and-values.html#sec-frompropertydescriptor">FromPropertyDescriptor</a></emu-xref>(<var>desc</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.getownpropertydescriptors" type="built-in function">
<h1><span class="secnum">20.1.2.9</span> Object.getOwnPropertyDescriptors ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9783"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>ownKeys</var> be ?&nbsp;<span class="e-user-code"><var>obj</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li><li>Let <var>descriptors</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9784"><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_9785"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>).</li><li>For each element <var>key</var> of <var>ownKeys</var>, do<ol><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>obj</var>.<var class="field">[[GetOwnProperty]]</var>(<var>key</var>)</span>.</li><li>Let <var>descriptor</var> be <emu-xref aoid="FromPropertyDescriptor" id="_ref_9786"><a href="ecmascript-data-types-and-values.html#sec-frompropertydescriptor">FromPropertyDescriptor</a></emu-xref>(<var>desc</var>).</li><li>If <var>descriptor</var> is not <emu-val>undefined</emu-val>, perform !&nbsp;<emu-xref aoid="CreateDataPropertyOrThrow" id="_ref_9787"><a href="abstract-operations.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>descriptors</var>, <var>key</var>, <var>descriptor</var>).</li></ol></li><li>Return <var>descriptors</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.getownpropertynames" type="built-in function">
<h1><span class="secnum">20.1.2.10</span> Object.getOwnPropertyNames ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="CreateArrayFromList" id="_ref_9788"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(? <emu-xref aoid="GetOwnPropertyKeys" id="_ref_9789"><a href="fundamental-objects.html#sec-getownpropertykeys" class="e-user-code">GetOwnPropertyKeys</a></emu-xref>(<var>O</var>, <emu-const>string</emu-const>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.getownpropertysymbols" type="built-in function">
<h1><span class="secnum">20.1.2.11</span> Object.getOwnPropertySymbols ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="CreateArrayFromList" id="_ref_9790"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(? <emu-xref aoid="GetOwnPropertyKeys" id="_ref_9791"><a href="fundamental-objects.html#sec-getownpropertykeys" class="e-user-code">GetOwnPropertyKeys</a></emu-xref>(<var>O</var>, <emu-const>symbol</emu-const>)).</li></ol></emu-alg>
<emu-clause id="sec-getownpropertykeys" type="abstract operation" aoid="GetOwnPropertyKeys">
<h1><span class="secnum">20.1.2.11.1</span> GetOwnPropertyKeys ( <var>O</var>, <var>type</var> )</h1>
<p>The abstract operation GetOwnPropertyKeys takes arguments <var>O</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_9792"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>type</var> (<emu-const>string</emu-const> or <emu-const>symbol</emu-const>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_9793"><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_9794"><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_9795"><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_9796"><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>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9797"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>keys</var> be ?&nbsp;<span class="e-user-code"><var>obj</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li><li>Let <var>nameList</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9798"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>nextKey</var> of <var>keys</var>, do<ol><li>If <var>nextKey</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_9799"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref> and <var>type</var> is <emu-const>symbol</emu-const>, or if <var>nextKey</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_9800"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref> and <var>type</var> is <emu-const>string</emu-const>, then<ol><li>Append <var>nextKey</var> to <var>nameList</var>.</li></ol></li></ol></li><li>Return <var>nameList</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-object.getprototypeof" type="built-in function">
<h1><span class="secnum">20.1.2.12</span> Object.getPrototypeOf ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9801"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Return ?&nbsp;<span class="e-user-code"><var>obj</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.groupby" type="built-in function">
<h1><span class="secnum">20.1.2.13</span> Object.groupBy ( <var>items</var>, <var>callback</var> )</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><var>callback</var> should be a function that accepts two arguments. <code>groupBy</code> calls <var>callback</var> once for each element in <var>items</var>, in ascending order, and constructs a new object. Each value returned by <var>callback</var> is coerced to a <emu-xref href="#property-key" id="_ref_9802"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>. For each such <emu-xref href="#property-key" id="_ref_9803"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>, the result object has a property whose key is that <emu-xref href="#property-key" id="_ref_9804"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> and whose value is an array containing all the elements for which the <var>callback</var> return value coerced to that key.</p>
<p><var>callback</var> is called with two arguments: the value of the element and the index of the element.</p>
<p>The return value of <code>groupBy</code> is an object that does not inherit from <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_9805"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</p>
</div></emu-note>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>groups</var> be ?&nbsp;<emu-xref aoid="GroupBy" id="_ref_9806"><a href="abstract-operations.html#sec-groupby" class="e-user-code">GroupBy</a></emu-xref>(<var>items</var>, <var>callback</var>, <emu-const>property</emu-const>).</li><li>Let <var>obj</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9807"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-val>null</emu-val>).</li><li>For each <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9808"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> { <var class="field">[[Key]]</var>, <var class="field">[[Elements]]</var>&nbsp;} <var>g</var> of <var>groups</var>, do<ol><li>Let <var>elements</var> be <emu-xref aoid="CreateArrayFromList" id="_ref_9809"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>g</var>.<var class="field">[[Elements]]</var>).</li><li>Perform !&nbsp;<emu-xref aoid="CreateDataPropertyOrThrow" id="_ref_9810"><a href="abstract-operations.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>obj</var>, <var>g</var>.<var class="field">[[Key]]</var>, <var>elements</var>).</li></ol></li><li>Return <var>obj</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.hasown" type="built-in function">
<h1><span class="secnum">20.1.2.14</span> Object.hasOwn ( <var>O</var>, <var>P</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9811"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9812"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Return ?&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_9813"><a href="abstract-operations.html#sec-hasownproperty" class="e-user-code">HasOwnProperty</a></emu-xref>(<var>obj</var>, <var>key</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.is" type="built-in function">
<h1><span class="secnum">20.1.2.15</span> Object.is ( <var>value1</var>, <var>value2</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="SameValue" id="_ref_9814"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>value1</var>, <var>value2</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.isextensible" type="built-in function">
<h1><span class="secnum">20.1.2.16</span> Object.isExtensible ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9815"><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>Return ?&nbsp;<emu-xref aoid="IsExtensible" id="_ref_9816"><a href="abstract-operations.html#sec-isextensible-o" class="e-user-code">IsExtensible</a></emu-xref>(<var>O</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.isfrozen" type="built-in function">
<h1><span class="secnum">20.1.2.17</span> Object.isFrozen ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9817"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <emu-val>true</emu-val>.</li><li>Return ?&nbsp;<emu-xref aoid="TestIntegrityLevel" id="_ref_9818"><a href="abstract-operations.html#sec-testintegritylevel" class="e-user-code">TestIntegrityLevel</a></emu-xref>(<var>O</var>, <emu-const>frozen</emu-const>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.issealed" type="built-in function">
<h1><span class="secnum">20.1.2.18</span> Object.isSealed ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9819"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <emu-val>true</emu-val>.</li><li>Return ?&nbsp;<emu-xref aoid="TestIntegrityLevel" id="_ref_9820"><a href="abstract-operations.html#sec-testintegritylevel" class="e-user-code">TestIntegrityLevel</a></emu-xref>(<var>O</var>, <emu-const>sealed</emu-const>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.keys" type="built-in function">
<h1><span class="secnum">20.1.2.19</span> Object.keys ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9821"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>keyList</var> be ?&nbsp;<emu-xref aoid="EnumerableOwnProperties" id="_ref_9822"><a href="abstract-operations.html#sec-enumerableownproperties" class="e-user-code">EnumerableOwnProperties</a></emu-xref>(<var>obj</var>, <emu-const>key</emu-const>).</li><li>Return <emu-xref aoid="CreateArrayFromList" id="_ref_9823"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>keyList</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.preventextensions" type="built-in function">
<h1><span class="secnum">20.1.2.20</span> Object.preventExtensions ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9824"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <var>O</var>.</li><li>Let <var>status</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[PreventExtensions]]</var>()</span>.</li><li>If <var>status</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.prototype">
<h1><span class="secnum">20.1.2.21</span> Object.prototype</h1>
<p>The initial value of <code>Object.prototype</code> is the <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_9825"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">Object prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-object.seal" type="built-in function">
<h1><span class="secnum">20.1.2.22</span> Object.seal ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9826"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <var>O</var>.</li><li>Let <var>status</var> be ?&nbsp;<emu-xref aoid="SetIntegrityLevel" id="_ref_9827"><a href="abstract-operations.html#sec-setintegritylevel" class="e-user-code">SetIntegrityLevel</a></emu-xref>(<var>O</var>, <emu-const>sealed</emu-const>).</li><li>If <var>status</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.setprototypeof" type="built-in function">
<h1><span class="secnum">20.1.2.23</span> Object.setPrototypeOf ( <var>O</var>, <var>proto</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="RequireObjectCoercible" id="_ref_9828"><a href="abstract-operations.html#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(<var>O</var>).</li><li>If <var>proto</var> <emu-xref href="#sec-object-type" id="_ref_9829"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> and <var>proto</var> is not <emu-val>null</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9830"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <var>O</var>.</li><li>Let <var>status</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[SetPrototypeOf]]</var>(<var>proto</var>)</span>.</li><li>If <var>status</var> is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.values" type="built-in function">
<h1><span class="secnum">20.1.2.24</span> Object.values ( <var>O</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9831"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>O</var>).</li><li>Let <var>valueList</var> be ?&nbsp;<emu-xref aoid="EnumerableOwnProperties" id="_ref_9832"><a href="abstract-operations.html#sec-enumerableownproperties" class="e-user-code">EnumerableOwnProperties</a></emu-xref>(<var>obj</var>, <emu-const>value</emu-const>).</li><li>Return <emu-xref aoid="CreateArrayFromList" id="_ref_9833"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>valueList</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-object-prototype-object" oldids="sec-additional-properties-of-the-object.prototype-object"><span id="sec-additional-properties-of-the-object.prototype-object"></span>
<h1><span class="secnum">20.1.3</span> Properties of the Object Prototype Object</h1>
<p>The <dfn tabindex="-1">Object prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Object.prototype%</dfn>.</li>
<li>has an <var class="field">[[Extensible]]</var> internal slot whose value is <emu-val>true</emu-val>.</li>
<li>has the internal methods defined for <emu-xref href="#ordinary-object" id="_ref_9834"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref>, except for the <var class="field">[[SetPrototypeOf]]</var> method, which is as defined in <emu-xref href="#sec-immutable-prototype-exotic-objects-setprototypeof-v" id="_ref_595"><a href="ordinary-and-exotic-objects-behaviours.html#sec-immutable-prototype-exotic-objects-setprototypeof-v">10.4.7.1</a></emu-xref>. (Thus, it is an <emu-xref href="#immutable-prototype-exotic-object" id="_ref_9835"><a href="ordinary-and-exotic-objects-behaviours.html#immutable-prototype-exotic-object">immutable prototype exotic object</a></emu-xref>.)</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-val>null</emu-val>.</li>
</ul>
<emu-clause id="sec-object.prototype.constructor">
<h1><span class="secnum">20.1.3.1</span> Object.prototype.constructor</h1>
<p>The initial value of <code>Object.prototype.constructor</code> is <emu-xref href="#sec-object-constructor" id="_ref_9836"><a href="fundamental-objects.html#sec-object-constructor">%Object%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-object.prototype.hasownproperty" type="built-in function">
<h1><span class="secnum">20.1.3.2</span> Object.prototype.hasOwnProperty ( <var>V</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li id="step-hasownproperty-topropertykey">Let <var>P</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9837"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>V</var>).</li><li id="step-hasownproperty-toobject">Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9838"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Return ?&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_9839"><a href="abstract-operations.html#sec-hasownproperty" class="e-user-code">HasOwnProperty</a></emu-xref>(<var>O</var>, <var>P</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The ordering of steps <emu-xref href="#step-hasownproperty-topropertykey" id="_ref_596"><a href="fundamental-objects.html#step-hasownproperty-topropertykey">1</a></emu-xref> and <emu-xref href="#step-hasownproperty-toobject" id="_ref_597"><a href="fundamental-objects.html#step-hasownproperty-toobject">2</a></emu-xref> is chosen to ensure that any exception that would have been thrown by step <emu-xref href="#step-hasownproperty-topropertykey" id="_ref_598"><a href="fundamental-objects.html#step-hasownproperty-topropertykey">1</a></emu-xref> in previous editions of this specification will continue to be thrown even if the <emu-val>this</emu-val> value is <emu-val>undefined</emu-val> or <emu-val>null</emu-val>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-object.prototype.isprototypeof" type="built-in function">
<h1><span class="secnum">20.1.3.3</span> Object.prototype.isPrototypeOf ( <var>V</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li id="step-isprototypeof-check-object">If <var>V</var> <emu-xref href="#sec-object-type" id="_ref_9840"><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 id="step-isprototypeof-toobject">Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9841"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Repeat,<ol><li>Set <var>V</var> to ?&nbsp;<span class="e-user-code"><var>V</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <var>V</var> is <emu-val>null</emu-val>, return <emu-val>false</emu-val>.</li><li>If <emu-xref aoid="SameValue" id="_ref_9842"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>O</var>, <var>V</var>) is <emu-val>true</emu-val>, return <emu-val>true</emu-val>.</li></ol></li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The ordering of steps <emu-xref href="#step-isprototypeof-check-object" id="_ref_599"><a href="fundamental-objects.html#step-isprototypeof-check-object">1</a></emu-xref> and <emu-xref href="#step-isprototypeof-toobject" id="_ref_600"><a href="fundamental-objects.html#step-isprototypeof-toobject">2</a></emu-xref> preserves the behaviour specified by previous editions of this specification for the case where <var>V</var> is not an object and the <emu-val>this</emu-val> value is <emu-val>undefined</emu-val> or <emu-val>null</emu-val>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-object.prototype.propertyisenumerable" type="built-in function">
<h1><span class="secnum">20.1.3.4</span> Object.prototype.propertyIsEnumerable ( <var>V</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li id="step-propertyisenumerable-topropertykey">Let <var>P</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9843"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>V</var>).</li><li id="step-propertyisenumerable-toobject">Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9844"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><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>false</emu-val>.</li><li>Return <var>desc</var>.<var class="field">[[Enumerable]]</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>This method does not consider objects in the prototype chain.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The ordering of steps <emu-xref href="#step-propertyisenumerable-topropertykey" id="_ref_601"><a href="fundamental-objects.html#step-propertyisenumerable-topropertykey">1</a></emu-xref> and <emu-xref href="#step-propertyisenumerable-toobject" id="_ref_602"><a href="fundamental-objects.html#step-propertyisenumerable-toobject">2</a></emu-xref> is chosen to ensure that any exception that would have been thrown by step <emu-xref href="#step-propertyisenumerable-topropertykey" id="_ref_603"><a href="fundamental-objects.html#step-propertyisenumerable-topropertykey">1</a></emu-xref> in previous editions of this specification will continue to be thrown even if the <emu-val>this</emu-val> value is <emu-val>undefined</emu-val> or <emu-val>null</emu-val>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-object.prototype.tolocalestring" type="built-in function">
<h1><span class="secnum">20.1.3.5</span> Object.prototype.toLocaleString ( [ <var>reserved1</var> [ , <var>reserved2</var> ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>Return ?&nbsp;<emu-xref aoid="Invoke" id="_ref_9845"><a href="abstract-operations.html#sec-invoke" class="e-user-code">Invoke</a></emu-xref>(<var>O</var>, <emu-val>"toString"</emu-val>).</li></ol></emu-alg>
<p>The optional parameters to this method are not used but are intended to correspond to the parameter pattern used by ECMA-402 <code>toLocaleString</code> methods. Implementations that do not include ECMA-402 support must not use those parameter positions for other purposes.</p>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>This method provides a generic <code>toLocaleString</code> implementation for objects that have no locale-sensitive <code>toString</code> behaviour. <code>Array</code>, <code>Number</code>, <code>Date</code>, and <emu-xref href="#sec-%typedarray%-intrinsic-object" id="_ref_9846"><a href="indexed-collections.html#sec-%typedarray%-intrinsic-object">%TypedArray%</a></emu-xref> provide their own locale-sensitive <code>toLocaleString</code> methods.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>ECMA-402 intentionally does not provide an alternative to this default implementation.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-object.prototype.tostring" type="built-in function">
<h1><span class="secnum">20.1.3.6</span> Object.prototype.toString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>If the <emu-val>this</emu-val> value is <emu-val>undefined</emu-val>, return <emu-val>"[object Undefined]"</emu-val>.</li><li>If the <emu-val>this</emu-val> value is <emu-val>null</emu-val>, return <emu-val>"[object Null]"</emu-val>.</li><li>Let <var>O</var> be !&nbsp;<emu-xref aoid="ToObject" id="_ref_9847"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>isArray</var> be ?&nbsp;<emu-xref aoid="IsArray" id="_ref_9848"><a href="abstract-operations.html#sec-isarray">IsArray</a></emu-xref>(<var>O</var>).</li><li>If <var>isArray</var> is <emu-val>true</emu-val>, let <var>builtinTag</var> be <emu-val>"Array"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[ParameterMap]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"Arguments"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[Call]]</var> internal method, let <var>builtinTag</var> be <emu-val>"Function"</emu-val>.</li><li>Else if <var>O</var> has an <var class="field">[[ErrorData]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"Error"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[BooleanData]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"Boolean"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[NumberData]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"Number"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[StringData]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"String"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[DateValue]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"Date"</emu-val>.</li><li>Else if <var>O</var> has a <var class="field">[[RegExpMatcher]]</var> internal slot, let <var>builtinTag</var> be <emu-val>"RegExp"</emu-val>.</li><li>Else, let <var>builtinTag</var> be <emu-val>"Object"</emu-val>.</li><li>Let <var>tag</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_9849"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>O</var>, <emu-xref href="#sec-well-known-symbols" id="_ref_9850"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toStringTag%</a></emu-xref>).</li><li>If <var>tag</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_9851"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is not a String</a></emu-xref>, set <var>tag</var> to <var>builtinTag</var>.</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_9852"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-val>"[object "</emu-val>, <var>tag</var>, and <emu-val>"]"</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Historically, this method was occasionally used to access the String value of the <var class="field">[[Class]]</var> internal slot that was used in previous editions of this specification as a nominal type tag for various built-in objects. The above definition of <code>toString</code> preserves compatibility for legacy code that uses <code>toString</code> as a test for those specific kinds of built-in objects. It does not provide a reliable type testing mechanism for other kinds of built-in or program defined objects. In addition, programs can use <emu-xref href="#sec-well-known-symbols" id="_ref_9853"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toStringTag%</a></emu-xref> in ways that will invalidate the reliability of such legacy type tests.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-object.prototype.valueof" type="built-in function">
<h1><span class="secnum">20.1.3.7</span> Object.prototype.valueOf ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9854"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.prototype.__proto__" legacy="" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_9860"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref>, <emu-xref href="#sec-conformance" id="_ref_9861"><a href="conformance.html#sec-conformance">Legacy</a></emu-xref></div>
<h1><span class="secnum">20.1.3.8</span> Object.prototype.__proto__</h1>
<p><code>Object.prototype.__proto__</code> is an <emu-xref href="#sec-object-type" id="_ref_9855"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> with attributes { <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }. The <var class="field">[[Get]]</var> and <var class="field">[[Set]]</var> attributes are defined as follows:</p>
<emu-clause id="sec-get-object.prototype.__proto__" type="built-in function">
<h1><span class="secnum">20.1.3.8.1</span> get Object.prototype.__proto__</h1>
<p>The value of the <var class="field">[[Get]]</var> attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9856"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Return ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-set-object.prototype.__proto__" type="built-in function">
<h1><span class="secnum">20.1.3.8.2</span> set Object.prototype.__proto__</h1>
<p>The value of the <var class="field">[[Set]]</var> attribute is a built-in function that takes an argument <var>proto</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireObjectCoercible" id="_ref_9857"><a href="abstract-operations.html#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(<var>O</var>).</li><li>If <var>proto</var> <emu-xref href="#sec-object-type" id="_ref_9858"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref> and <var>proto</var> is not <emu-val>null</emu-val>, return <emu-val>undefined</emu-val>.</li><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_9859"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, return <emu-val>undefined</emu-val>.</li><li>Let <var>status</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[SetPrototypeOf]]</var>(<var>proto</var>)</span>.</li><li>If <var>status</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></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-object.prototype-legacy-accessor-methods" legacy="" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_9876"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref>, <emu-xref href="#sec-conformance" id="_ref_9877"><a href="conformance.html#sec-conformance">Legacy</a></emu-xref></div>
<h1><span class="secnum">20.1.3.9</span> Legacy Object.prototype Accessor Methods</h1>
<emu-clause id="sec-object.prototype.__defineGetter__" type="built-in function">
<h1><span class="secnum">20.1.3.9.1</span> Object.prototype.__defineGetter__ ( <var>P</var>, <var>getter</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9862"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>If <emu-xref aoid="IsCallable" id="_ref_9863"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>getter</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>desc</var> be PropertyDescriptor { <var class="field">[[Get]]</var>: <var>getter</var>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}.</li><li>Let <var>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9864"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Perform ?&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_9865"><a href="abstract-operations.html#sec-definepropertyorthrow" class="e-user-code">DefinePropertyOrThrow</a></emu-xref>(<var>O</var>, <var>key</var>, <var>desc</var>).</li><li>Return <emu-val>undefined</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.prototype.__defineSetter__" type="built-in function">
<h1><span class="secnum">20.1.3.9.2</span> Object.prototype.__defineSetter__ ( <var>P</var>, <var>setter</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9866"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>If <emu-xref aoid="IsCallable" id="_ref_9867"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>setter</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>desc</var> be PropertyDescriptor { <var class="field">[[Set]]</var>: <var>setter</var>, <var class="field">[[Enumerable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>&nbsp;}.</li><li>Let <var>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9868"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Perform ?&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_9869"><a href="abstract-operations.html#sec-definepropertyorthrow" class="e-user-code">DefinePropertyOrThrow</a></emu-xref>(<var>O</var>, <var>key</var>, <var>desc</var>).</li><li>Return <emu-val>undefined</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.prototype.__lookupGetter__" type="built-in function">
<h1><span class="secnum">20.1.3.9.3</span> Object.prototype.__lookupGetter__ ( <var>P</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9870"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9871"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Repeat,<ol><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>key</var>)</span>.</li><li>If <var>desc</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_9872"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>desc</var>) is <emu-val>true</emu-val>, return <var>desc</var>.<var class="field">[[Get]]</var>.</li><li>Return <emu-val>undefined</emu-val>.</li></ol></li><li>Set <var>O</var> to ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <var>O</var> is <emu-val>null</emu-val>, return <emu-val>undefined</emu-val>.</li></ol></li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-object.prototype.__lookupSetter__" type="built-in function">
<h1><span class="secnum">20.1.3.9.4</span> Object.prototype.__lookupSetter__ ( <var>P</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_9873"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>key</var> be ?&nbsp;<emu-xref aoid="ToPropertyKey" id="_ref_9874"><a href="abstract-operations.html#sec-topropertykey" class="e-user-code">ToPropertyKey</a></emu-xref>(<var>P</var>).</li><li>Repeat,<ol><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetOwnProperty]]</var>(<var>key</var>)</span>.</li><li>If <var>desc</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="IsAccessorDescriptor" id="_ref_9875"><a href="ecmascript-data-types-and-values.html#sec-isaccessordescriptor">IsAccessorDescriptor</a></emu-xref>(<var>desc</var>) is <emu-val>true</emu-val>, return <var>desc</var>.<var class="field">[[Set]]</var>.</li><li>Return <emu-val>undefined</emu-val>.</li></ol></li><li>Set <var>O</var> to ?&nbsp;<span class="e-user-code"><var>O</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>If <var>O</var> is <emu-val>null</emu-val>, return <emu-val>undefined</emu-val>.</li></ol></li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-object-instances">
<h1><span class="secnum">20.1.4</span> Properties of Object Instances</h1>
<p>Object instances have no special properties beyond those inherited from the <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_9878"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">Object prototype object</a></emu-xref>.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-function-objects">
<h1><span class="secnum">20.2</span> Function Objects</h1>
<emu-clause id="sec-function-constructor">
<h1><span class="secnum">20.2.1</span> The Function Constructor</h1>
<p>The Function <emu-xref href="#constructor" id="_ref_9879"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Function%</dfn>.</li>
<li>is the initial value of the <emu-val>"Function"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_9880"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates and initializes a new <emu-xref href="#function-object" id="_ref_9881"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> when called as a function rather than as a <emu-xref href="#constructor" id="_ref_9882"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. Thus the function call <code>Function(…)</code> is equivalent to the object creation expression <code>new Function(…)</code> with the same arguments.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_9883"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified Function behaviour must include a <code>super</code> call to the Function <emu-xref href="#constructor" id="_ref_9884"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize a subclass instance with the internal slots necessary for built-in function behaviour. All ECMAScript syntactic forms for defining <emu-xref href="#function-object" id="_ref_9885"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> create instances of Function. There is no syntactic means to create instances of Function subclasses except for the built-in GeneratorFunction, AsyncFunction, and AsyncGeneratorFunction subclasses.</li>
</ul>
<emu-clause id="sec-function-p1-p2-pn-body" type="built-in function">
<h1><span class="secnum">20.2.1.1</span> Function ( ...<var>parameterArgs</var>, <var>bodyArg</var> )</h1>
<p>The last argument (if any) specifies the body (executable code) of a function; any preceding arguments specify formal parameters.</p>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>C</var> be the <emu-xref href="#active-function-object" id="_ref_9886"><a href="executable-code-and-execution-contexts.html#active-function-object">active function object</a></emu-xref>.</li><li>If <var>bodyArg</var> is not present, set <var>bodyArg</var> to the empty String.</li><li>Return ?&nbsp;<emu-xref aoid="CreateDynamicFunction" id="_ref_9887"><a href="fundamental-objects.html#sec-createdynamicfunction" class="e-user-code">CreateDynamicFunction</a></emu-xref>(<var>C</var>, NewTarget, <emu-const>normal</emu-const>, <var>parameterArgs</var>, <var>bodyArg</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is permissible but not necessary to have one argument for each formal parameter to be specified. For example, all three of the following expressions produce the same result:</p>
<pre><code class="javascript hljs"><span class="hljs-keyword">new</span> <span class="hljs-title class_">Function</span>(<span class="hljs-string">"a"</span>, <span class="hljs-string">"b"</span>, <span class="hljs-string">"c"</span>, <span class="hljs-string">"return a+b+c"</span>)
<span class="hljs-keyword">new</span> <span class="hljs-title class_">Function</span>(<span class="hljs-string">"a, b, c"</span>, <span class="hljs-string">"return a+b+c"</span>)
<span class="hljs-keyword">new</span> <span class="hljs-title class_">Function</span>(<span class="hljs-string">"a,b"</span>, <span class="hljs-string">"c"</span>, <span class="hljs-string">"return a+b+c"</span>)</code></pre>
</div></emu-note>
<emu-clause id="sec-createdynamicfunction" type="abstract operation" oldids="table-dynamic-function-sourcetext-prefixes" aoid="CreateDynamicFunction"><span id="table-dynamic-function-sourcetext-prefixes"></span>
<h1><span class="secnum">20.2.1.1.1</span> CreateDynamicFunction ( <var>constructor</var>, <var>newTarget</var>, <var>kind</var>, <var>parameterArgs</var>, <var>bodyArg</var> )</h1>
<p>The abstract operation CreateDynamicFunction takes arguments <var>constructor</var> (a <emu-xref href="#constructor" id="_ref_9888"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>), <var>newTarget</var> (a <emu-xref href="#constructor" id="_ref_9889"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> or <emu-val>undefined</emu-val>), <var>kind</var> (<emu-const>normal</emu-const>, <emu-const>generator</emu-const>, <emu-const>async</emu-const>, or <emu-const>async-generator</emu-const>), <var>parameterArgs</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9890"><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_9891"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language values</a></emu-xref>), and <var>bodyArg</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_9892"><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_9893"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an ECMAScript <emu-xref href="#function-object" id="_ref_9894"><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_9895"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. <var>constructor</var> is the <emu-xref href="#constructor" id="_ref_9896"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> function that is performing this action. <var>newTarget</var> is the <emu-xref href="#constructor" id="_ref_9897"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> that <code>new</code> was initially applied to. <var>parameterArgs</var> and <var>bodyArg</var> reflect the argument values that were passed to <var>constructor</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>newTarget</var> is <emu-val>undefined</emu-val>, set <var>newTarget</var> to <var>constructor</var>.</li><li>If <var>kind</var> is <emu-const>normal</emu-const>, then<ol><li>Let <var>prefix</var> be <emu-val>"function"</emu-val>.</li><li>Let <var>exprSym</var> be the grammar symbol <emu-nt id="_ref_23822"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionExpression">FunctionExpression</a></emu-nt>.</li><li>Let <var>bodySym</var> be the grammar symbol <emu-nt params="~Yield, ~Await" id="_ref_23823"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionBody">FunctionBody</a><emu-mods><emu-params>[~Yield, ~Await]</emu-params></emu-mods></emu-nt>.</li><li>Let <var>parameterSym</var> be the grammar symbol <emu-nt params="~Yield, ~Await" id="_ref_23824"><a href="ecmascript-language-functions-and-classes.html#prod-FormalParameters">FormalParameters</a><emu-mods><emu-params>[~Yield, ~Await]</emu-params></emu-mods></emu-nt>.</li><li>Let <var>fallbackProto</var> be <emu-val>"%Function.prototype%"</emu-val>.</li></ol></li><li>Else if <var>kind</var> is <emu-const>generator</emu-const>, then<ol><li>Let <var>prefix</var> be <emu-val>"function*"</emu-val>.</li><li>Let <var>exprSym</var> be the grammar symbol <emu-nt id="_ref_23825"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorExpression">GeneratorExpression</a></emu-nt>.</li><li>Let <var>bodySym</var> be the grammar symbol <emu-nt id="_ref_23826"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorBody">GeneratorBody</a></emu-nt>.</li><li>Let <var>parameterSym</var> be the grammar symbol <emu-nt params="+Yield, ~Await" id="_ref_23827"><a href="ecmascript-language-functions-and-classes.html#prod-FormalParameters">FormalParameters</a><emu-mods><emu-params>[+Yield, ~Await]</emu-params></emu-mods></emu-nt>.</li><li>Let <var>fallbackProto</var> be <emu-val>"%GeneratorFunction.prototype%"</emu-val>.</li></ol></li><li>Else if <var>kind</var> is <emu-const>async</emu-const>, then<ol><li>Let <var>prefix</var> be <emu-val>"async function"</emu-val>.</li><li>Let <var>exprSym</var> be the grammar symbol <emu-nt id="_ref_23828"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionExpression">AsyncFunctionExpression</a></emu-nt>.</li><li>Let <var>bodySym</var> be the grammar symbol <emu-nt id="_ref_23829"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionBody">AsyncFunctionBody</a></emu-nt>.</li><li>Let <var>parameterSym</var> be the grammar symbol <emu-nt params="~Yield, +Await" id="_ref_23830"><a href="ecmascript-language-functions-and-classes.html#prod-FormalParameters">FormalParameters</a><emu-mods><emu-params>[~Yield, +Await]</emu-params></emu-mods></emu-nt>.</li><li>Let <var>fallbackProto</var> be <emu-val>"%AsyncFunction.prototype%"</emu-val>.</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_9898"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>kind</var> is <emu-const>async-generator</emu-const>.</li><li>Let <var>prefix</var> be <emu-val>"async function*"</emu-val>.</li><li>Let <var>exprSym</var> be the grammar symbol <emu-nt id="_ref_23831"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorExpression">AsyncGeneratorExpression</a></emu-nt>.</li><li>Let <var>bodySym</var> be the grammar symbol <emu-nt id="_ref_23832"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorBody">AsyncGeneratorBody</a></emu-nt>.</li><li>Let <var>parameterSym</var> be the grammar symbol <emu-nt params="+Yield, +Await" id="_ref_23833"><a href="ecmascript-language-functions-and-classes.html#prod-FormalParameters">FormalParameters</a><emu-mods><emu-params>[+Yield, +Await]</emu-params></emu-mods></emu-nt>.</li><li>Let <var>fallbackProto</var> be <emu-val>"%AsyncGeneratorFunction.prototype%"</emu-val>.</li></ol></li><li>Let <var>argCount</var> be the number of elements in <var>parameterArgs</var>.</li><li>Let <var>parameterStrings</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9899"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>arg</var> of <var>parameterArgs</var>, do<ol><li>Append ?&nbsp;<emu-xref aoid="ToString" id="_ref_9900"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>arg</var>) to <var>parameterStrings</var>.</li></ol></li><li>Let <var>bodyString</var> be ?&nbsp;<emu-xref aoid="ToString" id="_ref_9901"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>bodyArg</var>).</li><li>Let <var>currentRealm</var> be <emu-xref href="#current-realm" id="_ref_9902"><a href="executable-code-and-execution-contexts.html#current-realm">the current Realm Record</a></emu-xref>.</li><li>Perform ?&nbsp;<emu-xref aoid="HostEnsureCanCompileStrings" id="_ref_9903"><a href="global-object.html#sec-hostensurecancompilestrings">HostEnsureCanCompileStrings</a></emu-xref>(<var>currentRealm</var>, <var>parameterStrings</var>, <var>bodyString</var>, <emu-val>false</emu-val>).</li><li>Let <var>P</var> be the empty String.</li><li>If <var>argCount</var> &gt; 0, then<ol><li>Set <var>P</var> to <var>parameterStrings</var>[0].</li><li>Let <var>k</var> be 1.</li><li>Repeat, while <var>k</var> &lt; <var>argCount</var>,<ol><li>Let <var>nextArgString</var> be <var>parameterStrings</var>[<var>k</var>].</li><li>Set <var>P</var> to the <emu-xref href="#string-concatenation" id="_ref_9904"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>P</var>, <emu-val>","</emu-val> (a comma), and <var>nextArgString</var>.</li><li>Set <var>k</var> to <var>k</var> + 1.</li></ol></li></ol></li><li>Let <var>bodyParseString</var> be the <emu-xref href="#string-concatenation" id="_ref_9905"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of 0x000A (LINE FEED), <var>bodyString</var>, and 0x000A (LINE FEED).</li><li>Let <var>sourceString</var> be the <emu-xref href="#string-concatenation" id="_ref_9906"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>prefix</var>, <emu-val>" anonymous("</emu-val>, <var>P</var>, 0x000A (LINE FEED), <emu-val>") {"</emu-val>, <var>bodyParseString</var>, and <emu-val>"}"</emu-val>.</li><li>Let <var>sourceText</var> be <emu-xref aoid="StringToCodePoints" id="_ref_9907"><a href="ecmascript-language-source-code.html#sec-stringtocodepoints">StringToCodePoints</a></emu-xref>(<var>sourceString</var>).</li><li>Let <var>parameters</var> be <emu-xref aoid="ParseText" id="_ref_9908"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>P</var>, <var>parameterSym</var>).</li><li>If <var>parameters</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9909"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of errors, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>Let <var>body</var> be <emu-xref aoid="ParseText" id="_ref_9910"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>bodyParseString</var>, <var>bodySym</var>).</li><li>If <var>body</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9911"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of errors, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>NOTE: The parameters and body are parsed separately to ensure that each is valid alone. For example, <code>new Function("/*", "*/ ) {")</code> does not evaluate to a function.</li><li>NOTE: If this step is reached, <var>sourceText</var> must have the syntax of <var>exprSym</var> (although the reverse implication does not hold). The purpose of the next two steps is to enforce any Early Error rules which apply to <var>exprSym</var> directly.</li><li>Let <var>expr</var> be <emu-xref aoid="ParseText" id="_ref_9912"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>sourceText</var>, <var>exprSym</var>).</li><li>If <var>expr</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_9913"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of errors, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>Let <var>proto</var> be ?&nbsp;<emu-xref aoid="GetPrototypeFromConstructor" id="_ref_9914"><a href="ordinary-and-exotic-objects-behaviours.html#sec-getprototypefromconstructor" class="e-user-code">GetPrototypeFromConstructor</a></emu-xref>(<var>newTarget</var>, <var>fallbackProto</var>).</li><li>Let <var>env</var> be <var>currentRealm</var>.<var class="field">[[GlobalEnv]]</var>.</li><li>Let <var>privateEnv</var> be <emu-val>null</emu-val>.</li><li>Let <var>F</var> be <emu-xref aoid="OrdinaryFunctionCreate" id="_ref_9915"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryfunctioncreate">OrdinaryFunctionCreate</a></emu-xref>(<var>proto</var>, <var>sourceText</var>, <var>parameters</var>, <var>body</var>, <emu-const>non-lexical-this</emu-const>, <var>env</var>, <var>privateEnv</var>).</li><li>Perform <emu-xref aoid="SetFunctionName" id="_ref_9916"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionname">SetFunctionName</a></emu-xref>(<var>F</var>, <emu-val>"anonymous"</emu-val>).</li><li>If <var>kind</var> is <emu-const>generator</emu-const>, then<ol><li>Let <var>prototype</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9917"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-properties-of-generator-prototype" id="_ref_9918"><a href="control-abstraction-objects.html#sec-properties-of-generator-prototype">%GeneratorPrototype%</a></emu-xref>).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_9919"><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>: <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></ol></li><li>Else if <var>kind</var> is <emu-const>async-generator</emu-const>, then<ol><li>Let <var>prototype</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_9920"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-properties-of-asyncgenerator-prototype" id="_ref_9921"><a href="control-abstraction-objects.html#sec-properties-of-asyncgenerator-prototype">%AsyncGeneratorPrototype%</a></emu-xref>).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_9922"><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>: <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></ol></li><li>Else if <var>kind</var> is <emu-const>normal</emu-const>, then<ol><li>Perform <emu-xref aoid="MakeConstructor" id="_ref_9923"><a href="ordinary-and-exotic-objects-behaviours.html#sec-makeconstructor">MakeConstructor</a></emu-xref>(<var>F</var>).</li></ol></li><li>NOTE: Functions whose <var>kind</var> is <emu-const>async</emu-const> are not constructable and do not have a <var class="field">[[Construct]]</var> internal method or a <emu-val>"prototype"</emu-val> property.</li><li>Return <var>F</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>CreateDynamicFunction defines a <emu-val>"prototype"</emu-val> property on any function it creates whose <var>kind</var> is not <emu-const>async</emu-const> to provide for the possibility that the function will be used as a <emu-xref href="#constructor" id="_ref_9924"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-function-constructor">
<h1><span class="secnum">20.2.2</span> Properties of the Function Constructor</h1>
<p>The Function <emu-xref href="#constructor" id="_ref_9925"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is itself a built-in <emu-xref href="#function-object" id="_ref_9926"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_9927"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li oldids="sec-function.length"><span id="sec-function.length"></span>has a <emu-val>"length"</emu-val> property whose value is <emu-val>1</emu-val><sub>𝔽</sub>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-function.prototype">
<h1><span class="secnum">20.2.2.1</span> Function.prototype</h1>
<p>The value of <code>Function.prototype</code> is the <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_9928"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">Function prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-function-prototype-object">
<h1><span class="secnum">20.2.3</span> Properties of the Function Prototype Object</h1>
<p>The <dfn tabindex="-1">Function prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Function.prototype%</dfn>.</li>
<li>is itself a built-in <emu-xref href="#function-object" id="_ref_9929"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>.</li>
<li>accepts any arguments and returns <emu-val>undefined</emu-val> when invoked.</li>
<li>does not have a <var class="field">[[Construct]]</var> internal method; it cannot be used as a <emu-xref href="#constructor" id="_ref_9930"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> with the <code>new</code> operator.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_9931"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
<li>does not have a <emu-val>"prototype"</emu-val> property.</li>
<li>has a <emu-val>"length"</emu-val> property whose value is <emu-val>+0</emu-val><sub>𝔽</sub>.</li>
<li>has a <emu-val>"name"</emu-val> property whose value is the empty String.</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The Function prototype object is specified to be a <emu-xref href="#function-object" id="_ref_9932"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> to ensure compatibility with ECMAScript code that was created prior to the ECMAScript 2015 specification.</p>
</div></emu-note>
<emu-clause id="sec-function.prototype.apply" type="built-in function">
<h1><span class="secnum">20.2.3.1</span> Function.prototype.apply ( <var>thisArg</var>, <var>argArray</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>func</var> be the <emu-val>this</emu-val> value.</li><li>If <emu-xref aoid="IsCallable" id="_ref_9933"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>func</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>argArray</var> is either <emu-val>undefined</emu-val> or <emu-val>null</emu-val>, then<ol><li>Perform <emu-xref aoid="PrepareForTailCall" id="_ref_9934"><a href="ecmascript-language-functions-and-classes.html#sec-preparefortailcall">PrepareForTailCall</a></emu-xref>().</li><li>Return ?&nbsp;<emu-xref aoid="Call" id="_ref_9935"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>func</var>, <var>thisArg</var>).</li></ol></li><li>Let <var>argList</var> be ?&nbsp;<emu-xref aoid="CreateListFromArrayLike" id="_ref_9936"><a href="abstract-operations.html#sec-createlistfromarraylike" class="e-user-code">CreateListFromArrayLike</a></emu-xref>(<var>argArray</var>).</li><li>Perform <emu-xref aoid="PrepareForTailCall" id="_ref_9937"><a href="ecmascript-language-functions-and-classes.html#sec-preparefortailcall">PrepareForTailCall</a></emu-xref>().</li><li id="step-function-proto-apply-call">Return ?&nbsp;<emu-xref aoid="Call" id="_ref_9938"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>func</var>, <var>thisArg</var>, <var>argList</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>The <var>thisArg</var> value is passed without modification as the <emu-val>this</emu-val> value. This is a change from Edition 3, where an <emu-val>undefined</emu-val> or <emu-val>null</emu-val> <var>thisArg</var> is replaced with the <emu-xref href="#sec-global-object" id="_ref_9939"><a href="global-object.html#sec-global-object">global object</a></emu-xref> and <emu-xref aoid="ToObject" id="_ref_9940"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref> is applied to all other values and that result is passed as the <emu-val>this</emu-val> value. Even though the <var>thisArg</var> is passed without modification, <emu-xref href="#non-strict-function" id="_ref_9941"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref> still perform these transformations upon entry to the function.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>If <var>func</var> is either an arrow function or a <emu-xref href="#bound-function-exotic-object" id="_ref_9942"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref>, then the <var>thisArg</var> will be ignored by the function <var class="field">[[Call]]</var> in step <emu-xref href="#step-function-proto-apply-call" id="_ref_604"><a href="fundamental-objects.html#step-function-proto-apply-call">6</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-function.prototype.bind" type="built-in function">
<h1><span class="secnum">20.2.3.2</span> Function.prototype.bind ( <var>thisArg</var>, ...<var>args</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>Target</var> be the <emu-val>this</emu-val> value.</li><li>If <emu-xref aoid="IsCallable" id="_ref_9943"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>Target</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>F</var> be ?&nbsp;<emu-xref aoid="BoundFunctionCreate" id="_ref_9944"><a href="ordinary-and-exotic-objects-behaviours.html#sec-boundfunctioncreate" class="e-user-code">BoundFunctionCreate</a></emu-xref>(<var>Target</var>, <var>thisArg</var>, <var>args</var>).</li><li>Let <var>L</var> be 0.</li><li>Let <var>targetHasLength</var> be ?&nbsp;<emu-xref aoid="HasOwnProperty" id="_ref_9945"><a href="abstract-operations.html#sec-hasownproperty" class="e-user-code">HasOwnProperty</a></emu-xref>(<var>Target</var>, <emu-val>"length"</emu-val>).</li><li>If <var>targetHasLength</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>targetLen</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_9946"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>Target</var>, <emu-val>"length"</emu-val>).</li><li>If <var>targetLen</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_9947"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref>, then<ol><li>If <var>targetLen</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, then<ol><li>Set <var>L</var> to +∞.</li></ol></li><li>Else if <var>targetLen</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, then<ol><li>Set <var>L</var> to 0.</li></ol></li><li>Else,<ol><li>Let <var>targetLenAsInt</var> be !&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_9948"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>targetLen</var>).</li><li><emu-xref href="#assert" id="_ref_9949"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>targetLenAsInt</var> is <emu-xref href="#finite" id="_ref_9950"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>.</li><li>Let <var>argCount</var> be the number of elements in <var>args</var>.</li><li>Set <var>L</var> to <emu-xref aoid="max" id="_ref_9951"><a href="notational-conventions.html#eqn-max">max</a></emu-xref>(<var>targetLenAsInt</var> - <var>argCount</var>, 0).</li></ol></li></ol></li></ol></li><li>Perform <emu-xref aoid="SetFunctionLength" id="_ref_9952"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionlength">SetFunctionLength</a></emu-xref>(<var>F</var>, <var>L</var>).</li><li>Let <var>targetName</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_9953"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>Target</var>, <emu-val>"name"</emu-val>).</li><li>If <var>targetName</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_9954"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is not a String</a></emu-xref>, set <var>targetName</var> to the empty String.</li><li>Perform <emu-xref aoid="SetFunctionName" id="_ref_9955"><a href="ordinary-and-exotic-objects-behaviours.html#sec-setfunctionname">SetFunctionName</a></emu-xref>(<var>F</var>, <var>targetName</var>, <emu-val>"bound"</emu-val>).</li><li>Return <var>F</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p><emu-xref href="#function-object" id="_ref_9956"><a href="ecmascript-data-types-and-values.html#function-object">Function objects</a></emu-xref> created using <code>Function.prototype.bind</code> are <emu-xref href="#exotic-object" id="_ref_9957"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref>. They also do not have a <emu-val>"prototype"</emu-val> property.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>If <var>Target</var> is either an arrow function or a <emu-xref href="#bound-function-exotic-object" id="_ref_9958"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref>, then the <var>thisArg</var> passed to this method will not be used by subsequent calls to <var>F</var>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-function.prototype.call" type="built-in function">
<h1><span class="secnum">20.2.3.3</span> Function.prototype.call ( <var>thisArg</var>, ...<var>args</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>func</var> be the <emu-val>this</emu-val> value.</li><li>If <emu-xref aoid="IsCallable" id="_ref_9959"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>func</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Perform <emu-xref aoid="PrepareForTailCall" id="_ref_9960"><a href="ecmascript-language-functions-and-classes.html#sec-preparefortailcall">PrepareForTailCall</a></emu-xref>().</li><li id="step-function-proto-call-call">Return ?&nbsp;<emu-xref aoid="Call" id="_ref_9961"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>func</var>, <var>thisArg</var>, <var>args</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>The <var>thisArg</var> value is passed without modification as the <emu-val>this</emu-val> value. This is a change from Edition 3, where an <emu-val>undefined</emu-val> or <emu-val>null</emu-val> <var>thisArg</var> is replaced with the <emu-xref href="#sec-global-object" id="_ref_9962"><a href="global-object.html#sec-global-object">global object</a></emu-xref> and <emu-xref aoid="ToObject" id="_ref_9963"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref> is applied to all other values and that result is passed as the <emu-val>this</emu-val> value. Even though the <var>thisArg</var> is passed without modification, <emu-xref href="#non-strict-function" id="_ref_9964"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref> still perform these transformations upon entry to the function.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>If <var>func</var> is either an arrow function or a <emu-xref href="#bound-function-exotic-object" id="_ref_9965"><a href="ordinary-and-exotic-objects-behaviours.html#bound-function-exotic-object">bound function exotic object</a></emu-xref>, then the <var>thisArg</var> will be ignored by the function <var class="field">[[Call]]</var> in step <emu-xref href="#step-function-proto-call-call" id="_ref_605"><a href="fundamental-objects.html#step-function-proto-call-call">4</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-function.prototype.constructor">
<h1><span class="secnum">20.2.3.4</span> Function.prototype.constructor</h1>
<p>The initial value of <code>Function.prototype.constructor</code> is <emu-xref href="#sec-function-constructor" id="_ref_9966"><a href="fundamental-objects.html#sec-function-constructor">%Function%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-function.prototype.tostring" type="built-in function">
<h1><span class="secnum">20.2.3.5</span> Function.prototype.toString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>func</var> be the <emu-val>this</emu-val> value.</li><li>If <var>func</var> <emu-xref href="#sec-object-type" id="_ref_9967"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>, <var>func</var> has a <var class="field">[[SourceText]]</var> internal slot, <var>func</var>.<var class="field">[[SourceText]]</var> is a sequence of Unicode code points, and <emu-xref aoid="HostHasSourceTextAvailable" id="_ref_9968"><a href="fundamental-objects.html#sec-hosthassourcetextavailable">HostHasSourceTextAvailable</a></emu-xref>(<var>func</var>) is <emu-val>true</emu-val>, then<ol><li>Return <emu-xref aoid="CodePointsToString" id="_ref_9969"><a href="ecmascript-language-source-code.html#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>func</var>.<var class="field">[[SourceText]]</var>).</li></ol></li><li>If <var>func</var> is a <emu-xref href="#sec-built-in-function-objects" id="_ref_606"><a href="ordinary-and-exotic-objects-behaviours.html#sec-built-in-function-objects">built-in function object</a></emu-xref>, return an <emu-xref href="#implementation-defined" id="_ref_9970"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> String source code representation of <var>func</var>. The representation must have the syntax of a <emu-nt id="_ref_23834"><a href="fundamental-objects.html#prod-NativeFunction">NativeFunction</a></emu-nt>. Additionally, if <var>func</var> has an <var class="field">[[InitialName]]</var> internal slot and <var>func</var>.<var class="field">[[InitialName]]</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_9971"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, the portion of the returned String that would be matched by <emu-nt optional="" id="_ref_23835"><a href="fundamental-objects.html#prod-NativeFunctionAccessor">NativeFunctionAccessor</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt> <emu-nt id="_ref_23836"><a href="ecmascript-language-expressions.html#prod-PropertyName">PropertyName</a></emu-nt> must be <var>func</var>.<var class="field">[[InitialName]]</var>.</li><li>If <var>func</var> <emu-xref href="#sec-object-type" id="_ref_9972"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and <emu-xref aoid="IsCallable" id="_ref_9973"><a href="abstract-operations.html#sec-iscallable">IsCallable</a></emu-xref>(<var>func</var>) is <emu-val>true</emu-val>, return an <emu-xref href="#implementation-defined" id="_ref_9974"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> String source code representation of <var>func</var>. The representation must have the syntax of a <emu-nt id="_ref_23837"><a href="fundamental-objects.html#prod-NativeFunction">NativeFunction</a></emu-nt>.</li><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
<emu-grammar type="definition"><emu-production name="NativeFunction" id="prod-NativeFunction">
<emu-nt><a href="fundamental-objects.html#prod-NativeFunction">NativeFunction</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="lzylv9tq">
<emu-t>function</emu-t>
<emu-nt optional="" id="_ref_23838"><a href="fundamental-objects.html#prod-NativeFunctionAccessor">NativeFunctionAccessor</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-nt params="~Yield, ~Await" optional="" id="_ref_23839"><a href="ecmascript-language-expressions.html#prod-PropertyName">PropertyName</a><emu-mods><emu-params>[~Yield, ~Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>(</emu-t>
<emu-nt params="~Yield, ~Await" id="_ref_23840"><a href="ecmascript-language-functions-and-classes.html#prod-FormalParameters">FormalParameters</a><emu-mods><emu-params>[~Yield, ~Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-t>{</emu-t>
<emu-t>[</emu-t>
<emu-t>native</emu-t>
<emu-t>code</emu-t>
<emu-t>]</emu-t>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="NativeFunctionAccessor" id="prod-NativeFunctionAccessor">
<emu-nt><a href="fundamental-objects.html#prod-NativeFunctionAccessor">NativeFunctionAccessor</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="pyjeuhoq">
<emu-t>get</emu-t>
</emu-rhs>
<emu-rhs a="yzcmeszd">
<emu-t>set</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
</emu-clause>
<emu-clause oldids="sec-function.prototype-@@hasinstance" id="sec-function.prototype-%symbol.hasinstance%" type="built-in function"><span id="sec-function.prototype-@@hasinstance"></span>
<h1><span class="secnum">20.2.3.6</span> Function.prototype [ %Symbol.hasInstance% ] ( <var>V</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>F</var> be the <emu-val>this</emu-val> value.</li><li>Return ?&nbsp;<emu-xref aoid="OrdinaryHasInstance" id="_ref_9975"><a href="abstract-operations.html#sec-ordinaryhasinstance" class="e-user-code">OrdinaryHasInstance</a></emu-xref>(<var>F</var>, <var>V</var>).</li></ol></emu-alg>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This is the default implementation of <code>%Symbol.hasInstance%</code> that most functions inherit. <code>%Symbol.hasInstance%</code> is called by the <code>instanceof</code> operator to determine whether a value is an instance of a specific <emu-xref href="#constructor" id="_ref_9976"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. An expression such as</p>
<pre><code class="javascript hljs">v <span class="hljs-keyword">instanceof</span> F</code></pre>
<p>evaluates as</p>
<pre><code class="javascript hljs">F[%<span class="hljs-title class_">Symbol</span>.<span class="hljs-property">hasInstance</span>%](v)</code></pre>
<p>A <emu-xref href="#constructor" id="_ref_9977"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> function can control which objects are recognized as its instances by <code>instanceof</code> by exposing a different <code>%Symbol.hasInstance%</code> method on the function.</p>
</div></emu-note>
<p>This property is non-writable and non-configurable to prevent tampering that could be used to globally expose the target function of a bound function.</p>
<p>The value of the <emu-val>"name"</emu-val> property of this method is <emu-val>"[Symbol.hasInstance]"</emu-val>.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-function-instances">
<h1><span class="secnum">20.2.4</span> Function Instances</h1>
<p>Every Function instance is an ECMAScript <emu-xref href="#function-object" id="_ref_9978"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref> and has the internal slots listed in <emu-xref href="#table-internal-slots-of-ecmascript-function-objects" id="_ref_607"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-ecmascript-function-objects">Table 25</a></emu-xref>. <emu-xref href="#function-object" id="_ref_9979"><a href="ecmascript-data-types-and-values.html#function-object">Function objects</a></emu-xref> created using the <code>Function.prototype.bind</code> method (<emu-xref href="#sec-function.prototype.bind" id="_ref_608"><a href="fundamental-objects.html#sec-function.prototype.bind">20.2.3.2</a></emu-xref>) have the internal slots listed in <emu-xref href="#table-internal-slots-of-bound-function-exotic-objects" id="_ref_609"><a href="ordinary-and-exotic-objects-behaviours.html#table-internal-slots-of-bound-function-exotic-objects">Table 26</a></emu-xref>.</p>
<p>Function instances have the following properties:</p>
<emu-clause id="sec-function-instances-length">
<h1><span class="secnum">20.2.4.1</span> length</h1>
<p>The value of the <emu-val>"length"</emu-val> property is an <emu-xref href="#integral-number" id="_ref_9980"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> that indicates the typical number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behaviour of a function when invoked on a number of arguments other than the number specified by its <emu-val>"length"</emu-val> property depends on the function. This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-function-instances-name">
<h1><span class="secnum">20.2.4.2</span> name</h1>
<p>The value of the <emu-val>"name"</emu-val> property <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_9981"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref> that is descriptive of the function. The name has no semantic significance but is typically a variable or <emu-xref href="#property-name" id="_ref_9982"><a href="ecmascript-data-types-and-values.html#property-name">property name</a></emu-xref> that is used to refer to the function at its point of definition in <emu-xref href="#sec-source-text" id="_ref_9983"><a href="ecmascript-language-source-code.html#sec-source-text">ECMAScript source text</a></emu-xref>. This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
<p>Anonymous <emu-xref href="#function-object" id="_ref_9984"><a href="ecmascript-data-types-and-values.html#function-object">function objects</a></emu-xref> that do not have a contextual name associated with them by this specification use the empty String as the value of the <emu-val>"name"</emu-val> property.</p>
</emu-clause>
<emu-clause id="sec-function-instances-prototype">
<h1><span class="secnum">20.2.4.3</span> prototype</h1>
<p>Function instances that can be used as a <emu-xref href="#constructor" id="_ref_9985"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> have a <emu-val>"prototype"</emu-val> property. Whenever such a Function instance is created another <emu-xref href="#ordinary-object" id="_ref_9986"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref> is also created and is the initial value of the function's <emu-val>"prototype"</emu-val> property. Unless otherwise specified, the value of the <emu-val>"prototype"</emu-val> property is used to initialize the <var class="field">[[Prototype]]</var> internal slot of the object created when that function is invoked as a <emu-xref href="#constructor" id="_ref_9987"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><emu-xref href="#function-object" id="_ref_9988"><a href="ecmascript-data-types-and-values.html#function-object">Function objects</a></emu-xref> created using <code>Function.prototype.bind</code>, or by evaluating a <emu-nt id="_ref_23841"><a href="ecmascript-language-functions-and-classes.html#prod-MethodDefinition">MethodDefinition</a></emu-nt> (that is not a <emu-nt id="_ref_23842"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorMethod">GeneratorMethod</a></emu-nt> or <emu-nt id="_ref_23843"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorMethod">AsyncGeneratorMethod</a></emu-nt>) or an <emu-nt id="_ref_23844"><a href="ecmascript-language-functions-and-classes.html#prod-ArrowFunction">ArrowFunction</a></emu-nt> do not have a <emu-val>"prototype"</emu-val> property.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-hosthassourcetextavailable" type="host-defined abstract operation" aoid="HostHasSourceTextAvailable">
<h1><span class="secnum">20.2.5</span> HostHasSourceTextAvailable ( <var>func</var> )</h1>
<p>The <emu-xref href="#host-defined" id="_ref_9989"><a href="overview.html#host-defined">host-defined</a></emu-xref> abstract operation HostHasSourceTextAvailable takes argument <var>func</var> (a <emu-xref href="#function-object" id="_ref_9990"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>) and returns a Boolean. It allows <emu-xref href="#host-environment" id="_ref_9991"><a href="overview.html#host-environment">host environments</a></emu-xref> to prevent the source text from being provided for <var>func</var>.</p>
<p>An implementation of HostHasSourceTextAvailable must conform to the following requirements:</p>
<ul>
<li>It must be deterministic with respect to its parameters. Each time it is called with a specific <var>func</var> as its argument, it must return the same result.</li>
</ul>
<p>The default implementation of HostHasSourceTextAvailable is to return <emu-val>true</emu-val>.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-boolean-objects">
<h1><span class="secnum">20.3</span> Boolean Objects</h1>
<emu-clause id="sec-boolean-constructor">
<h1><span class="secnum">20.3.1</span> The Boolean Constructor</h1>
<p>The Boolean <emu-xref href="#constructor" id="_ref_9992"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Boolean%</dfn>.</li>
<li>is the initial value of the <emu-val>"Boolean"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_9993"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates and initializes a new Boolean object when called as a <emu-xref href="#constructor" id="_ref_9994"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>performs a type conversion when called as a function rather than as a <emu-xref href="#constructor" id="_ref_9995"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_9996"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified Boolean behaviour must include a <code>super</code> call to the Boolean <emu-xref href="#constructor" id="_ref_9997"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize the subclass instance with a <var class="field">[[BooleanData]]</var> internal slot.</li>
</ul>
<emu-clause id="sec-boolean-constructor-boolean-value" type="built-in function">
<h1><span class="secnum">20.3.1.1</span> Boolean ( <var>value</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>b</var> be <emu-xref aoid="ToBoolean" id="_ref_9998"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(<var>value</var>).</li><li>If NewTarget is <emu-val>undefined</emu-val>, return <var>b</var>.</li><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_9999"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(NewTarget, <emu-val>"%Boolean.prototype%"</emu-val>, « <var class="field">[[BooleanData]]</var>&nbsp;»).</li><li>Set <var>O</var>.<var class="field">[[BooleanData]]</var> to <var>b</var>.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-boolean-constructor">
<h1><span class="secnum">20.3.2</span> Properties of the Boolean Constructor</h1>
<p>The Boolean <emu-xref href="#constructor" id="_ref_10000"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_10001"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-boolean.prototype">
<h1><span class="secnum">20.3.2.1</span> Boolean.prototype</h1>
<p>The initial value of <code>Boolean.prototype</code> is the <emu-xref href="#sec-properties-of-the-boolean-prototype-object" id="_ref_10002"><a href="fundamental-objects.html#sec-properties-of-the-boolean-prototype-object">Boolean prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-boolean-prototype-object">
<h1><span class="secnum">20.3.3</span> Properties of the Boolean Prototype Object</h1>
<p>The <dfn tabindex="-1">Boolean prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Boolean.prototype%</dfn>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10003"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>is itself a Boolean object; it has a <var class="field">[[BooleanData]]</var> internal slot with the value <emu-val>false</emu-val>.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10004"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
</ul>
<emu-clause id="sec-boolean.prototype.constructor">
<h1><span class="secnum">20.3.3.1</span> Boolean.prototype.constructor</h1>
<p>The initial value of <code>Boolean.prototype.constructor</code> is <emu-xref href="#sec-boolean-constructor" id="_ref_10005"><a href="fundamental-objects.html#sec-boolean-constructor">%Boolean%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-boolean.prototype.tostring" type="built-in function">
<h1><span class="secnum">20.3.3.2</span> Boolean.prototype.toString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>b</var> be ?&nbsp;<emu-xref aoid="ThisBooleanValue" id="_ref_10006"><a href="fundamental-objects.html#sec-thisbooleanvalue">ThisBooleanValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>If <var>b</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 id="sec-boolean.prototype.valueof" type="built-in function">
<h1><span class="secnum">20.3.3.3</span> Boolean.prototype.valueOf ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ThisBooleanValue" id="_ref_10007"><a href="fundamental-objects.html#sec-thisbooleanvalue">ThisBooleanValue</a></emu-xref>(<emu-val>this</emu-val> value).</li></ol></emu-alg>
<emu-clause id="sec-thisbooleanvalue" type="abstract operation" oldids="thisbooleanvalue" aoid="ThisBooleanValue"><span id="thisbooleanvalue"></span>
<h1><span class="secnum">20.3.3.3.1</span> ThisBooleanValue ( <var>value</var> )</h1>
<p>The abstract operation ThisBooleanValue takes argument <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_10008"><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_10009"><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_10010"><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>value</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_10011"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref>, return <var>value</var>.</li><li>If <var>value</var> <emu-xref href="#sec-object-type" id="_ref_10012"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and <var>value</var> has a <var class="field">[[BooleanData]]</var> internal slot, then<ol><li>Let <var>b</var> be <var>value</var>.<var class="field">[[BooleanData]]</var>.</li><li><emu-xref href="#assert" id="_ref_10013"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>b</var> <emu-xref href="#sec-ecmascript-language-types-boolean-type" id="_ref_10014"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-boolean-type">is a Boolean</a></emu-xref>.</li><li>Return <var>b</var>.</li></ol></li><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-boolean-instances">
<h1><span class="secnum">20.3.4</span> Properties of Boolean Instances</h1>
<p>Boolean instances are <emu-xref href="#ordinary-object" id="_ref_10015"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-properties-of-the-boolean-prototype-object" id="_ref_10016"><a href="fundamental-objects.html#sec-properties-of-the-boolean-prototype-object">Boolean prototype object</a></emu-xref>. Boolean instances have a <var class="field">[[BooleanData]]</var> internal slot. The <var class="field">[[BooleanData]]</var> internal slot is the Boolean value represented by this Boolean object.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-symbol-objects">
<h1><span class="secnum">20.4</span> Symbol Objects</h1>
<emu-clause id="sec-symbol-constructor">
<h1><span class="secnum">20.4.1</span> The Symbol Constructor</h1>
<p>The Symbol <emu-xref href="#constructor" id="_ref_10017"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Symbol%</dfn>.</li>
<li>is the initial value of the <emu-val>"Symbol"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10018"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>returns a new Symbol value when called as a function.</li>
<li>is not intended to be used with the <code>new</code> operator.</li>
<li>is not intended to be subclassed.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition but a <code>super</code> call to it will cause an exception.</li>
</ul>
<emu-clause id="sec-symbol-description" type="built-in function">
<h1><span class="secnum">20.4.1.1</span> Symbol ( [ <var>description</var> ] )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>description</var> is <emu-val>undefined</emu-val>, let <var>descString</var> be <emu-val>undefined</emu-val>.</li><li>Else, let <var>descString</var> be ?&nbsp;<emu-xref aoid="ToString" id="_ref_10019"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>description</var>).</li><li>Return a new Symbol whose <var class="field">[[Description]]</var> is <var>descString</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-symbol-constructor">
<h1><span class="secnum">20.4.2</span> Properties of the Symbol Constructor</h1>
<p>The Symbol <emu-xref href="#constructor" id="_ref_10020"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_10021"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-symbol.asynciterator">
<h1><span class="secnum">20.4.2.1</span> Symbol.asyncIterator</h1>
<p>The initial value of <code>Symbol.asyncIterator</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10022"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.asyncIterator%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_610"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.for" type="built-in function">
<h1><span class="secnum">20.4.2.2</span> Symbol.for ( <var>key</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>stringKey</var> be ?&nbsp;<emu-xref aoid="ToString" id="_ref_10023"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>key</var>).</li><li>For each element <var>e</var> of the <emu-xref href="#sec-symbol.for" id="_ref_10024"><a href="fundamental-objects.html#sec-symbol.for">GlobalSymbolRegistry List</a></emu-xref>, do<ol><li>If <var>e</var>.<var class="field">[[Key]]</var> is <var>stringKey</var>, return <var>e</var>.<var class="field">[[Symbol]]</var>.</li></ol></li><li><emu-xref href="#assert" id="_ref_10025"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The <emu-xref href="#sec-symbol.for" id="_ref_10026"><a href="fundamental-objects.html#sec-symbol.for">GlobalSymbolRegistry List</a></emu-xref> does not currently contain an entry for <var>stringKey</var>.</li><li>Let <var>newSymbol</var> be a new Symbol whose <var class="field">[[Description]]</var> is <var>stringKey</var>.</li><li>Append the GlobalSymbolRegistry <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10027"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> { <var class="field">[[Key]]</var>: <var>stringKey</var>, <var class="field">[[Symbol]]</var>: <var>newSymbol</var>&nbsp;} to the <emu-xref href="#sec-symbol.for" id="_ref_10028"><a href="fundamental-objects.html#sec-symbol.for">GlobalSymbolRegistry List</a></emu-xref>.</li><li>Return <var>newSymbol</var>.</li></ol></emu-alg>
<p>The <dfn tabindex="-1">GlobalSymbolRegistry List</dfn> is an append-only <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10029"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> that is globally available. It is shared by all <emu-xref href="#realm" id="_ref_10030"><a href="executable-code-and-execution-contexts.html#realm">realms</a></emu-xref>. Prior to the evaluation of any ECMAScript code, it is initialized as a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10031"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>. Elements of the GlobalSymbolRegistry List are <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10032"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Records</a></emu-xref> with the structure defined in <emu-xref href="#table-globalsymbolregistry-record-fields" id="_ref_611"><a href="fundamental-objects.html#table-globalsymbolregistry-record-fields">Table 58</a></emu-xref>.</p>
<emu-table id="table-globalsymbolregistry-record-fields" caption="GlobalSymbolRegistry Record Fields" oldids="table-44"><figure><figcaption>Table 58: GlobalSymbolRegistry <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10033"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> Fields</figcaption><span id="table-44"></span>
<table>
<thead>
<tr>
<th>
Field Name
</th>
<th>
Value
</th>
<th>
Usage
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[Key]]</var>
</td>
<td>
a String
</td>
<td>
A string key used to globally identify a Symbol.
</td>
</tr>
<tr>
<td>
<var class="field">[[Symbol]]</var>
</td>
<td>
a Symbol
</td>
<td>
A symbol that can be retrieved from any <emu-xref href="#realm" id="_ref_10034"><a href="executable-code-and-execution-contexts.html#realm">realm</a></emu-xref>.
</td>
</tr>
</tbody></table>
</figure></emu-table>
</emu-clause>
<emu-clause id="sec-symbol.hasinstance">
<h1><span class="secnum">20.4.2.3</span> Symbol.hasInstance</h1>
<p>The initial value of <code>Symbol.hasInstance</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10035"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.hasInstance%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_612"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.isconcatspreadable">
<h1><span class="secnum">20.4.2.4</span> Symbol.isConcatSpreadable</h1>
<p>The initial value of <code>Symbol.isConcatSpreadable</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10036"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.isConcatSpreadable%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_613"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.iterator">
<h1><span class="secnum">20.4.2.5</span> Symbol.iterator</h1>
<p>The initial value of <code>Symbol.iterator</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10037"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.iterator%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_614"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.keyfor" type="built-in function">
<h1><span class="secnum">20.4.2.6</span> Symbol.keyFor ( <var>sym</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>sym</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_10038"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is not a Symbol</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Return <emu-xref aoid="KeyForSymbol" id="_ref_10039"><a href="fundamental-objects.html#sec-keyforsymbol">KeyForSymbol</a></emu-xref>(<var>sym</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-symbol.match">
<h1><span class="secnum">20.4.2.7</span> Symbol.match</h1>
<p>The initial value of <code>Symbol.match</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10040"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.match%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_615"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.matchall">
<h1><span class="secnum">20.4.2.8</span> Symbol.matchAll</h1>
<p>The initial value of <code>Symbol.matchAll</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10041"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.matchAll%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_616"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.prototype">
<h1><span class="secnum">20.4.2.9</span> Symbol.prototype</h1>
<p>The initial value of <code>Symbol.prototype</code> is the <emu-xref href="#sec-properties-of-the-symbol-prototype-object" id="_ref_10042"><a href="fundamental-objects.html#sec-properties-of-the-symbol-prototype-object">Symbol prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.replace">
<h1><span class="secnum">20.4.2.10</span> Symbol.replace</h1>
<p>The initial value of <code>Symbol.replace</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10043"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.replace%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_617"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.search">
<h1><span class="secnum">20.4.2.11</span> Symbol.search</h1>
<p>The initial value of <code>Symbol.search</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10044"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.search%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_618"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.species">
<h1><span class="secnum">20.4.2.12</span> Symbol.species</h1>
<p>The initial value of <code>Symbol.species</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10045"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.species%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_619"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.split">
<h1><span class="secnum">20.4.2.13</span> Symbol.split</h1>
<p>The initial value of <code>Symbol.split</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10046"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.split%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_620"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.toprimitive">
<h1><span class="secnum">20.4.2.14</span> Symbol.toPrimitive</h1>
<p>The initial value of <code>Symbol.toPrimitive</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10047"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toPrimitive%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_621"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.tostringtag">
<h1><span class="secnum">20.4.2.15</span> Symbol.toStringTag</h1>
<p>The initial value of <code>Symbol.toStringTag</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10048"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toStringTag%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_622"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-symbol.unscopables">
<h1><span class="secnum">20.4.2.16</span> Symbol.unscopables</h1>
<p>The initial value of <code>Symbol.unscopables</code> is the well-known symbol <emu-xref href="#sec-well-known-symbols" id="_ref_10049"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.unscopables%</a></emu-xref> (<emu-xref href="#table-well-known-symbols" id="_ref_623"><a href="ecmascript-data-types-and-values.html#table-well-known-symbols">Table 1</a></emu-xref>).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-symbol-prototype-object">
<h1><span class="secnum">20.4.3</span> Properties of the Symbol Prototype Object</h1>
<p>The <dfn tabindex="-1">Symbol prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Symbol.prototype%</dfn>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10050"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li><emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_10051"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is not a Symbol</a></emu-xref> instance and does not have a <var class="field">[[SymbolData]]</var> internal slot.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10052"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
</ul>
<emu-clause id="sec-symbol.prototype.constructor">
<h1><span class="secnum">20.4.3.1</span> Symbol.prototype.constructor</h1>
<p>The initial value of <code>Symbol.prototype.constructor</code> is <emu-xref href="#sec-symbol-constructor" id="_ref_10053"><a href="fundamental-objects.html#sec-symbol-constructor">%Symbol%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-symbol.prototype.description" type="built-in function">
<h1><span class="secnum">20.4.3.2</span> get Symbol.prototype.description</h1>
<p><code>Symbol.prototype.description</code> is an <emu-xref href="#sec-object-type" id="_ref_10054"><a href="ecmascript-data-types-and-values.html#sec-object-type">accessor property</a></emu-xref> whose set accessor function is <emu-val>undefined</emu-val>. Its get accessor function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>s</var> be the <emu-val>this</emu-val> value.</li><li>Let <var>sym</var> be ?&nbsp;<emu-xref aoid="ThisSymbolValue" id="_ref_10055"><a href="fundamental-objects.html#sec-thissymbolvalue">ThisSymbolValue</a></emu-xref>(<var>s</var>).</li><li>Return <var>sym</var>.<var class="field">[[Description]]</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-symbol.prototype.tostring" type="built-in function">
<h1><span class="secnum">20.4.3.3</span> Symbol.prototype.toString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>sym</var> be ?&nbsp;<emu-xref aoid="ThisSymbolValue" id="_ref_10056"><a href="fundamental-objects.html#sec-thissymbolvalue">ThisSymbolValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Return <emu-xref aoid="SymbolDescriptiveString" id="_ref_10057"><a href="fundamental-objects.html#sec-symboldescriptivestring">SymbolDescriptiveString</a></emu-xref>(<var>sym</var>).</li></ol></emu-alg>
<emu-clause id="sec-symboldescriptivestring" type="abstract operation" aoid="SymbolDescriptiveString">
<h1><span class="secnum">20.4.3.3.1</span> SymbolDescriptiveString ( <var>sym</var> )</h1>
<p>The abstract operation SymbolDescriptiveString takes argument <var>sym</var> (a Symbol) and returns a String. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>desc</var> be <var>sym</var>.<var class="field">[[Description]]</var>.</li><li>If <var>desc</var> is <emu-val>undefined</emu-val>, set <var>desc</var> to the empty String.</li><li><emu-xref href="#assert" id="_ref_10058"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>desc</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_10059"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>.</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_10060"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-val>"Symbol("</emu-val>, <var>desc</var>, and <emu-val>")"</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-symbol.prototype.valueof" type="built-in function">
<h1><span class="secnum">20.4.3.4</span> Symbol.prototype.valueOf ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ThisSymbolValue" id="_ref_10061"><a href="fundamental-objects.html#sec-thissymbolvalue">ThisSymbolValue</a></emu-xref>(<emu-val>this</emu-val> value).</li></ol></emu-alg>
<emu-clause id="sec-thissymbolvalue" type="abstract operation" oldids="thissymbolvalue" aoid="ThisSymbolValue"><span id="thissymbolvalue"></span>
<h1><span class="secnum">20.4.3.4.1</span> ThisSymbolValue ( <var>value</var> )</h1>
<p>The abstract operation ThisSymbolValue takes argument <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_10062"><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_10063"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Symbol or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10064"><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>value</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_10065"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>, return <var>value</var>.</li><li>If <var>value</var> <emu-xref href="#sec-object-type" id="_ref_10066"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and <var>value</var> has a <var class="field">[[SymbolData]]</var> internal slot, then<ol><li>Let <var>s</var> be <var>value</var>.<var class="field">[[SymbolData]]</var>.</li><li><emu-xref href="#assert" id="_ref_10067"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>s</var> <emu-xref href="#sec-ecmascript-language-types-symbol-type" id="_ref_10068"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-symbol-type">is a Symbol</a></emu-xref>.</li><li>Return <var>s</var>.</li></ol></li><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause oldids="sec-symbol.prototype-@@toprimitive" id="sec-symbol.prototype-%symbol.toprimitive%" type="built-in function"><span id="sec-symbol.prototype-@@toprimitive"></span>
<h1><span class="secnum">20.4.3.5</span> Symbol.prototype [ %Symbol.toPrimitive% ] ( <var>hint</var> )</h1>
<p>This method is called by ECMAScript language operators to convert a Symbol object to a primitive value.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ThisSymbolValue" id="_ref_10069"><a href="fundamental-objects.html#sec-thissymbolvalue">ThisSymbolValue</a></emu-xref>(<emu-val>this</emu-val> value).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The argument is ignored.</p>
</div></emu-note>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
<p>The value of the <emu-val>"name"</emu-val> property of this method is <emu-val>"[Symbol.toPrimitive]"</emu-val>.</p>
</emu-clause>
<emu-clause oldids="sec-symbol.prototype-@@tostringtag" id="sec-symbol.prototype-%symbol.tostringtag%"><span id="sec-symbol.prototype-@@tostringtag"></span>
<h1><span class="secnum">20.4.3.6</span> Symbol.prototype [ %Symbol.toStringTag% ]</h1>
<p>The initial value of the <emu-xref href="#sec-well-known-symbols" id="_ref_10070"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toStringTag%</a></emu-xref> property is the String value <emu-val>"Symbol"</emu-val>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-symbol-instances">
<h1><span class="secnum">20.4.4</span> Properties of Symbol Instances</h1>
<p>Symbol instances are <emu-xref href="#ordinary-object" id="_ref_10071"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-properties-of-the-symbol-prototype-object" id="_ref_10072"><a href="fundamental-objects.html#sec-properties-of-the-symbol-prototype-object">Symbol prototype object</a></emu-xref>. Symbol instances have a <var class="field">[[SymbolData]]</var> internal slot. The <var class="field">[[SymbolData]]</var> internal slot is the Symbol value represented by this Symbol object.</p>
</emu-clause>
<emu-clause id="sec-abstract-operations-for-symbols">
<h1><span class="secnum">20.4.5</span> Abstract Operations for Symbols</h1>
<emu-clause id="sec-keyforsymbol" type="abstract operation" aoid="KeyForSymbol">
<h1><span class="secnum">20.4.5.1</span> KeyForSymbol ( <var>sym</var> )</h1>
<p>The abstract operation KeyForSymbol takes argument <var>sym</var> (a Symbol) and returns a String or <emu-val>undefined</emu-val>. If <var>sym</var> is in the <emu-xref href="#sec-symbol.for" id="_ref_10073"><a href="fundamental-objects.html#sec-symbol.for">GlobalSymbolRegistry List</a></emu-xref>, the String used to register <var>sym</var> will be returned. It performs the following steps when called:</p>
<emu-alg><ol><li>For each element <var>e</var> of the <emu-xref href="#sec-symbol.for" id="_ref_10074"><a href="fundamental-objects.html#sec-symbol.for">GlobalSymbolRegistry List</a></emu-xref>, do<ol><li>If <emu-xref aoid="SameValue" id="_ref_10075"><a href="abstract-operations.html#sec-samevalue">SameValue</a></emu-xref>(<var>e</var>.<var class="field">[[Symbol]]</var>, <var>sym</var>) is <emu-val>true</emu-val>, return <var>e</var>.<var class="field">[[Key]]</var>.</li></ol></li><li><emu-xref href="#assert" id="_ref_10076"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The <emu-xref href="#sec-symbol.for" id="_ref_10077"><a href="fundamental-objects.html#sec-symbol.for">GlobalSymbolRegistry List</a></emu-xref> does not currently contain an entry for <var>sym</var>.</li><li>Return <emu-val>undefined</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-error-objects">
<h1><span class="secnum">20.5</span> Error Objects</h1>
<p>Instances of Error objects are thrown as exceptions when runtime errors occur. The Error objects may also serve as base objects for user-defined exception classes.</p>
<p>When an ECMAScript implementation detects a runtime error, it throws a new instance of one of the <var>NativeError</var> objects defined in <emu-xref href="#sec-native-error-types-used-in-this-standard" id="_ref_624"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard">20.5.5</a></emu-xref> or a new instance of the AggregateError object defined in <emu-xref href="#sec-aggregate-error-objects" id="_ref_625"><a href="fundamental-objects.html#sec-aggregate-error-objects">20.5.7</a></emu-xref>.</p>
<emu-clause id="sec-error-constructor">
<h1><span class="secnum">20.5.1</span> The Error Constructor</h1>
<p>The Error <emu-xref href="#constructor" id="_ref_10078"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Error%</dfn>.</li>
<li>is the initial value of the <emu-val>"Error"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10079"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates and initializes a new Error object when called as a function rather than as a <emu-xref href="#constructor" id="_ref_10080"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. Thus the function call <code>Error(…)</code> is equivalent to the object creation expression <code>new Error(…)</code> with the same arguments.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_10081"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified Error behaviour must include a <code>super</code> call to the Error <emu-xref href="#constructor" id="_ref_10082"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize subclass instances with an <var class="field">[[ErrorData]]</var> internal slot.</li>
</ul>
<emu-clause id="sec-error-message" type="built-in function">
<h1><span class="secnum">20.5.1.1</span> Error ( <var>message</var> [ , <var>options</var> ] )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is <emu-val>undefined</emu-val>, let <var>newTarget</var> be the <emu-xref href="#active-function-object" id="_ref_10083"><a href="executable-code-and-execution-contexts.html#active-function-object">active function object</a></emu-xref>; else let <var>newTarget</var> be NewTarget.</li><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_10084"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(<var>newTarget</var>, <emu-val>"%Error.prototype%"</emu-val>, « <var class="field">[[ErrorData]]</var>&nbsp;»).</li><li>If <var>message</var> is not <emu-val>undefined</emu-val>, then<ol><li>Let <var>msg</var> be ?&nbsp;<emu-xref aoid="ToString" id="_ref_10085"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>message</var>).</li><li>Perform <emu-xref aoid="CreateNonEnumerableDataPropertyOrThrow" id="_ref_10086"><a href="abstract-operations.html#sec-createnonenumerabledatapropertyorthrow">CreateNonEnumerableDataPropertyOrThrow</a></emu-xref>(<var>O</var>, <emu-val>"message"</emu-val>, <var>msg</var>).</li></ol></li><li>Perform ?&nbsp;<emu-xref aoid="InstallErrorCause" id="_ref_10087"><a href="fundamental-objects.html#sec-installerrorcause" class="e-user-code">InstallErrorCause</a></emu-xref>(<var>O</var>, <var>options</var>).</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-error-constructor">
<h1><span class="secnum">20.5.2</span> Properties of the Error Constructor</h1>
<p>The Error <emu-xref href="#constructor" id="_ref_10088"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_10089"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-error.iserror" type="built-in function">
<h1><span class="secnum">20.5.2.1</span> Error.isError ( <var>arg</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>arg</var> <emu-xref href="#sec-object-type" id="_ref_10090"><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>If <var>arg</var> does not have an <var class="field">[[ErrorData]]</var> internal slot, return <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-error.prototype">
<h1><span class="secnum">20.5.2.2</span> Error.prototype</h1>
<p>The initial value of <code>Error.prototype</code> is the <emu-xref href="#sec-properties-of-the-error-prototype-object" id="_ref_10091"><a href="fundamental-objects.html#sec-properties-of-the-error-prototype-object">Error prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-error-prototype-object">
<h1><span class="secnum">20.5.3</span> Properties of the Error Prototype Object</h1>
<p>The <dfn tabindex="-1">Error prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Error.prototype%</dfn>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10092"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>is not an Error instance and does not have an <var class="field">[[ErrorData]]</var> internal slot.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10093"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
</ul>
<emu-clause id="sec-error.prototype.constructor">
<h1><span class="secnum">20.5.3.1</span> Error.prototype.constructor</h1>
<p>The initial value of <code>Error.prototype.constructor</code> is <emu-xref href="#sec-error-constructor" id="_ref_10094"><a href="fundamental-objects.html#sec-error-constructor">%Error%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-error.prototype.message">
<h1><span class="secnum">20.5.3.2</span> Error.prototype.message</h1>
<p>The initial value of <code>Error.prototype.message</code> is the empty String.</p>
</emu-clause>
<emu-clause id="sec-error.prototype.name">
<h1><span class="secnum">20.5.3.3</span> Error.prototype.name</h1>
<p>The initial value of <code>Error.prototype.name</code> is <emu-val>"Error"</emu-val>.</p>
</emu-clause>
<emu-clause id="sec-error.prototype.tostring" type="built-in function">
<h1><span class="secnum">20.5.3.4</span> Error.prototype.toString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_10095"><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>name</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_10096"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>O</var>, <emu-val>"name"</emu-val>).</li><li>If <var>name</var> is <emu-val>undefined</emu-val>, set <var>name</var> to <emu-val>"Error"</emu-val>; else set <var>name</var> to ?&nbsp;<emu-xref aoid="ToString" id="_ref_10097"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>name</var>).</li><li>Let <var>msg</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_10098"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>O</var>, <emu-val>"message"</emu-val>).</li><li>If <var>msg</var> is <emu-val>undefined</emu-val>, set <var>msg</var> to the empty String; else set <var>msg</var> to ?&nbsp;<emu-xref aoid="ToString" id="_ref_10099"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>msg</var>).</li><li>If <var>name</var> is the empty String, return <var>msg</var>.</li><li>If <var>msg</var> is the empty String, return <var>name</var>.</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_10100"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>name</var>, the code unit 0x003A (COLON), the code unit 0x0020 (SPACE), and <var>msg</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-error-instances">
<h1><span class="secnum">20.5.4</span> Properties of Error Instances</h1>
<p>Error instances are <emu-xref href="#ordinary-object" id="_ref_10101"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-properties-of-the-error-prototype-object" id="_ref_10102"><a href="fundamental-objects.html#sec-properties-of-the-error-prototype-object">Error prototype object</a></emu-xref> and have an <var class="field">[[ErrorData]]</var> internal slot whose value is <emu-val>undefined</emu-val>. The only specified use of <var class="field">[[ErrorData]]</var> is to identify Error, AggregateError, and <var>NativeError</var> instances as Error objects within <code>Object.prototype.toString</code> and <code>Error.isError</code>.</p>
</emu-clause>
<emu-clause id="sec-native-error-types-used-in-this-standard">
<h1><span class="secnum">20.5.5</span> Native Error Types Used in This Standard</h1>
<p>A new instance of one of the <var>NativeError</var> objects below or of the AggregateError object is thrown when a runtime error is detected. All <var>NativeError</var> objects share the same structure, as described in <emu-xref href="#sec-nativeerror-object-structure" id="_ref_626"><a href="fundamental-objects.html#sec-nativeerror-object-structure">20.5.6</a></emu-xref>.</p>
<emu-clause id="sec-native-error-types-used-in-this-standard-evalerror">
<h1><span class="secnum">20.5.5.1</span> EvalError</h1>
<p>The EvalError <emu-xref href="#constructor" id="_ref_10103"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is <dfn tabindex="-1">%EvalError%</dfn>.</p>
<p>This exception is not currently used within this specification. This object remains for compatibility with previous editions of this specification.</p>
</emu-clause>
<emu-clause id="sec-native-error-types-used-in-this-standard-rangeerror">
<h1><span class="secnum">20.5.5.2</span> RangeError</h1>
<p>The RangeError <emu-xref href="#constructor" id="_ref_10104"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is <dfn tabindex="-1">%RangeError%</dfn>.</p>
<p>Indicates a value that is not in the set or range of allowable values.</p>
</emu-clause>
<emu-clause id="sec-native-error-types-used-in-this-standard-referenceerror">
<h1><span class="secnum">20.5.5.3</span> ReferenceError</h1>
<p>The ReferenceError <emu-xref href="#constructor" id="_ref_10105"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is <dfn tabindex="-1">%ReferenceError%</dfn>.</p>
<p>Indicate that an invalid reference has been detected.</p>
</emu-clause>
<emu-clause id="sec-native-error-types-used-in-this-standard-syntaxerror">
<h1><span class="secnum">20.5.5.4</span> SyntaxError</h1>
<p>The SyntaxError <emu-xref href="#constructor" id="_ref_10106"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is <dfn tabindex="-1">%SyntaxError%</dfn>.</p>
<p>Indicates that a parsing error has occurred.</p>
</emu-clause>
<emu-clause id="sec-native-error-types-used-in-this-standard-typeerror">
<h1><span class="secnum">20.5.5.5</span> TypeError</h1>
<p>The TypeError <emu-xref href="#constructor" id="_ref_10107"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is <dfn tabindex="-1">%TypeError%</dfn>.</p>
<p>TypeError is used to indicate an unsuccessful operation when none of the other <var>NativeError</var> objects are an appropriate indication of the failure cause.</p>
</emu-clause>
<emu-clause id="sec-native-error-types-used-in-this-standard-urierror">
<h1><span class="secnum">20.5.5.6</span> URIError</h1>
<p>The URIError <emu-xref href="#constructor" id="_ref_10108"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is <dfn tabindex="-1">%URIError%</dfn>.</p>
<p>Indicates that one of the global URI handling functions was used in a way that is incompatible with its definition.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-nativeerror-object-structure">
<h1><span class="secnum">20.5.6</span> <var>NativeError</var> Object Structure</h1>
<p>Each of these objects has the structure described below, differing only in the name used as the <emu-xref href="#constructor" id="_ref_10109"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> name and in the <emu-val>"name"</emu-val> property of the prototype object.</p>
<p>For each error object, references to <var>NativeError</var> in the definition should be replaced with the appropriate error object name from <emu-xref href="#sec-native-error-types-used-in-this-standard" id="_ref_627"><a href="fundamental-objects.html#sec-native-error-types-used-in-this-standard">20.5.5</a></emu-xref>.</p>
<emu-clause id="sec-nativeerror-constructors">
<h1><span class="secnum">20.5.6.1</span> The <var>NativeError</var> Constructors</h1>
<p>Each <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10110"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>creates and initializes a new <var>NativeError</var> object when called as a function rather than as a <emu-xref href="#constructor" id="_ref_10111"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. A call of the object as a function is equivalent to calling it as a <emu-xref href="#constructor" id="_ref_10112"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> with the same arguments. Thus the function call <code><var>NativeError</var>(…)</code> is equivalent to the object creation expression <code>new <var>NativeError</var>(…)</code> with the same arguments.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_10113"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified <var>NativeError</var> behaviour must include a <code>super</code> call to the <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10114"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize subclass instances with an <var class="field">[[ErrorData]]</var> internal slot.</li>
</ul>
<emu-clause id="sec-nativeerror" type="built-in function">
<h1><span class="secnum">20.5.6.1.1</span> <var>NativeError</var> ( <var>message</var> [ , <var>options</var> ] )</h1>
<p>Each <var>NativeError</var> function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is <emu-val>undefined</emu-val>, let <var>newTarget</var> be the <emu-xref href="#active-function-object" id="_ref_10115"><a href="executable-code-and-execution-contexts.html#active-function-object">active function object</a></emu-xref>; else let <var>newTarget</var> be NewTarget.</li><li id="step-nativeerror-ordinarycreatefromconstructor">Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_10116"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(<var>newTarget</var>, <code>"%<var>NativeError</var>.prototype%"</code>, « <var class="field">[[ErrorData]]</var>&nbsp;»).</li><li>If <var>message</var> is not <emu-val>undefined</emu-val>, then<ol><li>Let <var>msg</var> be ?&nbsp;<emu-xref aoid="ToString" id="_ref_10117"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>message</var>).</li><li>Perform <emu-xref aoid="CreateNonEnumerableDataPropertyOrThrow" id="_ref_10118"><a href="abstract-operations.html#sec-createnonenumerabledatapropertyorthrow">CreateNonEnumerableDataPropertyOrThrow</a></emu-xref>(<var>O</var>, <emu-val>"message"</emu-val>, <var>msg</var>).</li></ol></li><li>Perform ?&nbsp;<emu-xref aoid="InstallErrorCause" id="_ref_10119"><a href="fundamental-objects.html#sec-installerrorcause" class="e-user-code">InstallErrorCause</a></emu-xref>(<var>O</var>, <var>options</var>).</li><li>Return <var>O</var>.</li></ol></emu-alg>
<p>The actual value of the string passed in step <emu-xref href="#step-nativeerror-ordinarycreatefromconstructor" id="_ref_628"><a href="fundamental-objects.html#step-nativeerror-ordinarycreatefromconstructor">2</a></emu-xref> is either <emu-val>"%EvalError.prototype%"</emu-val>, <emu-val>"%RangeError.prototype%"</emu-val>, <emu-val>"%ReferenceError.prototype%"</emu-val>, <emu-val>"%SyntaxError.prototype%"</emu-val>, <emu-val>"%TypeError.prototype%"</emu-val>, or <emu-val>"%URIError.prototype%"</emu-val> corresponding to which <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10120"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is being defined.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-nativeerror-constructors">
<h1><span class="secnum">20.5.6.2</span> Properties of the <var>NativeError</var> Constructors</h1>
<p>Each <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10121"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-error-constructor" id="_ref_10122"><a href="fundamental-objects.html#sec-error-constructor">%Error%</a></emu-xref>.</li>
<li>has a <emu-val>"name"</emu-val> property whose value is the String value <emu-val>"<var>NativeError</var>"</emu-val>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-nativeerror.prototype">
<h1><span class="secnum">20.5.6.2.1</span> <var>NativeError</var>.prototype</h1>
<p>The initial value of <code><var>NativeError</var>.prototype</code> is a <var>NativeError</var> prototype object (<emu-xref href="#sec-properties-of-the-nativeerror-prototype-objects" id="_ref_629"><a href="fundamental-objects.html#sec-properties-of-the-nativeerror-prototype-objects">20.5.6.3</a></emu-xref>). Each <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10123"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> has a distinct prototype object.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-nativeerror-prototype-objects">
<h1><span class="secnum">20.5.6.3</span> Properties of the <var>NativeError</var> Prototype Objects</h1>
<p>Each <dfn tabindex="-1"><var>NativeError</var> prototype object</dfn>:</p>
<ul>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10124"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>is not an Error instance and does not have an <var class="field">[[ErrorData]]</var> internal slot.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-error-prototype-object" id="_ref_10125"><a href="fundamental-objects.html#sec-properties-of-the-error-prototype-object">%Error.prototype%</a></emu-xref>.</li>
</ul>
<emu-clause id="sec-nativeerror.prototype.constructor">
<h1><span class="secnum">20.5.6.3.1</span> <var>NativeError</var>.prototype.constructor</h1>
<p>The initial value of the <emu-val>"constructor"</emu-val> property of the prototype for a given <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10126"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is the <emu-xref href="#constructor" id="_ref_10127"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> itself.</p>
</emu-clause>
<emu-clause id="sec-nativeerror.prototype.message">
<h1><span class="secnum">20.5.6.3.2</span> <var>NativeError</var>.prototype.message</h1>
<p>The initial value of the <emu-val>"message"</emu-val> property of the prototype for a given <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10128"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is the empty String.</p>
</emu-clause>
<emu-clause id="sec-nativeerror.prototype.name">
<h1><span class="secnum">20.5.6.3.3</span> <var>NativeError</var>.prototype.name</h1>
<p>The initial value of the <emu-val>"name"</emu-val> property of the prototype for a given <var>NativeError</var> <emu-xref href="#constructor" id="_ref_10129"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> is the String value consisting of the name of the <emu-xref href="#constructor" id="_ref_10130"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> (the name used instead of <var>NativeError</var>).</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-nativeerror-instances">
<h1><span class="secnum">20.5.6.4</span> Properties of <var>NativeError</var> Instances</h1>
<p><var>NativeError</var> instances are <emu-xref href="#ordinary-object" id="_ref_10131"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from their <var>NativeError</var> prototype object and have an <var class="field">[[ErrorData]]</var> internal slot whose value is <emu-val>undefined</emu-val>. The only specified use of <var class="field">[[ErrorData]]</var> is by <code>Object.prototype.toString</code> (<emu-xref href="#sec-object.prototype.tostring" id="_ref_630"><a href="fundamental-objects.html#sec-object.prototype.tostring">20.1.3.6</a></emu-xref>) and <code>Error.isError</code> (<emu-xref href="#sec-error.iserror" id="_ref_631"><a href="fundamental-objects.html#sec-error.iserror">20.5.2.1</a></emu-xref>) to identify Error, AggregateError, or <var>NativeError</var> instances.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-aggregate-error-objects">
<h1><span class="secnum">20.5.7</span> AggregateError Objects</h1>
<emu-clause id="sec-aggregate-error-constructor">
<h1><span class="secnum">20.5.7.1</span> The AggregateError Constructor</h1>
<p>The AggregateError <emu-xref href="#constructor" id="_ref_10132"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%AggregateError%</dfn>.</li>
<li>is the initial value of the <emu-val>"AggregateError"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10133"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates and initializes a new AggregateError object when called as a function rather than as a <emu-xref href="#constructor" id="_ref_10134"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>. Thus the function call <code>AggregateError(…)</code> is equivalent to the object creation expression <code>new AggregateError(…)</code> with the same arguments.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_10135"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified AggregateError behaviour must include a <code>super</code> call to the AggregateError <emu-xref href="#constructor" id="_ref_10136"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize subclass instances with an <var class="field">[[ErrorData]]</var> internal slot.</li>
</ul>
<emu-clause id="sec-aggregate-error" type="built-in function">
<h1><span class="secnum">20.5.7.1.1</span> AggregateError ( <var>errors</var>, <var>message</var> [ , <var>options</var> ] )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is <emu-val>undefined</emu-val>, let <var>newTarget</var> be the <emu-xref href="#active-function-object" id="_ref_10137"><a href="executable-code-and-execution-contexts.html#active-function-object">active function object</a></emu-xref>; else let <var>newTarget</var> be NewTarget.</li><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_10138"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(<var>newTarget</var>, <emu-val>"%AggregateError.prototype%"</emu-val>, « <var class="field">[[ErrorData]]</var>&nbsp;»).</li><li>If <var>message</var> is not <emu-val>undefined</emu-val>, then<ol><li>Let <var>msg</var> be ?&nbsp;<emu-xref aoid="ToString" id="_ref_10139"><a href="abstract-operations.html#sec-tostring" class="e-user-code">ToString</a></emu-xref>(<var>message</var>).</li><li>Perform <emu-xref aoid="CreateNonEnumerableDataPropertyOrThrow" id="_ref_10140"><a href="abstract-operations.html#sec-createnonenumerabledatapropertyorthrow">CreateNonEnumerableDataPropertyOrThrow</a></emu-xref>(<var>O</var>, <emu-val>"message"</emu-val>, <var>msg</var>).</li></ol></li><li>Perform ?&nbsp;<emu-xref aoid="InstallErrorCause" id="_ref_10141"><a href="fundamental-objects.html#sec-installerrorcause" class="e-user-code">InstallErrorCause</a></emu-xref>(<var>O</var>, <var>options</var>).</li><li>Let <var>errorsList</var> be ?&nbsp;<emu-xref aoid="IteratorToList" id="_ref_10142"><a href="abstract-operations.html#sec-iteratortolist" class="e-user-code">IteratorToList</a></emu-xref>(? <emu-xref aoid="GetIterator" id="_ref_10143"><a href="abstract-operations.html#sec-getiterator" class="e-user-code">GetIterator</a></emu-xref>(<var>errors</var>, <emu-const>sync</emu-const>)).</li><li>Perform !&nbsp;<emu-xref aoid="DefinePropertyOrThrow" id="_ref_10144"><a href="abstract-operations.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a></emu-xref>(<var>O</var>, <emu-val>"errors"</emu-val>, PropertyDescriptor { <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Writable]]</var>: <emu-val>true</emu-val>, <var class="field">[[Value]]</var>: <emu-xref aoid="CreateArrayFromList" id="_ref_10145"><a href="abstract-operations.html#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>errorsList</var>)&nbsp;}).</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-aggregate-error-constructors">
<h1><span class="secnum">20.5.7.2</span> Properties of the AggregateError Constructor</h1>
<p>The AggregateError <emu-xref href="#constructor" id="_ref_10146"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-error-constructor" id="_ref_10147"><a href="fundamental-objects.html#sec-error-constructor">%Error%</a></emu-xref>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-aggregate-error.prototype">
<h1><span class="secnum">20.5.7.2.1</span> AggregateError.prototype</h1>
<p>The initial value of <code>AggregateError.prototype</code> is <emu-xref href="#sec-properties-of-the-aggregate-error-prototype-objects" id="_ref_10148"><a href="fundamental-objects.html#sec-properties-of-the-aggregate-error-prototype-objects">%AggregateError.prototype%</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-aggregate-error-prototype-objects">
<h1><span class="secnum">20.5.7.3</span> Properties of the AggregateError Prototype Object</h1>
<p>The <dfn tabindex="-1">AggregateError prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%AggregateError.prototype%</dfn>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10149"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>is not an Error instance or an AggregateError instance and does not have an <var class="field">[[ErrorData]]</var> internal slot.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-error-prototype-object" id="_ref_10150"><a href="fundamental-objects.html#sec-properties-of-the-error-prototype-object">%Error.prototype%</a></emu-xref>.</li>
</ul>
<emu-clause id="sec-aggregate-error.prototype.constructor">
<h1><span class="secnum">20.5.7.3.1</span> AggregateError.prototype.constructor</h1>
<p>The initial value of <code>AggregateError.prototype.constructor</code> is <emu-xref href="#sec-aggregate-error-constructor" id="_ref_10151"><a href="fundamental-objects.html#sec-aggregate-error-constructor">%AggregateError%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-aggregate-error.prototype.message">
<h1><span class="secnum">20.5.7.3.2</span> AggregateError.prototype.message</h1>
<p>The initial value of <code>AggregateError.prototype.message</code> is the empty String.</p>
</emu-clause>
<emu-clause id="sec-aggregate-error.prototype.name">
<h1><span class="secnum">20.5.7.3.3</span> AggregateError.prototype.name</h1>
<p>The initial value of <code>AggregateError.prototype.name</code> is <emu-val>"AggregateError"</emu-val>.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-aggregate-error-instances">
<h1><span class="secnum">20.5.7.4</span> Properties of AggregateError Instances</h1>
<p>AggregateError instances are <emu-xref href="#ordinary-object" id="_ref_10152"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from their <emu-xref href="#sec-properties-of-the-aggregate-error-prototype-objects" id="_ref_10153"><a href="fundamental-objects.html#sec-properties-of-the-aggregate-error-prototype-objects">AggregateError prototype object</a></emu-xref> and have an <var class="field">[[ErrorData]]</var> internal slot whose value is <emu-val>undefined</emu-val>. The only specified use of <var class="field">[[ErrorData]]</var> is by <code>Object.prototype.toString</code> (<emu-xref href="#sec-object.prototype.tostring" id="_ref_632"><a href="fundamental-objects.html#sec-object.prototype.tostring">20.1.3.6</a></emu-xref>) and <code>Error.isError</code> (<emu-xref href="#sec-error.iserror" id="_ref_633"><a href="fundamental-objects.html#sec-error.iserror">20.5.2.1</a></emu-xref>) to identify Error, AggregateError, or <var>NativeError</var> instances.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-abstract-operations-for-error-objects">
<h1><span class="secnum">20.5.8</span> Abstract Operations for Error Objects</h1>
<emu-clause id="sec-installerrorcause" type="abstract operation" aoid="InstallErrorCause">
<h1><span class="secnum">20.5.8.1</span> InstallErrorCause ( <var>O</var>, <var>options</var> )</h1>
<p>The abstract operation InstallErrorCause takes arguments <var>O</var> (an Object) and <var>options</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_10154"><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_10155"><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_10156"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It is used to create a <emu-val>"cause"</emu-val> property on <var>O</var> when a <emu-val>"cause"</emu-val> property is present on <var>options</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>options</var> <emu-xref href="#sec-object-type" id="_ref_10157"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and ?&nbsp;<emu-xref aoid="HasProperty" id="_ref_10158"><a href="abstract-operations.html#sec-hasproperty" class="e-user-code">HasProperty</a></emu-xref>(<var>options</var>, <emu-val>"cause"</emu-val>) is <emu-val>true</emu-val>, then<ol><li>Let <var>cause</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_10159"><a href="abstract-operations.html#sec-get-o-p" class="e-user-code">Get</a></emu-xref>(<var>options</var>, <emu-val>"cause"</emu-val>).</li><li>Perform <emu-xref aoid="CreateNonEnumerableDataPropertyOrThrow" id="_ref_10160"><a href="abstract-operations.html#sec-createnonenumerabledatapropertyorthrow">CreateNonEnumerableDataPropertyOrThrow</a></emu-xref>(<var>O</var>, <emu-val>"cause"</emu-val>, <var>cause</var>).</li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause></div></body></html>