You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50570 lines
3.9 MiB

<!DOCTYPE html>
<!-- saved from url=(0053)https://people.mozilla.org/~jorendorff/es6-draft.html -->
<html lang="en-GB"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>ECMAScript Language Specification ECMA-262 6th Edition – DRAFT</title>
<link href="https://people.mozilla.org/~jorendorff/es6-draft.css" rel="stylesheet">
<script src="./ECMAScript Language Specification ECMA-262 6th Edition – DRAFT_files/es6-draft-sections.js"></script>
</head>
<body>
<div id="unofficial">
<p><strong>This is <em>not</em> the official ECMAScript Language Specification.</strong></p>
<p>The most recent final ECMAScript standard is Edition 5.1, the PDF document located at <a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf">http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf</a>.</p>
<p>This is a draft of the next edition of the standard.</p>
<p>This page is based on the current working draft published at <a href="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts">http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts</a>.
The program used to convert that Word doc to HTML is a custom-piled heap of hacks. It may have stripped out or garbled some of
the formatting that makes the specification comprehensible. You can help improve the program <a href="https://github.com/jorendorff/es-spec-html">here</a>.</p>
<p>For copyright information, see Ecma International’s legal disclaimer in the document itself.</p>
</div>
<hgroup>
<h1>ECMA-262</h1>
<h1>6<sup>th</sup> Edition / Draft April 5, 2014</h1>
<h1>Draft</h1>
</hgroup>
<hgroup>
<h1>ECMAScript Language Specification</h1>
<p>Draft</p>
<p>Report Errors and Issues at: https://bugs.ecmascript.org</p>
<p>Product: Draft for 6th Edition</p>
<p>Component: choose an appropriate one</p>
<p>Version: Rev 23, April 5, 2014 Draft</p>
<h1>Ecma/TC39/2014/0xx</h1>
</hgroup>
<section id="contents">
<h1>Contents</h1>
<ol class="toc">
<li>Introduction</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scope">1</a></span> Scope</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conformance">2</a></span> Conformance</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normative-references">3</a></span> Normative references</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-overview">4</a></span> Overview
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-web-scripting">4.1</a></span> Web Scripting</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-overview">4.2</a></span> ECMAScript Overview
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objects">4.2.1</a></span> Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-variant-of-ecmascript">4.2.2</a></span> The Strict Variant of
ECMAScript</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions">4.3</a></span> Terms and definitions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-type">4.3.1</a></span> type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primitive-value">4.3.2</a></span> primitive value</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-object">4.3.3</a></span> object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor">4.3.4</a></span> constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-prototype">4.3.5</a></span> prototype</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object">4.3.6</a></span> ordinary object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exotic-object">4.3.7</a></span> exotic object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-standard-object">4.3.8</a></span> standard object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-object">4.3.9</a></span> built-in object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-undefined-value">4.3.10</a></span> undefined value</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-undefined-type">4.3.11</a></span> Undefined type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-null-value">4.3.12</a></span> null value</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-null-type">4.3.13</a></span> Null type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-boolean-value">4.3.14</a></span> Boolean value</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-boolean-type">4.3.15</a></span> Boolean type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-object">4.3.16</a></span> Boolean object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-string-value">4.3.17</a></span> String value</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-string-type">4.3.18</a></span> String type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-object">4.3.19</a></span> String object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-number-value">4.3.20</a></span> Number value</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-number-type">4.3.21</a></span> Number type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-object">4.3.22</a></span> Number object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-infinity">4.3.23</a></span> Infinity</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-nan">4.3.24</a></span> NaN</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-">4.3.25</a></span> </li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-symbol-type">4.3.26</a></span> Symbol type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-object">4.3.27</a></span> Symbol object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-function">4.3.28</a></span> function</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function">4.3.29</a></span> built-in function</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property">4.3.30</a></span> property</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method">4.3.31</a></span> method</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-method">4.3.32</a></span> built-in method</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-attribute">4.3.33</a></span> attribute</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-own-property">4.3.34</a></span> own property</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-inherited-property">4.3.35</a></span> inherited property</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-organization-of-this-specification">4.4</a></span> Organization of This
Specification</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-notational-conventions">5</a></span> Notational Conventions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-syntactic-and-lexical-grammars">5.1</a></span> Syntactic and Lexical Grammars
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-context-free-grammars">5.1.1</a></span> Context-Free Grammars</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-and-regexp-grammars">5.1.2</a></span> The Lexical and RegExp
Grammars</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-numeric-string-grammar">5.1.3</a></span> The Numeric String Grammar</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-syntactic-grammar">5.1.4</a></span> The Syntactic Grammar</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grammar-notation">5.1.5</a></span> Grammar Notation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">5.2</a></span> Algorithm Conventions</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a></span> Static Semantic Rules</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">6</a></span> ECMAScript Data Types and Values
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">6.1</a></span> ECMAScript Language Types
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type">6.1.1</a></span> The Undefined
Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-null-type">6.1.2</a></span> The Null Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-boolean-type">6.1.3</a></span> The Boolean Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a></span> The String Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type">6.1.5</a></span> The Symbol Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">6.1.6</a></span> The Number Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">6.1.7</a></span> The Object Type</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-specification-types">6.2</a></span> ECMAScript Specification Types
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">6.2.1</a></span> The List and Record
Specification Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">6.2.2</a></span> The Completion Record
Specification Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">6.2.3</a></span> The Reference Specification
Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">6.2.4</a></span> The Property
Descriptor Specification Type</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environment-and-environment-record-specification-types">6.2.5</a></span> The Lexical
Environment and Environment Record Specification Types</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-data-blocks">6.2.6</a></span> Data Blocks</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations">7</a></span> Abstract Operations
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-type-conversion-and-testing">7.1</a></span> Type Conversion and Testing
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">7.1.1</a></span> ToPrimitive</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">7.1.2</a></span> ToBoolean</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">7.1.3</a></span> ToNumber</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">7.1.4</a></span> ToInteger</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">7.1.5</a></span> ToInt32: (Signed 32 Bit Integer)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">7.1.6</a></span> ToUint32: (Unsigned 32 Bit Integer)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint16">7.1.7</a></span> ToInt16: (Signed 16 Bit Integer)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16">7.1.8</a></span> ToUint16: (Unsigned 16 Bit Integer)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8">7.1.9</a></span> ToInt8: (Signed 8 Bit Integer)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8">7.1.10</a></span> ToUint8: (Unsigned 8 Bit Integer)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp">7.1.11</a></span> ToUint8Clamp: (Unsigned 8 Bit Integer,
Clamped)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">7.1.12</a></span> ToString</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">7.1.13</a></span> ToObject</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">7.1.14</a></span> ToPropertyKey</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">7.1.15</a></span> ToLength</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-canonicalnumericstring">7.1.16</a></span> CanonicalNumericString(argument)</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testing-and-comparison-operations">7.2</a></span> Testing and Comparison Operations
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">7.2.1</a></span> CheckObjectCoercible</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">7.2.2</a></span> IsCallable</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">7.2.3</a></span> SameValue(x, y)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">7.2.4</a></span> SameValueZero(x, y)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">7.2.5</a></span> IsConstructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">7.2.6</a></span> IsPropertyKey</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">7.2.7</a></span> IsExtensible (O)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">7.2.8</a></span> IsInteger</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-relational-comparison">7.2.9</a></span> Abstract Relational
Comparison</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-equality-comparison">7.2.10</a></span> Abstract Equality
Comparison</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-equality-comparison">7.2.11</a></span> Strict Equality Comparison</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-objects">7.3</a></span> Operations on Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">7.3.1</a></span> Get (O, P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">7.3.2</a></span> Put (O, P, V, Throw)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">7.3.3</a></span> CreateDataProperty (O, P, V)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">7.3.4</a></span> CreateDataPropertyOrThrow (O, P,
V)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">7.3.5</a></span> DefinePropertyOrThrow (O, P, desc)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">7.3.6</a></span> DeletePropertyOrThrow (O, P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">7.3.7</a></span> GetMethod (O, P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">7.3.8</a></span> HasProperty (O, P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">7.3.9</a></span> HasOwnProperty (O, P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">7.3.10</a></span> Invoke(O,P, [args])</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setintegritylevel">7.3.11</a></span> SetIntegrityLevel (O, level)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testintegritylevel">7.3.12</a></span> TestIntegrityLevel (O, level)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist">7.3.13</a></span> CreateArrayFromList (elements)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistfromarraylike">7.3.14</a></span> CreateListFromArrayLike (obj)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinaryhasinstance">7.3.15</a></span> OrdinaryHasInstance (C, O)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">7.3.16</a></span> GetPrototypeFromConstructor (
constructor, intrinsicDefaultProto )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor">7.3.17</a></span> CreateFromConstructor (F)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">7.3.18</a></span> Construct (F, argumentsList)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">7.3.19</a></span> GetOption (options, P)</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">7.4</a></span> Operations on Iterator Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">7.4.1</a></span> GetIterator ( obj, method )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isiterable">7.4.2</a></span> IsIterable ( obj )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratornext">7.4.3</a></span> IteratorNext ( iterator, value )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorcomplete">7.4.4</a></span> IteratorComplete ( iterResult )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">7.4.5</a></span> IteratorValue ( iterResult )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">7.4.6</a></span> IteratorStep ( iterator)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">7.4.7</a></span> CreateIterResultObject (value,
done)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistiterator">7.4.8</a></span> CreateListIterator (list)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createemptyiterator">7.4.9</a></span> CreateEmptyIterator ( )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-promise-objects">7.5</a></span> Operations on Promise Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisenew-executor-abstaction-operation">7.5.1</a></span> PromiseNew (
executor ) Abstaction Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisebuiltincapability-abstaction-operation">7.5.2</a></span>
PromiseBuiltinCapability () Abstaction Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseof-value-abstaction-operation">7.5.3</a></span> PromiseOf (value)
Abstaction Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseall-promiselist-abstaction-operation">7.5.4</a></span> PromiseAll
(promiseList) Abstaction Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisecatch-promise-rejectedaction-abstaction-operation">7.5.5</a></span>
PromiseCatch (promise, rejectedAction) Abstaction Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisethen-promise-resolvedaction-rejectedaction-abstaction-operation">7.5.6</a></span> PromiseThen
(promise, resolvedAction, rejectedAction) Abstaction Operation</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-executable-code-and-execution-contexts">8</a></span> Executable Code and Execution
Contexts
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">8.1</a></span> Lexical Environments
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">8.1.1</a></span> Environment Records</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environment-operations">8.1.2</a></span> Lexical Environment
Operations</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">8.2</a></span> Code Realms
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createrealm">8.2.1</a></span> CreateRealm ( )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">8.3</a></span> Execution Contexts
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvebinding">8.3.1</a></span> ResolveBinding(name)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisenvironment">8.3.2</a></span> GetThisEnvironment</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvethisbinding">8.3.3</a></span> ResolveThisBinding</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getglobalobject">8.3.4</a></span> GetGlobalObject</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tasks-and-task-queues">8.4</a></span> Tasks and Task Queues
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-enqueuetask">8.4.1</a></span> EnqueueTask ( queueName, task, arguments)
Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nexttask-result-algorithm-step">8.4.2</a></span> NextTask ( result ) Algorithm
Step</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initialization">8.5</a></span> Initialization</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-and-exotic-objects-behaviours">9</a></span> Ordinary and Exotic Objects
Behaviours
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a></span> Ordinary Object
Internal Methods and Internal Slots
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof">9.1.1</a></span> [[GetPrototypeOf]]
( )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-setprototypeof-v">9.1.2</a></span>
[[SetPrototypeOf]] (V)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-isextensible">9.1.3</a></span> [[IsExtensible]] (
)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-preventextensions">9.1.4</a></span>
[[PreventExtensions]] ( )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p">9.1.5</a></span>
[[GetOwnProperty]] (P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc">9.1.6</a></span>
[[DefineOwnProperty]] (P, Desc)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p">9.1.7</a></span>
[[HasProperty]](P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver">9.1.8</a></span> [[Get]] (P,
Receiver)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver">9.1.9</a></span> [[Set]] ( P, V,
Receiver)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-delete-p">9.1.10</a></span>
[[Delete]] (P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-enumerate">9.1.11</a></span> [[Enumerate]] ()</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys">9.1.12</a></span>
[[OwnPropertyKeys]] ( )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">9.1.13</a></span> ObjectCreate(proto, internalSlotsList) Abstract
Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">9.1.14</a></span> OrdinaryCreateFromConstructor
( constructor, intrinsicDefaultProto, internalSlotsList )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">9.2</a></span> ECMAScript Function Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-argumentslist">9.2.1</a></span> [[Construct]] ( argumentsList)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-getownproperty-p">9.2.2</a></span>
[[GetOwnProperty]] (P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">9.2.3</a></span> FunctionAllocate Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist">9.2.4</a></span>
[[Call]] ( thisArgument, argumentsList)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioninitialize">9.2.5</a></span> FunctionInitialize Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">9.2.6</a></span> FunctionCreate Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate">9.2.7</a></span> GeneratorFunctionCreate Abstract
Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">9.2.8</a></span>
AddRestrictedFunctionProperties Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">9.2.9</a></span> MakeConstructor Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">9.2.10</a></span> MakeMethod ( F, methodName, homeObject) Abstract
Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">9.2.11</a></span> SetFunctionName Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperbinding">9.2.12</a></span> GetSuperBinding(obj) Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonemethod">9.2.13</a></span> CloneMethod(function, newHome, newName) Abstract
Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation">9.2.14</a></span> Function Declaration
Instantiation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects">9.3</a></span> Built-in Function Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects-call-thisargument-argumentslist">9.3.1</a></span>
[[Call]] ( thisArgument, argumentsList)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction">9.3.2</a></span> CreateBuiltinFunction(realm, steps,
internaSlotsList) Abstract Operation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-exotic-object-internal-methods-and-data-fields">9.4</a></span> Built-in
Exotic Object Internal Methods and Data Fields
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">9.4.1</a></span> Bound Function Exotic
Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects">9.4.2</a></span> Array Exotic Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects">9.4.3</a></span> String Exotic Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects">9.4.4</a></span> Arguments Exotic Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects">9.4.5</a></span> Integer Indexed Exotic
Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects">9.4.6</a></span> Module Exotic Objects</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots">9.5</a></span> Proxy Object
Internal Methods and Internal Slots
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof">9.5.1</a></span> [[GetPrototypeOf]] (
)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v">9.5.2</a></span> [[SetPrototypeOf]]
(V)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-isextensible">9.5.3</a></span>
[[IsExtensible]] ( )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-preventextensions">9.5.4</a></span>
[[PreventExtensions]] ( )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p">9.5.5</a></span> [[GetOwnProperty]]
(P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc">9.5.6</a></span>
[[DefineOwnProperty]] (P, Desc)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p">9.5.7</a></span> [[HasProperty]]
(P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver">9.5.8</a></span> [[Get]] (P,
Receiver)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver">9.5.9</a></span> [[Set]] ( P, V,
Receiver)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-delete-p">9.5.10</a></span>
[[Delete]] (P)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-enumerate">9.5.11</a></span>
[[Enumerate]] ()</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys">9.5.12</a></span> [[OwnPropertyKeys]]
( )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist">9.5.13</a></span>
[[Call]] (thisArgument, argumentsList)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-internal-method">9.5.14</a></span> [[Construct]] Internal Method</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxycreate">9.5.15</a></span> ProxyCreate(target, handler) Abstract
Operation</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-source-code">10</a></span> ECMAScript Language: Source Code
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-source-text">10.1</a></span> Source Text
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a></span> Static Semantics:
<i>UTF-16 Encoding</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-utf16decode">10.1.2</a></span> Static Semantics: UTF16Decode(lead, trail)</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-types-of-source-code">10.2</a></span> Types of Source Code
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a></span> Strict Mode Code</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-non-ecmascript-functions">10.2.2</a></span> Non-ECMAScript Functions</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-lexical-grammar">11</a></span> ECMAScript Language: Lexical Grammar
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unicode-format-control-characters">11.1</a></span> Unicode Format-Control
Characters</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">11.2</a></span> White Space</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-line-terminators">11.3</a></span> Line Terminators</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comments">11.4</a></span> Comments</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tokens">11.5</a></span> Tokens</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-names-and-keywords">11.6</a></span> Names and Keywords
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-names">11.6.1</a></span> Identifier Names</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words">11.6.2</a></span> Reserved Words</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-punctuators">11.7</a></span> Punctuators</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-lexical-grammar-literals">11.8</a></span> Literals
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-null-literals">11.8.1</a></span> Null Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-literals">11.8.2</a></span> Boolean Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a></span> Numeric Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals">11.8.4</a></span> String Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-regular-expression-literals">11.8.5</a></span> Regular Expression
Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a></span> Template Literal Lexical
Components</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">11.9</a></span> Automatic Semicolon Insertion
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-rules-of-automatic-semicolon-insertion">11.9.1</a></span> Rules of Automatic
Semicolon Insertion</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-examples-of-automatic-semicolon-insertion">11.9.2</a></span> Examples of
Automatic Semicolon Insertion</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-expressions">12</a></span> ECMAScript Language: Expressions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers">12.1</a></span> Identifiers
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors">12.1.1</a></span> Static Semantics:
Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a></span> Runtime
Semantics: BindingInitialization</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-boundnames">12.1.3</a></span> Static Semantics:
BoundNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-stringvalue">12.1.4</a></span> Static
Semantics<span style="font-family: sans-serif">:</span> <i>StringValue</i></li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression">12.2</a></span> Primary Expression
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-semantics">12.2.0</a></span> Semantics</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-this-keyword">12.2.1</a></span> The <span style="font-family:
monospace">this</span> Keyword</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-reference">12.2.2</a></span> Identifier Reference</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-literals">12.2.3</a></span> Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-initializer">12.2.4</a></span> Array Initializer</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer">12.2.5</a></span> Object Initializer</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-defining-expressions">12.2.6</a></span> Function Defining
Expressions</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-comprehensions">12.2.7</a></span> Generator Comprehensions</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-regular-expression-literals">12.2.8</a></span> Regular
Expression Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literals">12.2.9</a></span> Template Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator">12.2.10</a></span> The Grouping Operator</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-hand-side-expressions">12.3</a></span> Left-Hand-Side Expressions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-hand-side-expressions-static-semantics">12.3.1</a></span> Static
Semantics</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-accessors">12.3.2</a></span> Property Accessors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-operator">12.3.3</a></span> The <span style="font-family:
monospace">new</span> Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-calls">12.3.4</a></span> Function Calls</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-super-keyword">12.3.5</a></span> The <span style="font-family:
monospace">super</span> Keyword</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists">12.3.6</a></span> Argument Lists</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tagged-templates">12.3.7</a></span> Tagged Templates</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions">12.4</a></span> Postfix Expressions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-early-errors">12.4.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a></span> Static Semantics:
IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-increment-operator">12.4.4</a></span> Postfix Increment Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-decrement-operator">12.4.5</a></span> Postfix Decrement Operator</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators">12.5</a></span> Unary Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-early-errors">12.5.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a></span> Static
Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a></span> Static Semantics:
IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-delete-operator">12.5.4</a></span> The <span style="font-family:
monospace">delete</span> Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-void-operator">12.5.5</a></span> The <span style="font-family:
monospace">void</span> Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typeof-operator">12.5.6</a></span> The <span style="font-family:
monospace">typeof</span> Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-increment-operator">12.5.7</a></span> Prefix Increment Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-decrement-operator">12.5.8</a></span> Prefix Decrement Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-plus-operator">12.5.9</a></span> Unary <span style="font-family:
monospace">+</span> Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-minus-operator">12.5.10</a></span> Unary <span style="font-family:
monospace">-</span> Operator</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-not-operator">12.5.11</a></span> Bitwise NOT Operator ( <span style="font-family: monospace">~</span> )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-logical-not-operator">12.5.12</a></span> Logical NOT Operator ( <span style="font-family: monospace">!</span> )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators">12.6</a></span> Multiplicative Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a></span> Static Semantics:
IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a></span> Static
Semantics: IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-runtime-semantics-evaluation">12.6.3</a></span>
Runtime Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators">12.7</a></span> Additive Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a></span> Static Semantics:
IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addition-operator-plus">12.7.3</a></span> The Addition operator ( <span style="font-family: monospace">+</span> )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-subtraction-operator-minus">12.7.4</a></span> The Subtraction Operator ( <span style="font-family: monospace">-</span> )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">12.7.5</a></span> Applying the
Additive Operators to Numbers</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators">12.8</a></span> Bitwise Shift Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a></span> Static Semantics:
IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a></span> Semantics:
IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-shift-operator">12.8.3</a></span> The Left Shift Operator ( <span style="font-family: monospace">&lt;&lt;</span> )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-signed-right-shift-operator">12.8.4</a></span> The Signed Right Shift Operator
( <span style="font-family: monospace">&gt;&gt;</span> )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unsigned-right-shift-operator">12.8.5</a></span> The Unsigned Right Shift
Operator ( <span style="font-family: monospace">&gt;&gt;&gt;</span> )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators">12.9</a></span> Relational Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a></span> Static
Semantics: IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-runtime-semantics-evaluation">12.9.3</a></span> Runtime
Semantics: Evaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instanceofoperator">12.9.4</a></span> Runtime Semantics: InstanceofOperator(O,
C)</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators">12.10</a></span> Equality Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a></span> Static Semantics:
IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-runtime-semantics-evaluation">12.10.3</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators">12.11</a></span> Binary Bitwise Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a></span> Static Semantics:
IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a></span> Static
Semantics: IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-runtime-semantics-evaluation">12.11.3</a></span>
Runtime Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators">12.12</a></span> Binary Logical Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a></span> Static Semantics:
IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a></span> Static
Semantics: IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-runtime-semantics-evaluation">12.12.3</a></span>
Runtime Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator">12.13</a></span> Conditional Operator ( <span style="font-family: monospace">? : )</span>
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a></span> Static
Semantics: IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-runtime-semantics-evaluation">12.13.3</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">12.14</a></span> Assignment Operators
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-early-errors">12.14.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a></span> Static
Semantics: IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-runtime-semantics-evaluation">12.14.4</a></span> Runtime
Semantics: Evaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-assignment">12.14.5</a></span> Destructuring Assignment</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator">12.15</a></span> Comma Operator ( <span style="font-family:
monospace">, )</span>
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a></span> Static
Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a></span> Static Semantics:
IsValidSimpleAssignmentTarget</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-runtime-semantics-evaluation">12.15.3</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations">13</a></span> ECMAScript Language:
Statements and Declarations
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics">13.0</a></span> Statement Semantics
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a></span> Static
Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a></span>
Runtime Semantics: LabelledEvaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-evaluation">13.0.3</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block">13.1</a></span> Block
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-early-errors">13.1.1</a></span> Static Semantics: Early
Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicaldeclarations">13.1.2</a></span> Static Semantics:
LexicalDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a></span> Static
Semantics: LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevellexicallydeclarednames">13.1.4</a></span> Static
Semantics: TopLevelLexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevellexicallyscopeddeclarations">13.1.5</a></span> Static
Semantics: TopLevelLexicallyScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevelvardeclarednames">13.1.6</a></span> Static Semantics:
TopLevelVarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevelvarscopeddeclarations">13.1.7</a></span> Static
Semantics: TopLevelVarScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a></span> Static Semantics:
VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-varscopeddeclarations">13.1.9</a></span> Static
Semantics: VarScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-runtime-semantics-evaluation">13.1.10</a></span> Runtime Semantics:
Evaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-block-declaration-instantiation">13.1.11</a></span> Runtime
Semantics: Block Declaration Instantiation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarations-and-the-variable-statement">13.2</a></span> Declarations and the
Variable Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations">13.2.1</a></span> Let and Const Declarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement">13.2.2</a></span> Variable Statement</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns">13.2.3</a></span> Destructuring Binding
Patterns</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-empty-statement">13.3</a></span> Empty Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-empty-statement-runtime-semantics-evaluation">13.3.1</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-expression-statement">13.4</a></span> Expression Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-expression-statement-runtime-semantics-evaluation">13.4.1</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement">13.5</a></span> The <span style="font-family: monospace">if</span>
Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a></span> Static
Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-runtime-semantics-evaluation">13.5.2</a></span> Runtime Semantics:
Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements">13.6</a></span> Iteration Statements
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements-semantics">13.6.0</a></span> Semantics</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement">13.6.1</a></span> The <span style="font-family:
monospace">do</span>-<span style="font-family: monospace">while</span> Statement</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement">13.6.2</a></span> The <span style="font-family:
monospace">while</span> Statement</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement">13.6.3</a></span> The <span style="font-family:
monospace">for</span> Statement</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements">13.6.4</a></span> The <span style="font-family:
monospace">for</span>-<span style="font-family: monospace">in</span> and <span style="font-family:
monospace">for</span>-<span style="font-family: monospace">of</span> Statements</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-continue-statement">13.7</a></span> The <span style="font-family:
monospace">continue</span> Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-continue-statement-static-semantics-early-errors">13.7.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-continue-statement-runtime-semantics-evaluation">13.7.2</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-break-statement">13.8</a></span> The <span style="font-family:
monospace">break</span> Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-break-statement-static-semantics-early-errors">13.8.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-break-statement-runtime-semantics-evaluation">13.8.2</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-return-statement">13.9</a></span> The <span style="font-family:
monospace">return</span> Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-return-statement-runtime-semantics-evaluation">13.9.1</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement">13.10</a></span> The <span style="font-family:
monospace">with</span> Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-early-errors">13.10.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a></span> Static
Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-runtime-semantics-evaluation">13.10.3</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement">13.11</a></span> The <span style="font-family:
monospace">switch</span> Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-early-errors">13.11.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicaldeclarations">13.11.2</a></span>
Static Semantics: LexicalDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a></span>
Static Semantics: LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a></span> Static
Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-caseblockevaluation">13.11.5</a></span> Runtime Semantics:
CaseBlockEvaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-caseselectorevaluation">13.11.6</a></span> Runtime Semantics:
CaseSelectorEvaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-runtime-semantics-evaluation">13.11.7</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements">13.12</a></span> Labelled Statements
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-early-errors">13.12.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a></span>
Static Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a></span>
Runtime Semantics: LabelledEvaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-throw-statement">13.13</a></span> The <span style="font-family:
monospace">throw</span> Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-throw-statement-runtime-semantics-evaluation">13.13.1</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement">13.14</a></span> The <span style="font-family: monospace">try</span>
Statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-early-errors">13.14.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a></span> Static
Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization">13.14.3</a></span>
Runtime Semantics: BindingInitialization</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-catchclauseevaluation">13.14.4</a></span> Runtime Semantics:
CatchClauseEvaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-evaluation">13.14.5</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-debugger-statement">13.15</a></span> The <span style="font-family:
monospace">debugger</span> statement
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-debugger-statement-runtime-semantics-evaluation">13.15.1</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-functions-and-classes">14</a></span> ECMAScript Language: Functions
and Classes
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions">14.1</a></span> Function Definitions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">14.1.1</a></span> Directive
Prologues and the Use Strict Directive</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-early-errors">14.1.2</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a></span> Static
Semantics: BoundNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains">14.1.4</a></span> Static
Semantics: Contains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-containsexpression">14.1.5</a></span>
Static Semantics: ContainsExpression</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-expectedargumentcount">14.1.6</a></span>
Static Semantics: ExpectedArgumentCount</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasinitializer">14.1.7</a></span> Static
Semantics: HasInitializer</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a></span> Static
Semantics: HasName</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">14.1.9</a></span> Static Semantics:
IsAnonymousFunctionDefinition ( production) Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isconstantdeclaration">14.1.10</a></span>
Static Semantics: IsConstantDeclaration</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-issimpleparameterlist">14.1.12</a></span>
Static Semantics: IsSimpleParameterList</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isstrict">14.1.13</a></span> Static
Semantics: IsStrict</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a></span>
Static Semantics: LexicalDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicallydeclarednames">14.1.15</a></span> Static Semantics:
LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a></span>
Static Semantics: <i>ReferencesSuper</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-vardeclarednames">14.1.17</a></span>
Static Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-varscopeddeclarations">14.1.18</a></span>
Static Semantics: VarScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-evaluatebody">14.1.19</a></span> Runtime
Semantics: EvaluateBody</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-iteratorbindinginitialization">14.1.20</a></span> Runtime
Semantics: IteratorBindingInitialization</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-instantiatefunctionobject">14.1.21</a></span> Runtime Semantics:
InstantiateFunctionObject</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-evaluation">14.1.22</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions">14.2</a></span> Arrow Function Definitions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-early-errors">14.2.1</a></span>
Static Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a></span>
Static Semantics: BoundNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains">14.2.3</a></span> Static
Semantics: Contains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-containsexpression">14.2.4</a></span> Static Semantics:
ContainsExpression</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-coveredformalslist">14.2.5</a></span> Static Semantics:
CoveredFormalsList</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-expectedargumentcount">14.2.6</a></span> Static Semantics:
ExpectedArgumentCount</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasinitializer">14.2.7</a></span>
Static Semantics: HasInitializer</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname">14.2.8</a></span> Static
Semantics: HasName</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-issimpleparameterlist">14.2.9</a></span> Static Semantics:
IsSimpleParameterList</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a></span> Static Semantics:
LexicalDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicallydeclarednames">14.2.11</a></span> Static
Semantics: LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-referencessuper">14.2.12</a></span>
Static Semantics: ReferencesSuper</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-vardeclarednames">14.2.13</a></span> Static Semantics:
VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-varscopeddeclarations">14.2.14</a></span> Static Semantics:
VarScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-iteratorbindinginitialization">14.2.15</a></span> Runtime
Semantics: IteratorBindingInitialization</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-evaluatebody">14.2.16</a></span>
Runtime Semantics: EvaluateBody</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-evaluation">14.2.17</a></span>
Runtime Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions">14.3</a></span> Method Definitions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-early-errors">14.3.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains">14.3.2</a></span>
Static Semantics: ComputedPropertyContains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-expectedargumentcount">14.3.3</a></span>
Static Semantics: ExpectedArgumentCount</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-hascomputedpropertykey">14.3.4</a></span>
Static Semantics: HasComputedPropertyKey</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-propname">14.3.5</a></span> Static
Semantics: <i>PropName</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-referencessuper">14.3.6</a></span> Static
Semantics: <i>ReferencesSuper</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-specialmethod">14.3.7</a></span> Static Semantics:
<i>SpecialMethod</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-definemethod">14.3.8</a></span> Runtime Semantics:
DefineMethod</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-runtime-semantics-propertydefinitionevaluation">14.3.9</a></span> Runtime Semantics:
PropertyDefinitionEvaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions">14.4</a></span> Generator Function Definitions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-early-errors">14.4.1</a></span>
Static Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a></span>
Static Semantics: BoundNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a></span> Static
Semantics: ComputedPropertyContains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-contains">14.4.4</a></span>
Static Semantics: Contains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey">14.4.5</a></span> Static
Semantics: HasComputedPropertyKey</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hasname">14.4.6</a></span>
Static Semantics: HasName</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isconstantdeclaration">14.4.7</a></span> Static
Semantics: IsConstantDeclaration</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a></span> Static
Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-lexicallydeclarednames">14.4.9</a></span> Static
Semantics: LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-propname">14.4.10</a></span>
Static Semantics: <i>PropName</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-referencessuper">14.4.11</a></span> Static Semantics:
<i>ReferencesSuper</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a></span> Static Semantics:
VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluatebody">14.4.13</a></span> Runtime Semantics:
EvaluateBody</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject">14.4.14</a></span> Runtime
Semantics: InstantiateFunctionObject</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation">14.4.15</a></span>
Runtime Semantics: PropertyDefinitionEvaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluation">14.4.16</a></span>
Runtime Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions">14.5</a></span> Class Definitions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-early-errors">14.5.1</a></span> Static
Semantics: Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a></span> Static
Semantics: BoundNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-constructormethod">14.5.3</a></span> Static Semantics:
ConstructorMethod</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains">14.5.4</a></span> Static
Semantics: Contains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a></span>
Static Semantics: ComputedPropertyContains</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-hasname">14.5.6</a></span> Static Semantics:
HasName</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isconstantdeclaration">14.5.7</a></span>
Static Semantics: IsConstantDeclaration</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a></span>
Static Semantics: IsFunctionDefinition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-isstatic">14.5.9</a></span> Static Semantics: IsStatic</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a></span>
Static Semantics: LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-prototypemethoddefinitions">14.5.11</a></span> Static
Semantics: PrototypeMethodDefinitions</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-prototypepropertynamelist">14.5.12</a></span> Static
Semantics: PrototypePropertyNameList</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-propname">14.5.13</a></span> Static
Semantics: <i>PropName</i></li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-staticpropertynamelist">14.5.14</a></span> Static Semantics:
StaticPropertyNameList</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-staticmethoddefinitions">14.5.15</a></span> Static Semantics:
StaticMethodDefinitions</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a></span> Static
Semantics: VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-classdefinitionevaluation">14.5.17</a></span> Runtime
Semantics: ClassDefinitionEvaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-runtime-semantics-evaluation">14.5.18</a></span> Runtime
Semantics: Evaluation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tail-position-calls">14.6</a></span> Tail Position Calls
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a></span> Static Semantics: InTailPosition(nonterminal)
Abstract Operation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-hasproductionintailposition">14.6.2</a></span> Static
Semantics: HasProductionInTailPosition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-preparefortailcall">14.6.3</a></span> Runtime Semantics:
PrepareForTailCall</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-scripts-and-modules">15</a></span> ECMAScript Language: Scripts and
Modules
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts">15.1</a></span> Scripts
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-early-errors">15.1.1</a></span> Static Semantics:
Early Errors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-isstrict">15.1.2</a></span> Static Semantics:
IsStrict</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a></span> Static
Semantics: LexicallyDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-lexicallyscopeddeclarations">15.1.4</a></span> Static
Semantics: LexicallyScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a></span> Static Semantics:
VarDeclaredNames</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-varscopeddeclarations">15.1.6</a></span> Static
Semantics: VarScopedDeclarations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-script-evaluation">15.1.7</a></span> Runtime Semantics:
Script Evaluation</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-globaldeclarationinstantiation">15.1.8</a></span> Runtime
Semantics: GlobalDeclarationInstantiation</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-modules">15.2</a></span> Modules
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics">15.2.0</a></span> Module Static Semantics</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports">15.2.1</a></span> Imports</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports">15.2.2</a></span> Exports</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-loader-state">15.2.3</a></span> Runtime Semantics: Loader
State</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-loading">15.2.4</a></span> Runtime Semantics: Module
Loading</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-linking">15.2.5</a></span> Runtime Semantics: Module
Linking</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-evaluation">15.2.6</a></span> Runtime Semantics:
Module Evaluation</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-handling-and-language-extensions">16</a></span> Error Handling and Language
Extensions</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects">17</a></span> ECMAScript Standard Built-in
Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-object">18</a></span> The Global Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-global-object">18.1</a></span> Value Properties of the
Global Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-global-object-infinity">18.1.1</a></span> Infinity</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-global-object-nan">18.1.2</a></span> NaN</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-undefined">18.1.3</a></span> undefined</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-properties-of-the-global-object">18.2</a></span> Function Properties of
the Global Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-eval-x">18.2.1</a></span> eval (x)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isfinite-number">18.2.2</a></span> isFinite (number)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isnan-number">18.2.3</a></span> isNaN (number)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-parsefloat-string">18.2.4</a></span> parseFloat (string)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-parseint-string-radix">18.2.5</a></span> parseInt (string , radix)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uri-handling-function">18.2.6</a></span> URI Handling Function</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object">18.3</a></span> Constructor Properties
of the Global Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-array">18.3.1</a></span> Array ( .
. . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-arraybuffer">18.3.2</a></span>
ArrayBuffer ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-boolean">18.3.3</a></span> Boolean
( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-dataview">18.3.4</a></span>
DataView ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-date">18.3.5</a></span> Date ( . .
. )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-error">18.3.6</a></span> Error ( .
. . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-evalerror">18.3.7</a></span>
EvalError ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-float32array">18.3.8</a></span> Float32Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-float64array">18.3.9</a></span> Float64Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-function">18.3.10</a></span>
Function ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int8array">18.3.11</a></span> Int8Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int16array">18.3.12</a></span> Int16Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int32array">18.3.13</a></span> Int32Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map">18.3.14</a></span> Map ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-number">18.3.15</a></span> Number (
. . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-object">18.3.16</a></span> Object (
. . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-rangeerror">18.3.17</a></span>
RangeError ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-referenceerror">18.3.18</a></span>
ReferenceError ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-regexp">18.3.19</a></span> RegExp (
. . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set">18.3.20</a></span> Set ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-string">18.3.21</a></span> String (
. . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-symbol">18.3.22</a></span> Symbol (
. . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-syntaxerror">18.3.23</a></span>
SyntaxError ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-typeerror">18.3.24</a></span>
TypeError ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint8array">18.3.25</a></span> Uint8Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint8clampedarray">18.3.26</a></span> Uint8ClampedArray ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint16array">18.3.27</a></span> Uint16Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint32array">18.3.28</a></span> Uint32Array ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">18.3.29</a></span>
URIError ( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-weakmap">18.3.30</a></span> WeakMap
( . . . )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-weakset">18.3.31</a></span> WeakSet
( . . . )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-properties-of-the-global-object">18.4</a></span> Other Properties of the
Global Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json">18.4.1</a></span> JSON</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math">18.4.2</a></span> Math</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-properties-of-the-global-object-proxy">18.4.3</a></span> Proxy ( . . .
)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect">18.4.4</a></span> Reflect</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-system">18.4.5</a></span> System</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-fundamental-objects">19</a></span> Fundamental Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-objects">19.1</a></span> Object Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-constructor">19.1.1</a></span> The Object Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-constructor">19.1.2</a></span> Properties of the
Object Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a></span> Properties of the
Object Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-object-instances">19.1.4</a></span> Properties of Object
Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-objects">19.2</a></span> Function Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-constructor">19.2.1</a></span> The Function Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-constructor">19.2.2</a></span> Properties of the
Function Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a></span> Properties of
the Function Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-instances">19.2.4</a></span> Function Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-objects">19.3</a></span> Boolean Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-constructor">19.3.1</a></span> The Boolean Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-boolean-constructor">19.3.2</a></span> Properties of the
Boolean Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-boolean-prototype-object">19.3.3</a></span> Properties of the
Boolean Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-boolean-instances">19.3.4</a></span> Properties of Boolean
Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects">19.4</a></span> Symbol Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor">19.4.1</a></span> The Symbol Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-symbol-constructor">19.4.2</a></span> Properties of the
Symbol Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-symbol-prototype-object">19.4.3</a></span> Properties of the
Symbol Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-symbol-instances">19.4.4</a></span> Properties of Symbol
Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-objects">19.5</a></span> Error Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-constructor">19.5.1</a></span> The Error Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-error-constructor">19.5.2</a></span> Properties of the Error
Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-error-prototype-object">19.5.3</a></span> Properties of the
Error Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-error-instances">19.5.4</a></span> Properties of Error
Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard">19.5.5</a></span> Native Error Types
Used in This Standard</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror-object-structure">19.5.6</a></span> <i>NativeError</i> Object
Structure</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-numbers-and-dates">20</a></span> Numbers and Dates
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-objects">20.1</a></span> Number Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-constructor">20.1.1</a></span> The Number Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-number-constructor">20.1.2</a></span> Properties of the
Number Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-number-prototype-object">20.1.3</a></span> Properties of the
Number Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-number-instances">20.1.4</a></span> Properties of Number
Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math-object">20.2</a></span> The Math Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-math-object">20.2.1</a></span> Value Properties of the
Math Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-properties-of-the-math-object">20.2.2</a></span> Function Properties
of the Math Object</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-objects">20.3</a></span> Date Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-overview-of-date-objects-and-definitions-of-abstract-operations">20.3.1</a></span> Overview of Date
Objects and Definitions of Abstract Operations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-constructor">20.3.2</a></span> The Date Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-constructor">20.3.3</a></span> Properties of the Date
Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">20.3.4</a></span> Properties of the
Date Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-date-instances">20.3.5</a></span> Properties of Date
Instances</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-text-processing">21</a></span> Text Processing
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-objects">21.1</a></span> String Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-constructor">21.1.1</a></span> The String Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-string-constructor">21.1.2</a></span> Properties of the
String Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-string-prototype-object">21.1.3</a></span> Properties of the
String Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-string-instances">21.1.4</a></span> Properties of String
Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-iterator-objects">21.1.5</a></span> String Iterator Objects</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-regular-expression-objects">21.2</a></span> RegExp (Regular Expression)
Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a></span> Patterns</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics">21.2.2</a></span> Pattern Semantics</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-constructor">21.2.3</a></span> The RegExp Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-constructor">21.2.4</a></span> Properties of the
RegExp Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-prototype-object">21.2.5</a></span> Properties of the
RegExp Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-regexp-instances">21.2.6</a></span> Properties of RegExp
Instances</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-indexed-collections">22</a></span> Indexed Collections
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-objects">22.1</a></span> Array Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-constructor">22.1.1</a></span> The Array Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-constructor">22.1.2</a></span> Properties of the Array
Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-prototype-object">22.1.3</a></span> Properties of the
Array Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-array-instances">22.1.4</a></span> Properties of Array
Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-iterator-objects">22.1.5</a></span> Array Iterator Objects</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-objects">22.2</a></span> <i>TypedArray</i> Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-intrinsic-object">22.2.1</a></span> The %TypedArray% Intrinsic
Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarray%-intrinsic-object">22.2.2</a></span> Properties
of the %TypedArray% Intrinsic Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarrayprototype%-object">22.2.3</a></span> Properties of
the %TypedArrayPrototype% Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a></span> The <i>TypedArray</i>
Constructors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-typedarray-constructors">22.2.5</a></span> Properties of the
<i>TypedArray</i> Constructors</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-typedarray-prototype-objects">22.2.6</a></span> Properties of
<i>TypedArray</i> Prototype Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-typedarray-instances">22.2.7</a></span> Properties of
<i>TypedArray</i> Instances</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keyed-collection">23</a></span> Keyed Collection
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects">23.1</a></span> Map Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-constructor">23.1.1</a></span> The Map Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-constructor">23.1.2</a></span> Properties of the Map
Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object">23.1.3</a></span> Properties of the Map
Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-map-instances">23.1.4</a></span> Properties of Map Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-iterator-objects">23.1.5</a></span> Map Iterator Objects</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-objects">23.2</a></span> Set Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-constructor">23.2.1</a></span> The Set Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-set-constructor">23.2.2</a></span> Properties of the Set
Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-set-prototype-object">23.2.3</a></span> Properties of the Set
Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-set-instances">23.2.4</a></span> Properties of Set Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-iterator-objects">23.2.5</a></span> Set Iterator Objects</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-objects">23.3</a></span> WeakMap Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-constructor">23.3.1</a></span> The WeakMap Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakmap-constructor">23.3.2</a></span> Properties of the
WeakMap Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakmap-prototype-object">23.3.3</a></span> Properties of the
WeakMap Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-weakmap-instances">23.3.4</a></span> Properties of WeakMap
Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-objects">23.4</a></span> WeakSet Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-constructor">23.4.1</a></span> The WeakSet Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakset-constructor">23.4.2</a></span> Properties of the
WeakSet Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakset-prototype-object">23.4.3</a></span> Properties of the
WeakSet Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-weakset-instances">23.4.4</a></span> Properties of WeakSet
Instances</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-structured-data">24</a></span> Structured Data
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-objects">24.1</a></span> ArrayBuffer Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-arraybuffer-objects">24.1.1</a></span> Abstract
Operations For ArrayBuffer Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-constructor">24.1.2</a></span> The ArrayBuffer Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-constructor">24.1.3</a></span> Properties of the
ArrayBuffer Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-prototype-object">24.1.4</a></span> Properties of
the ArrayBuffer Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-instances">24.1.5</a></span> Properties of the
ArrayBuffer Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-objects">24.2</a></span> DataView Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-dataview-objects">24.2.1</a></span> Abstract Operations
For DataView Objects</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-constructor">24.2.2</a></span> The DataView Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-dataview-constructor">24.2.3</a></span> Properties of the
DataView Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-dataview-prototype-object">24.2.4</a></span> Properties of
the DataView Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-dataview-instances">24.2.5</a></span> Properties of DataView
Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json-object">24.3</a></span> The JSON Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.parse">24.3.1</a></span> JSON.parse ( text [ , reviver ] )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.stringify">24.3.2</a></span> JSON.stringify ( value [ , replacer [ , space
] ] )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json-@@tostringtag">24.3.3</a></span> JSON [ @@toStringTag ]</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-control-abstraction-objects">25</a></span> Control Abstraction Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-common-iteration-interfaces">25.1</a></span> Common Iteration Interfaces
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterable-interface">25.1.1</a></span> The <i>Iterable</i> Interface</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface">25.1.2</a></span> The <i>Iterator</i> Interface</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorresult-interface">25.1.3</a></span> The <i>IteratorResult</i>
Interface</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-objects">25.2</a></span> GeneratorFunction Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-constructor">25.2.1</a></span> The GeneratorFunction
Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-generatorfunction-constructor">25.2.2</a></span> Properties
of the GeneratorFunction Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-generatorfunction-prototype-object">25.2.3</a></span>
Properties of the GeneratorFunction Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-instances">25.2.4</a></span> GeneratorFunction Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-objects">25.3</a></span> Generator Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-generator-prototype">25.3.1</a></span> Properties of Generator
Prototype</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-generator-instances">25.3.2</a></span> Properties of Generator
Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-abstract-operations">25.3.3</a></span> Generator Abstract
Operations</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects">25.4</a></span> Promise Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-abstract-operations">25.4.1</a></span> Promise Abstract Operations</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-tasks">25.4.2</a></span> Promise Tasks</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor">25.4.3</a></span> The Promise Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-promise-constructor">25.4.4</a></span> Properties of the
Promise Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-promise-prototype-object">25.4.5</a></span> Properties of the
Promise Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-promise-instances">25.4.6</a></span> Properties of Promise
Instances</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflection">26</a></span> Reflection
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect-object">26.1</a></span> The Reflect Object
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.defineproperty">26.1.1</a></span> Reflect.defineProperty ( target,
propertyKey, attributes )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.deleteproperty">26.1.2</a></span> Reflect.deleteProperty ( target,
propertyKey )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.enumerate">26.1.3</a></span> Reflect.enumerate ( target )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.get">26.1.4</a></span> Reflect.get ( target, propertyKey [ , receiver
])</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.getownpropertydescriptor">26.1.5</a></span>
Reflect.getOwnPropertyDescriptor ( target, propertyKey )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.getprototypeof">26.1.6</a></span> Reflect.getPrototypeOf ( target
)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.has">26.1.7</a></span> Reflect.has ( target, propertyKey )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.hasown">26.1.8</a></span> Reflect.hasOwn (target, propertyKey )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.isextensible">26.1.9</a></span> Reflect.isExtensible (target)</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.ownkeys">26.1.10</a></span> Reflect.ownKeys ( target )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.preventextensions">26.1.11</a></span> Reflect.preventExtensions (
target )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.set">26.1.12</a></span> Reflect.set ( target, propertyKey, V [ ,
receiver ] )</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.setprototypeof">26.1.13</a></span> Reflect.setPrototypeOf ( target,
proto )</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-realm-objects">26.2</a></span> Realm Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm-constructor">26.2.1</a></span> The Reflect.Realm Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.realm-constructor">26.2.2</a></span> Properties of
the Reflect.Realm Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.realm-prototype-object">26.2.3</a></span> Properties
of the Reflect.Realm Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-reflect.realm-instances">26.2.4</a></span> Properties of
Reflect.Realm Instances</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-objects">26.3</a></span> Loader Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader-reflect.-constructor">26.3.1</a></span> The Reflect.Loader
Reflect. Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-loader-constructor">26.3.2</a></span> Properties of the
Loader Constructor</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.loader-prototype-object">26.3.3</a></span> Properties
of the Reflect.Loader Prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-reflect.loader-instances">26.3.4</a></span> Properties of
Reflect.Loader Instances</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-iterator-objects">26.3.5</a></span> Loader Iterator Objects</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-system-object">26.4</a></span> The System Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-objects">26.5</a></span> Proxy Objects
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-constructor-function">26.5.1</a></span> The Proxy Constructor
Function</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-proxy-constructor-function">26.5.2</a></span> Properties of
the Proxy Constructor Function</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grammar-summary">Annex&nbsp;A</a></span> <span class="section-status">(informative)</span> Grammar Summary
<ol class="toc">
<li>Lexical Grammar</li>
<li>Number Conversions</li>
<li>Expressions</li>
<li>Statements</li>
<li>Functions and Scripts</li>
<li>Universal Resource Identifier Character Classes</li>
<li>Regular Expressions</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-ecmascript-features-for-web-browsers">Annex&nbsp;B</a></span> <span class="section-status">(normative)</span> Additional ECMAScript Features for Web Browsers
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax">B.1</a></span> Additional Syntax
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-numeric-literals">B.1.1</a></span> Numeric Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-string-literals">B.1.2</a></span> String Literals</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-html-like-comments">B.1.3</a></span> HTML-like Comments</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regular-expressions-patterns">B.1.4</a></span> Regular Expressions
Patterns</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-built-in-properties">B.2</a></span> Additional Built-in Properties
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-global-object">B.2.1</a></span> Additional
Properties of the Global Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-object.prototype-object">B.2.2</a></span>
Additional Properties of the Object.prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-string.prototype-object">B.2.3</a></span>
Additional Properties of the String.prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-date.prototype-object">B.2.4</a></span> Additional
Properties of the Date.prototype Object</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-regexp.prototype-object">B.2.5</a></span>
Additional Properties of the RegExp.prototype Object</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-additional-features">B.3</a></span> Other Additional Features
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-__proto___-property-names-in-object-initializers">B.3.1</a></span> __proto___
Property Names in Object Initializers</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-web-legacy-compatibility-for-block-level-function-declarations">B.3.2</a></span> Web Legacy
Compatibility for Block-Level Function Declarations</li>
</ol>
</li>
</ol>
</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-of-ecmascript">Annex&nbsp;C</a></span> <span class="section-status">(informative)</span> The Strict Mode of ECMAScript</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additions-and-changes-that-introduce-incompatibilities-with-prior-editions">Annex&nbsp;D</a></span> <span class="section-status">(informative)</span> Additions and Changes that Introduce Incompatibilities with Prior Editions
<ol class="toc">
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-in-the-6th-edition">D.1</a></span> In the 6<sup>th</sup> Edition</li>
<li><span class="secnum"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-in-the-5th-edition">D.2</a></span> In the 5<sup>th</sup> Edition</li>
</ol>
</li>
<li>Bibliography</li>
</ol>
</section>
<section>
<h1>Introduction</h1>
<p>This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript
(Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0
browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet
Explorer 3.0.</p>
<p>The development of this Standard started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma
General Assembly of June 1997.</p>
<p>That Ecma Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved as international
standard ISO/IEC 16262, in April 1998. The Ecma General Assembly of June 1998 approved the second edition of ECMA-262 to keep it
fully aligned with ISO/IEC 16262. Changes between the first and the second edition are editorial in nature.</p>
<p>The third edition of the Standard introduced powerful regular expressions, better string handling, new control statements,
try/catch exception handling, tighter definition of errors, formatting for numeric output and minor changes in anticipation of
forthcoming internationalisation facilities and future language growth. The third edition of the ECMAScript standard was adopted
by the Ecma General Assembly of December 1999 and published as ISO/IEC 16262:2002 in June 2002.</p>
<p>Since publication of the third edition, ECMAScript has achieved massive adoption in conjunction with the World Wide Web where
it has become the programming language that is supported by essentially all web browsers. Significant work was done to develop a
fourth edition of ECMAScript. Although that work was not completed and not published as the fourth edition of ECMAScript, it
informs continuing evolution of the language. The fifth edition of ECMAScript (published as ECMA-262 5<sup>th</sup> edition)
codifies de facto interpretations of the language specification that have become common among browser implementations and adds
support for new features that have emerged since the publication of the third edition. Such features include accessor
properties, reflective creation and inspection of objects, program control of property attributes, additional array manipulation
functions, support for the JSON object encoding format, and a strict mode that provides enhanced error checking and program
security.</p>
<p>The edition 5.1 of the ECMAScript Standard has been fully aligned with the third edition of the international standard
ISO/IEC 16262:2011.</p>
<p>This present sixth edition of the Standard………</p>
<p>ECMAScript is a vibrant language and the evolution of the language is not complete. Significant technical enhancement will
continue with future editions of this specification.</p>
<p>This Ecma Standard has been adopted by the General Assembly of &lt;month&gt; &lt;year&gt;.</p>
<p><i>"DISCLAIMER</i></p>
<p><i>This draft document may be copied and furnished to others, and derivative works that comment on or otherwise explain it or
assist in its implementation may be prepared, copied, published, and distributed, in whole or in part, without restriction of
any kind, provided that the above copyright notice and this section are included on all such copies and derivative works.
However, this document itself may not be modified in any way, including by removing the copyright notice or references to Ecma
International, except as needed for the purpose of developing any document or deliverable produced by Ecma
International.</i></p>
<p><i>This disclaimer is valid only prior to final version of this document. After approval all rights on the standard are
reserved by Ecma International.</i></p>
<p><i>The limited permissions are granted through the standardization phase and will not be revoked by Ecma International or its
successors or assigns during this time.</i></p>
<p><i>This document and the information contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL DISCLAIMS ALL
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."</i></p>
</section>
<div class="inner-title">ECMAScript Language Specification</div>
<section id="sec-scope">
<h1><span class="secnum" id="sec-1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scope" title="link to this section">1</a></span> Scope</h1>
<p>This Standard defines the ECMAScript scripting language.</p>
</section>
<section id="sec-conformance">
<h1><span class="secnum" id="sec-2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conformance" title="link to this section">2</a></span> Conformance</h1>
<p>A conforming implementation of ECMAScript must provide and support all the types, values, objects, properties, functions, and
program syntax and semantics described in this specification.</p>
<p>A conforming implementation of ECMAScript must interpret characters in conformance with the Unicode Standard, Version 5.1.0
or later and ISO/IEC 10646. If the adopted ISO/IEC 10646-1 subset is not otherwise specified, it is presumed to be the Unicode
set, collection 10646.</p>
<p>A conforming implementation of ECMAScript that provides an application programming interface that supports programs that need
to adapt to the linguistic and cultural conventions used by different human languages and countries must implement the interface
defined by the most recent edition of ECMA-402 that is compatible with this specification.</p>
<p>A conforming implementation of ECMAScript may provide additional types, values, objects, properties, and functions beyond
those described in this specification. In particular, a conforming implementation of ECMAScript may provide properties not
described in this specification, and values for those properties, for objects that are described in this specification.</p>
<p>A conforming implementation of ECMAScript may support program and regular expression syntax not described in this
specification. In particular, a conforming implementation of ECMAScript may support program syntax that makes use of the
“future reserved words” listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words">subclause 11.6.2.2</a> of this
specification.</p>
</section>
<section id="sec-normative-references">
<h1><span class="secnum" id="sec-3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normative-references" title="link to this section">3</a></span> Normative
references</h1>
<p>The following referenced documents are indispensable for the application of this document. For dated references, only the
edition cited applies. For undated references, the latest edition of the referenced document (including any amendments)
applies.</p>
<p class="formal-reference">ISO/IEC 10646:2003: <i>Information Technology – Universal Multiple-Octet Coded Character Set
(UCS) plus Amendment 1:2005, Amendment 2:2006, Amendment 3:2008, and Amendment 4:2008</i>, plus additional amendments and
corrigenda, or successor</p>
<p class="formal-reference"><i>The Unicode Standard, Version 5.0</i>, as amended by Unicode 5.1.0, or successor</p>
<p class="formal-reference"><i>Unicode Standard Annex #15, Unicode Normalization Forms, version Unicode 5.1.0</i>, or
successor</p>
<p class="formal-reference"><i>Unicode Standard Annex #31, Unicode Identifiers and Pattern Syntax, version Unicode 5.1.0</i>, or
successor.</p>
<p>ECMA-402, <i>ECMAScript Internationalization API Specification</i>.<br><a href="http://www.ecma-international.org/publications/standards/Ecma-402.htm">http://www.ecma-international.org/publications/standards/Ecma-402.htm</a></p>
<p>ECMA-404, <i>The JSON Data Interchange Format</i>.<br><a href="http://www.ecma-international.org/publications/standards/Ecma-404.htm">http://www.ecma-international.org/publications/standards/Ecma-404.htm</a></p>
</section>
<section id="sec-overview">
<div class="front">
<h1><span class="secnum" id="sec-4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-overview" title="link to this section">4</a></span> Overview</h1>
<p>This section contains a non-normative overview of the ECMAScript language.</p>
<p>ECMAScript is an object-oriented programming language for performing computations and manipulating computational objects
within a host environment. ECMAScript as defined here is not intended to be computationally self-sufficient; indeed, there are
no provisions in this specification for input of external data or output of computed results. Instead, it is expected that the
computational environment of an ECMAScript program will provide not only the objects and other facilities described in this
specification but also certain environment-specific objects, whose description and behaviour are beyond the scope of this
specification except to indicate that they may provide certain properties that can be accessed and certain functions that can
be called from an ECMAScript program.</p>
<p>A <b><i>scripting language</i></b> is a programming language that is used to manipulate, customize, and automate the
facilities of an existing system. In such systems, useful functionality is already available through a user interface, and the
scripting language is a mechanism for exposing that functionality to program control. In this way, the existing system is said
to provide a host environment of objects and facilities, which completes the capabilities of the scripting language. A
scripting language is intended for use by both professional and non-professional programmers. ECMAScript was originally
designed to be used as a scripting language, but has become widely used as a general purpose programming language.</p>
<p>ECMAScript was originally designed to be a <b><i>Web scripting language</i></b>, providing a mechanism to enliven Web pages
in browsers and to perform server computation as part of a Web-based client-server architecture. ECMAScript is now used both
as a general propose programming language and to provide core scripting capabilities for a variety of host environments.
Therefore the core language is specified in this document apart from any particular host environment.</p>
<p>Some of the facilities of ECMAScript are similar to those used in other programming languages; in particular C,
Java™, Self, and Scheme as described in:</p>
<p>ISO/IEC&nbsp;9899:1996, Programming Languages – C.</p>
<p class="formal-reference">Gosling, James, Bill Joy and Guy Steele. <span class="book-title">The Java™ Language
Specification</span>. Addison Wesley Publishing Co., 1996.</p>
<p class="formal-reference">Ungar, David, and Smith, Randall B. <span class="book-title">Self: The Power of Simplicity</span>.
OOPSLA '87 Conference Proceedings, pp. 227–241, Orlando, FL, October 1987.</p>
<p class="formal-reference"><span class="book-title">IEEE Standard for the Scheme Programming Language</span>. IEEE Std
1178-1990.</p>
</div>
<section id="sec-web-scripting">
<h1><span class="secnum" id="sec-4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-web-scripting" title="link to this section">4.1</a></span> Web
Scripting</h1>
<p>A web browser provides an ECMAScript host environment for client-side computation including, for instance, objects that
represent windows, menus, pop-ups, dialog boxes, text areas, anchors, frames, history, cookies, and input/output. Further, the
host environment provides a means to attach scripting code to events such as change of focus, page and image loading,
unloading, error and abort, selection, form submission, and mouse actions. Scripting code appears within the HTML and the
displayed page is a combination of user interface elements and fixed and computed text and images. The scripting code is
reactive to user interaction and there is no need for a main program.</p>
<p>A web server provides a different host environment for server-side computation including objects representing requests,
clients, and files; and mechanisms to lock and share data. By using browser-side and server-side scripting together, it is
possible to distribute computation between the client and server while providing a customized user interface for a Web-based
application.</p>
<p>Each Web browser and server that supports ECMAScript supplies its own host environment, completing the ECMAScript execution
environment.</p>
</section>
<section id="sec-ecmascript-overview">
<div class="front">
<h1><span class="secnum" id="sec-4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-overview" title="link to this section">4.2</a></span>
ECMAScript Overview</h1>
<p>The following is an informal overview of ECMAScript—not all parts of the language are described. This overview is
not part of the standard proper.</p>
<p>ECMAScript is object-based: basic language and host facilities are provided by objects, and an ECMAScript program is a
cluster of communicating objects. In ECMAScript, an <b><i>object</i></b> is a collection of <b><i>properties</i></b> each
with zero or more <b><i>attributes</i></b> that determine how each property can be used—for example, when the Writable
attribute for a property is set to <b>false</b>, any attempt by executed ECMAScript code to change the value of the property
fails. Properties are containers that hold other objects, <b><i>primitive values</i></b>, or <b><i>functions</i></b>. A
primitive value is a member of one of the following built-in types: <b>Undefined</b>, <b>Null</b>, <b>Boolean</b>,
<b>Number</b>, <b>Symbol</b> and <b>String</b>; an object is a member of the remaining built-in type <b>Object</b>; and a
function is a callable object. A function that is associated with an object via a property is a <b><i>method</i></b>.</p>
<p>ECMAScript defines a collection of <b><i>built-in objects</i></b> that round out the definition of ECMAScript entities.
These built-in objects include the global object, the <b>Object</b> object, the <b>Function</b> object, the <b>Array</b>
object, the <b>String</b> object, the <b>Boolean</b> object, the <b>Number</b> object, the <b>Math</b> object, the
<b>Date</b> object, the <b>RegExp</b> object, the <b>JSON</b> object, and the Error objects <b>Error, EvalError</b>,
<b>RangeError, ReferenceError, SyntaxError, TypeError</b> and <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b>.</p>
<p>ECMAScript also defines a set of built-in <b><i>operators</i></b>. ECMAScript operators include various unary operations,
multiplicative operators, additive operators, bitwise shift operators, relational operators, equality operators, binary
bitwise operators, binary logical operators, assignment operators, and the comma operator.</p>
<p>ECMAScript syntax intentionally resembles Java syntax. ECMAScript syntax is relaxed to enable it to serve as an
easy-to-use scripting language. For example, a variable is not required to have its type declared nor are types associated
with properties, and defined functions are not required to have their declarations appear textually before calls to
them.</p>
</div>
<section id="sec-objects">
<h1><span class="secnum" id="sec-4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objects" title="link to this section">4.2.1</a></span> Objects</h1>
<p>ECMAScript objects are not fundamentally class-based such as those in C++, Smalltalk, or Java. Instead objects may be
created in various ways including via a literal notation or via <b><i>constructors</i></b> which create objects and then
execute code that initializes all or part of them by assigning initial values to their properties. Each constructor is a
function that has a property named “<code>prototype</code>” that is used to implement <b><i>prototype-based
inheritance</i></b> and <b><i>shared properties</i></b>. Objects are created by using constructors in <b>new</b>
expressions; for example, <code>new Date(2009,11)</code> creates a new Date object. Invoking a constructor without using
<b>new</b> has consequences that depend on the constructor. For example, <code>Date()</code> produces a string
representation of the current date and time rather than an object.</p>
<p>Every object created by a constructor has an implicit reference (called the object’s <i>prototype</i>) to the value
of its constructor’s “<code>prototype</code>” property. Furthermore, a prototype may have a non-null
implicit reference to its prototype, and so on; this is called the <i>prototype chain</i>. When a reference is made to a
property in an object, that reference is to the property of that name in the first object in the prototype chain that
contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if
that object contains the named property, that is the property to which the reference refers; if that object does not contain
the named property, the prototype for that object is examined next; and so on.</p>
<figure>
<object data="https://people.mozilla.org/~jorendorff/figure-1.svg" height="354" type="image/svg+xml" width="719">
<img alt="An image of lots of boxes and arrows." height="354" src="./ECMAScript Language Specification ECMA-262 6th Edition – DRAFT_files/figure-1.png" width="719">
</object>
<figcaption>Figure 1 — Object/Prototype Relationships</figcaption>
</figure>
<p>In a class-based object-oriented language, in general, state is carried by instances, methods are carried by classes, and
inheritance is only of structure and behaviour. In ECMAScript, the state and methods are carried by objects, while
structure, behaviour, and state are all inherited.</p>
<p>All objects that do not directly contain a particular property that their prototype contains share that property and its
value. Figure 1 illustrates this:</p>
<p><b>CF</b> is a constructor (and also an object). Five objects have been created by using <code>new</code> expressions:
<b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>, <b>cf<sub>4</sub></b>, and <b>cf<sub>5</sub></b>. Each
of these objects contains properties named <span style="font-family: monospace">q1</span> and <span style="font-family:
monospace">q2</span>. The dashed lines represent the implicit prototype relationship; so, for example,
<b>cf<sub>3</sub></b>’s prototype is <b>CF<sub>p</sub></b>. The constructor, <b>CF</b>, has two properties itself,
named <span style="font-family: monospace">P1</span> and <span style="font-family: monospace">P2</span>, which are not
visible to <b>CF<sub>p</sub></b>, <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>,
<b>cf<sub>4</sub></b>, or <b>cf<sub>5</sub></b>. The property named <span style="font-family: monospace">CFP1</span> in
<b>CF<sub>p</sub></b> is shared by <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>, <b>cf<sub>3</sub></b>,
<b>cf<sub>4</sub></b>, and <b>cf<sub>5</sub></b> (but not by <b>CF</b>), as are any properties found in
<b>CF<sub>p</sub></b>’s implicit prototype chain that are not named <span style="font-family: monospace">q1</span>,
<span style="font-family: monospace">q2</span>, or <span style="font-family: monospace">CFP1</span>. Notice that there is no
implicit prototype link between <b>CF</b> and <b>CF<sub>p</sub></b>.</p>
<p>Unlike most class-based object languages, properties can be added to objects dynamically by assigning values to them.
That is, constructors are not required to name or assign values to all or any of the constructed object’s properties.
In the above diagram, one could add a new shared property for <b>cf<sub>1</sub></b>, <b>cf<sub>2</sub></b>,
<b>cf<sub>3</sub></b>, <b>cf<sub>4</sub></b>, and <b>cf<sub>5</sub></b> by assigning a new value to the property in
<b>CF<sub>p</sub></b>.</p>
<p>Although ECMAScript objects are not inherently class-based, it is often convenient to define class-like abstractions
based upon a common pattern of constructor functions, prototype objects, and methods. The ECMAScript built-in object
themselves follow such a class-like pattern. The ECMAScript language includes syntatic class definitions that permit
programmers to concisely define objects that conform to the same class-like abstraction pattern used by the built-in
objects.</p>
</section>
<section id="sec-strict-variant-of-ecmascript">
<h1><span class="secnum" id="sec-4.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-variant-of-ecmascript" title="link to this section">4.2.2</a></span> The Strict Variant of ECMAScript</h1>
<p>The ECMAScript Language recognizes the possibility that some users of the language may wish to restrict their usage of
some features available in the language. They might do so in the interests of security, to avoid what they consider to be
error-prone features, to get enhanced error checking, or for other reasons of their choosing. In support of this
possibility, ECMAScript defines a strict variant of the language. The strict variant of the language excludes some specific
syntactic and semantic features of the regular ECMAScript language and modifies the detailed semantics of some features. The
strict variant also specifies additional error conditions that must be reported by throwing error exceptions in situations
that are not specified as errors by the non-strict form of the language.</p>
<p>The strict variant of ECMAScript is commonly referred to as the <i>strict mode</i> of the language. Strict mode selection
and use of the strict mode syntax and semantics of ECMAScript is explicitly made at the level of individual ECMAScript code
units. Because strict mode is selected at the level of a syntactic code unit, strict mode only imposes restrictions that
have local effect within such a code unit. Strict mode does not restrict or modify any aspect of the ECMAScript semantics
that must operate consistently across multiple code units. A complete ECMAScript program may be composed for both strict
mode and non-strict mode ECMAScript code units. In this case, strict mode only applies when actually executing code that is
defined within a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> unit.</p>
<p>In order to conform to this specification, an ECMAScript implementation must implement both the full unrestricted
ECMAScript language and the strict mode variant of the ECMAScript language as defined by this specification. In addition, an
implementation must support the combination of unrestricted and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> units
into a single composite program.</p>
</section>
</section>
<section id="sec-terms-and-definitions">
<div class="front">
<h1><span class="secnum" id="sec-4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions" title="link to this section">4.3</a></span> Terms
and definitions</h1>
<p>For the purposes of this document, the following terms and definitions apply.</p>
</div>
<section id="sec-type">
<h1><span class="secnum" id="sec-4.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-type" title="link to this section">4.3.1</a></span> type</h1>
<p>set of data values as defined in clause 0 of this specification</p>
</section>
<section id="sec-primitive-value">
<h1><span class="secnum" id="sec-4.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primitive-value" title="link to this section">4.3.2</a></span>
primitive value</h1>
<p>member of one of the types Undefined, Null, Boolean, Number, Symbol, or String as defined in clause 0</p>
<div class="note">
<p><span class="nh">NOTE</span> A primitive value is a datum that is represented directly at the lowest level of the
language implementation.</p>
</div>
</section>
<section id="sec-terms-and-definitions-object">
<h1><span class="secnum" id="sec-4.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-object" title="link to this section">4.3.3</a></span> object</h1>
<p>member of the type Object</p>
<div class="note">
<p><span class="nh">NOTE</span> An object is a collection of properties and has a single prototype object. The prototype
may be the null value.</p>
</div>
</section>
<section id="sec-constructor">
<h1><span class="secnum" id="sec-4.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor" title="link to this section">4.3.4</a></span>
constructor</h1>
<p>function object that creates and initializes objects</p>
<div class="note">
<p><span class="nh">NOTE</span> The value of a constructor’s “<span style="font-family:
monospace">prototype</span>” property is a prototype object that is used to implement inheritance and shared
properties.</p>
</div>
</section>
<section id="sec-terms-and-definitions-prototype">
<h1><span class="secnum" id="sec-4.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-prototype" title="link to this section">4.3.5</a></span> prototype</h1>
<p>object that provides shared properties for other objects</p>
<div class="note">
<p><span class="nh">NOTE</span> When a constructor creates an object, that object implicitly references the
constructor’s “<code>prototype</code>” property for the purpose of resolving property references. The
constructor’s “<code>prototype</code>” property can be referenced by the program expression <span style="font-family: monospace"><i>constructor</i><b>.prototype</b></span>, and properties added to an object’s
prototype are shared, through inheritance, by all objects sharing the prototype. Alternatively, a new object may be
created with an explicitly specified prototype by using the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.create">Object.create</a></code>
built-in function.</p>
</div>
</section>
<section id="sec-ordinary-object">
<h1><span class="secnum" id="sec-4.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object" title="link to this section">4.3.6</a></span>
ordinary object</h1>
<p>object that has the default behaviour for the essential internal methods that must be supported by all objects.</p>
</section>
<section id="sec-exotic-object">
<h1><span class="secnum" id="sec-4.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exotic-object" title="link to this section">4.3.7</a></span> exotic
object</h1>
<p>object that has some alternative behaviour for one or more of the essential internal methods that must be supported by
all objects.</p>
<div class="note">
<p><span class="nh">NOTE</span> Any object that is not an ordinary object is an exotic object.</p>
</div>
</section>
<section id="sec-standard-object">
<h1><span class="secnum" id="sec-4.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-standard-object" title="link to this section">4.3.8</a></span>
standard object</h1>
<p>object whose semantics are defined by this specification.</p>
</section>
<section id="sec-built-in-object">
<h1><span class="secnum" id="sec-4.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-object" title="link to this section">4.3.9</a></span>
built-in object</h1>
<p>object supplied by an ECMAScript implementation, independent of the host environment, that is present at the start of the
execution of an ECMAScript program</p>
<div class="note">
<p><span class="nh">NOTE</span> Standard built-in objects are defined in this specification, and an ECMAScript
implementation may specify and define others. A <i>built-in constructor</i> is a built-in object that is also a
constructor.</p>
</div>
</section>
<section id="sec-undefined-value">
<h1><span class="secnum" id="sec-4.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-undefined-value" title="link to this section">4.3.10</a></span>
undefined value</h1>
<p>primitive value used when a variable has not been assigned a value</p>
</section>
<section id="sec-terms-and-definitions-undefined-type">
<h1><span class="secnum" id="sec-4.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-undefined-type" title="link to this section">4.3.11</a></span> Undefined type</h1>
<p>type whose sole value is the <b>undefined</b> value</p>
</section>
<section id="sec-null-value">
<h1><span class="secnum" id="sec-4.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-null-value" title="link to this section">4.3.12</a></span> null
value</h1>
<p>primitive value that represents the intentional absence of any object value</p>
</section>
<section id="sec-terms-and-definitions-null-type">
<h1><span class="secnum" id="sec-4.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-null-type" title="link to this section">4.3.13</a></span> Null type</h1>
<p>type whose sole value is the null value</p>
</section>
<section id="sec-terms-and-definitions-boolean-value">
<h1><span class="secnum" id="sec-4.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-boolean-value" title="link to this section">4.3.14</a></span> Boolean value</h1>
<p>member of the Boolean type</p>
<div class="note">
<p><span class="nh">NOTE</span> There are only two Boolean values, <b>true</b> and <b>false</b>.</p>
</div>
</section>
<section id="sec-terms-and-definitions-boolean-type">
<h1><span class="secnum" id="sec-4.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-boolean-type" title="link to this section">4.3.15</a></span> Boolean type</h1>
<p>type consisting of the primitive values <b>true</b> and <b>false</b></p>
</section>
<section id="sec-boolean-object">
<h1><span class="secnum" id="sec-4.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-object" title="link to this section">4.3.16</a></span>
Boolean object</h1>
<p>member of the Object type that is an instance of the standard built-in <code>Boolean</code> constructor</p>
<div class="note">
<p><span class="nh">NOTE</span> A Boolean object is created by using the <code>Boolean</code> constructor in a
<code>new</code> expression, supplying a Boolean value as an argument. The resulting object has an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is the Boolean value. A Boolean
object can be coerced to a Boolean value.</p>
</div>
</section>
<section id="sec-terms-and-definitions-string-value">
<h1><span class="secnum" id="sec-4.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-string-value" title="link to this section">4.3.17</a></span> String value</h1>
<p>primitive value that is a finite ordered sequence of zero or more 16-bit unsigned integer</p>
<div class="note">
<p><span class="nh">NOTE</span> A String value is a member of the String type. Each integer value in the sequence usually
represents a single 16-bit unit of UTF-16 text. However, ECMAScript does not place any restrictions or requirements on the
values except that they must be 16-bit unsigned integers.</p>
</div>
</section>
<section id="sec-terms-and-definitions-string-type">
<h1><span class="secnum" id="sec-4.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-string-type" title="link to this section">4.3.18</a></span> String type</h1>
<p>set of all possible String values</p>
</section>
<section id="sec-string-object">
<h1><span class="secnum" id="sec-4.3.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-object" title="link to this section">4.3.19</a></span> String
object</h1>
<p>member of the Object type that is an instance of the standard built-in <code>String</code> constructor</p>
<div class="note">
<p><span class="nh">NOTE</span> A String object is created by using the <code>String</code> constructor in a
<code>new</code> expression, supplying a String value as an argument. The resulting object has an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is the String value. A String object
can be coerced to a String value by calling the <code>String</code> constructor as a function (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-constructor-string-value">21.1.1.1</a>).</p>
</div>
</section>
<section id="sec-terms-and-definitions-number-value">
<h1><span class="secnum" id="sec-4.3.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-number-value" title="link to this section">4.3.20</a></span> Number value</h1>
<p>primitive value corresponding to a double-precision 64-bit binary format IEEE 754 value</p>
<div class="note">
<p><span class="nh">NOTE</span> A Number value is a member of the Number type and is a direct representation of a
number.</p>
</div>
</section>
<section id="sec-terms-and-definitions-number-type">
<h1><span class="secnum" id="sec-4.3.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-number-type" title="link to this section">4.3.21</a></span> Number type</h1>
<p>set of all possible Number values including the special “Not-a-Number” (NaN) value, positive infinity, and
negative infinity</p>
</section>
<section id="sec-number-object">
<h1><span class="secnum" id="sec-4.3.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-object" title="link to this section">4.3.22</a></span> Number
object</h1>
<p>member of the Object type that is an instance of the standard built-in <code>Number</code> constructor</p>
<div class="note">
<p><span class="nh">NOTE</span> A Number object is created by using the <code>Number</code> constructor in a
<code>new</code> expression, supplying a Number value as an argument. The resulting object has an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is the Number value. A Number object
can be coerced to a Number value by calling the <code>Number</code> constructor as a function (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-constructor-number-value">20.1.1.1</a>).</p>
</div>
</section>
<section id="sec-terms-and-definitions-infinity">
<h1><span class="secnum" id="sec-4.3.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-infinity" title="link to this section">4.3.23</a></span> Infinity</h1>
<p>number value that is the positive infinite Number value</p>
</section>
<section id="sec-terms-and-definitions-nan">
<h1><span class="secnum" id="sec-4.3.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-nan" title="link to this section">4.3.24</a></span> NaN</h1>
<p>number value that is an IEEE 754 “Not-a-Number” value</p>
</section>
<section id="sec-">
<div class="front">
<h1><span class="secnum" id="sec-4.3.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-" title="link to this section">4.3.25</a></span> </h1>
</div>
<section>
<h1>Symbol value</h1>
<p>primitive value that represents a unique, non-String Object <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>.</p>
</section>
</section>
<section id="sec-terms-and-definitions-symbol-type">
<h1><span class="secnum" id="sec-4.3.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-symbol-type" title="link to this section">4.3.26</a></span> Symbol type</h1>
<p>set of all possible Symbol values</p>
</section>
<section id="sec-symbol-object">
<h1><span class="secnum" id="sec-4.3.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-object" title="link to this section">4.3.27</a></span> Symbol
object</h1>
<p>member of the Object type that is an instance of the standard built-in <code>Symbol</code> constructor</p>
</section>
<section id="sec-terms-and-definitions-function">
<h1><span class="secnum" id="sec-4.3.28"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-terms-and-definitions-function" title="link to this section">4.3.28</a></span> function</h1>
<p>member of the Object type that may be invoked as a subroutine</p>
<div class="note">
<p><span class="nh">NOTE</span> In addition to its properties, a function contains executable code and state that
determine how it behaves when invoked. A function’s code may or may not be written in ECMAScript.</p>
</div>
</section>
<section id="sec-built-in-function">
<h1><span class="secnum" id="sec-4.3.29"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function" title="link to this section">4.3.29</a></span>
built-in function</h1>
<p>built-in object that is a function</p>
<div class="note">
<p><span class="nh">NOTE</span> Examples of built-in functions include <code>parseInt</code> and <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.exp">Math.exp</a></code>. An implementation may provide implementation-dependent built-in functions that
are not described in this specification.</p>
</div>
</section>
<section id="sec-property">
<h1><span class="secnum" id="sec-4.3.30"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property" title="link to this section">4.3.30</a></span>
property</h1>
<p>association between a key and a value that is a part of an object. The key be either a String value or a Symbol
value.</p>
<div class="note">
<p><span class="nh">NOTE</span> Depending upon the form of the property the value may be represented either directly as a
data value (a primitive value, an object, or a function object) or indirectly by a pair of accessor functions.</p>
</div>
</section>
<section id="sec-method">
<h1><span class="secnum" id="sec-4.3.31"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method" title="link to this section">4.3.31</a></span> method</h1>
<p>function that is the value of a property</p>
<div class="note">
<p><span class="nh">NOTE</span> When a function is called as a method of an object, the object is passed to the function
as its <b>this</b> value.</p>
</div>
</section>
<section id="sec-built-in-method">
<h1><span class="secnum" id="sec-4.3.32"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-method" title="link to this section">4.3.32</a></span>
built-in method</h1>
<p>method that is a built-in function</p>
<div class="note">
<p><span class="nh">NOTE</span> Standard built-in methods are defined in this specification, and an ECMAScript
implementation may specify and provide other additional built-in methods.</p>
</div>
</section>
<section id="sec-attribute">
<h1><span class="secnum" id="sec-4.3.33"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-attribute" title="link to this section">4.3.33</a></span>
attribute</h1>
<p>internal value that defines some characteristic of a property</p>
</section>
<section id="sec-own-property">
<h1><span class="secnum" id="sec-4.3.34"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-own-property" title="link to this section">4.3.34</a></span> own
property</h1>
<p>property that is directly contained by its object</p>
</section>
<section id="sec-inherited-property">
<h1><span class="secnum" id="sec-4.3.35"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-inherited-property" title="link to this section">4.3.35</a></span>
inherited property</h1>
<p>property of an object that is not an own property but is a property (either own or inherited) of the object’s
prototype</p>
</section>
</section>
<section id="sec-organization-of-this-specification">
<h1><span class="secnum" id="sec-4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-organization-of-this-specification" title="link to this section">4.4</a></span> Organization of This Specification</h1>
<p>The remainder of this specification is organized as follows:</p>
<p>Clause 0 defines the notational conventions used throughout the specification.</p>
<p>Clauses 0-9 define the execution environment within which ECMAScript programs operate.</p>
<p>Clauses 10-16 define the actual ECMAScript programming language includings its syntactic encoding and the execution
semantics of all language features.</p>
<p>Clauses 17−26 define the ECMAScript standard library. It includes the definitions of all of the standard objects that
are available for use by ECMAScript programs as they execute.</p>
</section>
</section>
<section id="sec-notational-conventions">
<div class="front">
<h1><span class="secnum" id="sec-5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-notational-conventions" title="link to this section">5</a></span> Notational
Conventions</h1>
</div>
<section id="sec-syntactic-and-lexical-grammars">
<div class="front">
<h1><span class="secnum" id="sec-5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-syntactic-and-lexical-grammars" title="link to this section">5.1</a></span> Syntactic and Lexical Grammars</h1>
</div>
<section id="sec-context-free-grammars">
<h1><span class="secnum" id="sec-5.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-context-free-grammars" title="link to this section">5.1.1</a></span>
Context-Free Grammars</h1>
<p>A <i>context-free grammar</i> consists of a number of <i>productions</i>. Each production has an abstract symbol called a
<i>nonterminal</i> as its <i>left-hand side</i>, and a sequence of zero or more nonterminal and <i>terminal</i> symbols as
its <i>right-hand side</i>. For each grammar, the terminal symbols are drawn from a specified alphabet.</p>
<p>A <i>chain production</i> is a production that has exactly one nonterminal symbol on its right-hand side along with zero
or more terminal symbols.</p>
<p>Starting from a sentence consisting of a single distinguished nonterminal, called the <i>goal symbol</i>, a given
context-free grammar specifies a <i>language</i>, namely, the (perhaps infinite) set of possible sequences of terminal
symbols that can result from repeatedly replacing any nonterminal in the sequence with a right-hand side of a production for
which the nonterminal is the left-hand side.</p>
</section>
<section id="sec-lexical-and-regexp-grammars">
<h1><span class="secnum" id="sec-5.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-and-regexp-grammars" title="link to this section">5.1.2</a></span> The Lexical and RegExp Grammars</h1>
<p>A <i>lexical grammar</i> for ECMAScript is given in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-lexical-grammar">clause 11</a>.
This grammar has as its terminal symbols characters (Unicode code points) that conform to the rules for <span class="nt">SourceCharacter</span> defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-source-text">clause 10.1</a>. It defines a set of productions,
starting from the goal symbol <span class="nt">InputElementDiv</span> or <span class="nt">InputElementRegExp</span>, that
describe how sequences of such characters are translated into a sequence of input elements.</p>
<p>Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and
are called ECMAScript <i>tokens</i>. These tokens are the reserved words, identifiers, literals, and punctuators of the
ECMAScript language. Moreover, line terminators, although not considered to be tokens, also become part of the stream of
input elements and guide the process of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">11.9</a>). Simple white space and single-line comments are discarded and do not
appear in the stream of input elements for the syntactic grammar. A <span class="nt">MultiLineComment</span> (that is, a
comment of the form “<span style="font-family: monospace">/*</span>…<span style="font-family:
monospace">*/</span>” regardless of whether it spans more than one line) is likewise simply discarded if it contains
no line terminator; but if a <span class="nt">MultiLineComment</span> contains one or more line terminators, then it is
replaced by a single line terminator, which becomes part of the stream of input elements for the syntactic grammar.</p>
<p>A <i>RegExp grammar</i> for ECMAScript is given in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a>. This grammar also has as its
terminal symbols the characters as defined by <span class="nt">SourceCharacter</span>. It defines a set of productions,
starting from the goal symbol <span class="nt">Pattern</span>, that describe how sequences of characters are translated into
regular expression patterns.</p>
<p>Productions of the lexical and RegExp grammars are distinguished by having two colons “<b>::</b>” as
separating punctuation. The lexical and RegExp grammars share some productions.</p>
</section>
<section id="sec-numeric-string-grammar">
<h1><span class="secnum" id="sec-5.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-numeric-string-grammar" title="link to this section">5.1.3</a></span>
The Numeric String Grammar</h1>
<p>Another grammar is used for translating Strings into numeric values. This grammar is similar to the part of the lexical
grammar having to do with numeric literals and has as its terminal symbols <span class="nt">SourceCharacter</span>. This
grammar appears in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber-applied-to-the-string-type">7.1.3.1</a>.</p>
<p>Productions of the numeric string grammar are distinguished by having three colons “<b>:::</b>” as
punctuation.</p>
</section>
<section id="sec-syntactic-grammar">
<h1><span class="secnum" id="sec-5.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-syntactic-grammar" title="link to this section">5.1.4</a></span> The
Syntactic Grammar</h1>
<p>The <i>syntactic grammar</i> for ECMAScript is given in clauses 11, 12, 13, 14, and 15. This grammar has ECMAScript
tokens defined by the lexical grammar as its terminal symbols (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-and-regexp-grammars">5.1.2</a>). It
defines a set of productions, starting from the goal symbol <span class="nt">Script</span>, that describe how sequences of
tokens can form syntactically correct independent components of an ECMAScript programs.</p>
<p>When a stream of characters is to be parsed as an ECMAScript script, it is first converted to a stream of input elements
by repeated application of the lexical grammar; this stream of input elements is then parsed by a single application of the
syntactic grammar. The script is syntactically in error if the tokens in the stream of input elements cannot be parsed as a
single instance of the goal nonterminal <span class="nt">Script</span>, with no tokens left over.</p>
<p>Productions of the syntactic grammar are distinguished by having just one colon “<b>:</b>” as
punctuation.</p>
<p>The syntactic grammar as presented in clauses 12, 13, 14 and 15 is actually not a complete account of which token
sequences are accepted as correct ECMAScript scripts. Certain additional token sequences are also accepted, namely, those
that would be described by the grammar if only semicolons were added to the sequence in certain places (such as before line
terminator characters). Furthermore, certain token sequences that are described by the grammar are not considered acceptable
if a terminator character appears in certain “awkward” places.</p>
<p>In certain cases in order to avoid ambiguities the syntactic grammar uses generalized productions that permit token
sequences that are not valid ECMAScript scripts. For example, this technique is used in with object literals and object
destructuring patterns. In such cases a more restrictive <i>supplemental grammar</i> is provided that further restricts the
acceptable token sequences. In certain contexts, when explicitly specific, the input elements corresponding to such a
production are parsed again using a goal symbol of a supplemental grammar. The script is syntactically in error if the
tokens in the stream of input elements cannot be parsed as a single instance of the supplemental goal symbol, with no tokens
left over.</p>
</section>
<section id="sec-grammar-notation">
<h1><span class="secnum" id="sec-5.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grammar-notation" title="link to this section">5.1.5</a></span>
Grammar Notation</h1>
<p>Terminal symbols of the lexical, RegExp, and numeric string grammars, and some of the terminal symbols of the other
grammars, are shown in <code>fixed width</code> font, both in the productions of the grammars and throughout this
specification whenever the text directly refers to such a terminal symbol. These are to appear in a script either exactly as
written. All terminal symbol characters specified in this way are to be understood as the appropriate Unicode code points
from the Basic Latin range, as opposed to any similar-looking characters from other Unicode ranges.</p>
<p>Nonterminal symbols are shown in <var>italic</var> type. The definition of a nonterminal (also called a
“production”) is introduced by the name of the nonterminal being defined followed by one or more colons. (The
number of colons indicates to which grammar the production belongs.) One or more alternative right-hand sides for the
nonterminal then follow on succeeding lines. For example, the syntactic definition:</p>
<div class="gp">
<div class="lhs"><span class="nt">WhileStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<p>states that the nonterminal <span class="nt">WhileStatement</span> represents the token <code>while</code>, followed by a
left parenthesis token, followed by an <span class="nt">Expression</span>, followed by a right parenthesis token, followed
by a <span class="nt">Statement</span>. The occurrences of <span class="nt">Expression</span> and <span class="nt">Statement</span> are themselves nonterminals. As another example, the syntactic definition:</p>
<div class="gp">
<div class="lhs"><span class="nt">ArgumentList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">ArgumentList</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
</div>
<p>states that an <span class="nt">ArgumentList</span> may represent either a single <span class="nt">AssignmentExpression</span> or an <span class="nt">ArgumentList</span>, followed by a comma, followed by an <span class="nt">AssignmentExpression</span>. This definition of <span class="nt">ArgumentList</span> is recursive, that is, it is
defined in terms of itself. The result is that an <span class="nt">ArgumentList</span> may contain any positive number of
arguments, separated by commas, where each argument expression is an <span class="nt">AssignmentExpression</span>. Such
recursive definitions of nonterminals are common.</p>
<p>The subscripted suffix “<sub>opt</sub>”, which may appear after a terminal or nonterminal, indicates an
optional symbol. The alternative containing the optional symbol actually specifies two right-hand sides, one that omits the
optional element and one that includes it. This means that:</p>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
</div>
<p>is a convenient abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
</div>
<p>and that:</p>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<p>is a convenient abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<p>which in turn is an abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <code class="t">;</code> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">;</code> <code class="t">;)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<p>so, in this example, the nonterminal <span class="nt">IterationStatement</span> actually has four alternative right-hand
sides.</p>
<p>A production may be parameterized by a subscripted annotation of the form “<sub>[parameters]</sub>”, which
may appear as a suffix to the nonterminal symbol defined by the production. “<sub>parameters</sub>” may be
either a single name or a comma separated list of names. A parameterized production is shorthand for a set of productions
defining all combinations of the parameter names, preceeded by an underscope, appended to the parameterized nonterminal
symbol. This means that:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span><sub>[Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>is a convenient abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList_Return</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>and that:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span><sub>[Return, In]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>is an abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList_Return</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList_In</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList_Return_In</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>Multiple parameters produce a combinatory number of productions, not all of which are necessarily referenced in a
complete grammar.</p>
<p>References to nonterminals on the right hand side of a production can also be parameterized. For example:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span><sub>[In]</sub></div>
</div>
<p>is equivalent to saying:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement_In</span></div>
</div>
<p>A nonterminal reference may have both a parameter list and an “<sub>opt</sub>” suffix. For example:</p>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>[In]</sub><sub>opt</sub></div>
</div>
<p>is an abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer_In</span></div>
</div>
<p>Prefixing a parameter name with “<sub>?</sub>” on a right hand side nonterminal reference makes that
parameter value dependent upon the occurrence of the parameter name on the reference to the current production’s left
hand side symbol. For example:</p>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span><sub>[In]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>[?In]</sub></div>
</div>
<p>is an abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration_In</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span> <span class="nt">Initializer_In</span></div>
</div>
<p>If a right hand side alternative is prefixed with “[+parameter]” that alternative is only available if the
named parameter was used in referencing the production’s nonterminal symbol. If a right hand side alternative is
prefixed with “[~parameter]” that alternative is only available if the named parameter was <i>not</i> used in
referencing the production’s nonterminal symbol. This means that:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span><sub>[Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[+Return]</span> <span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>is an abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList_Return</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>and that</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span><sub>[Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[~Return]</span> <span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>is an abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList_Return</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
</div>
<p>When the words “<b>one of</b>” follow the colon(s) in a grammar definition, they signify that each of the
terminal symbols on the following line or lines is an alternative definition. For example, the lexical grammar for
ECMAScript contains the production:</p>
<div class="gp">
<div class="lhs"><span class="nt">NonZeroDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<p>which is merely a convenient abbreviation for:</p>
<div class="gp">
<div class="lhs"><span class="nt">NonZeroDigit</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">1</code></div>
<div class="rhs"><code class="t">2</code></div>
<div class="rhs"><code class="t">3</code></div>
<div class="rhs"><code class="t">4</code></div>
<div class="rhs"><code class="t">5</code></div>
<div class="rhs"><code class="t">6</code></div>
<div class="rhs"><code class="t">7</code></div>
<div class="rhs"><code class="t">8</code></div>
<div class="rhs"><code class="t">9</code></div>
</div>
<p>If the phrase “[empty]” appears as the right-hand side of a production, it indicates that the production's
right-hand side contains no terminals or nonterminals.</p>
<p>If the phrase “[lookahead ∉ <var>set</var>]” appears in the right-hand side of a production, it
indicates that the production may not be used if the immediately following input token is a member of the given
<var>set</var>. The <var>set</var> can be written as a list of terminals enclosed in curly braces. For convenience, the set
can also be written as a nonterminal, in which case it represents the set of all terminals to which that nonterminal could
expand. For example, given the definitions</p>
<div class="gp">
<div class="lhs"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalDigits</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></div>
</div>
<p>the definition</p>
<div class="gp">
<div class="lhs"><span class="nt">LookaheadExample</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">n</code> <span class="grhsannot">[lookahead ∉ {<code class="t">1</code>, <code class="t">3</code>, <code class="t">5</code>, <code class="t">7</code>, <code class="t">9</code>}]</span> <span class="nt">DecimalDigits</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
</div>
<p>matches either the letter <code>n</code> followed by one or more decimal digits the first of which is even, or a decimal
digit not followed by another decimal digit.</p>
<p>If the phrase “[no <span class="nt">LineTerminator</span> here]” appears in the right-hand side of a
production of the syntactic grammar, it indicates that the production is <i>a restricted production</i>: it may not be used
if a <span class="nt">LineTerminator</span> occurs in the input stream at the indicated position. For example, the
production:</p>
<div class="gp">
<div class="lhs"><span class="nt">ThrowStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">throw</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span> <code class="t">;</code></div>
</div>
<p>indicates that the production may not be used if a <span class="nt">LineTerminator</span> occurs in the script between
the <code>throw</code> token and the <span class="nt">Expression</span>.</p>
<p>Unless the presence of a <span class="nt">LineTerminator</span> is forbidden by a restricted production, any number of
occurrences of <span class="nt">LineTerminator</span> may appear between any two consecutive tokens in the stream of input
elements without affecting the syntactic acceptability of the script.</p>
<p>The lexical grammar has multiple goal symbols and the appropriate goal symbol to use depends upon the syntactic grammar
context. If a phrase of the form “[Lexical goal <i>LexicalGoalSymbol</i>]” appears on the right-hand-side of a
syntactic production then the next token must be lexically recognized using the indicated goal symbol. In the absence of
such a phrase the default lexical goal symbol is used.</p>
<p>When an alternative in a production of the lexical grammar or the numeric string grammar appears to be a multi-character
token, it represents the sequence of characters that would make up such a token.</p>
<p>The right-hand side of a production may specify that certain expansions are not permitted by using the phrase
“<b>but not</b>” and then indicating the expansions to be excluded. For example, the production:</p>
<div class="gp">
<div class="lhs"><span class="nt">Identifier</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">IdentifierName</span> <span class="grhsmod">but not</span> <span class="nt">ReservedWord</span></div>
</div>
<p>means that the nonterminal <span class="nt">Identifier</span> may be replaced by any sequence of characters that could
replace <span class="nt">IdentifierName</span> provided that the same sequence of characters could not replace <span class="nt">ReservedWord</span>.</p>
<p>Finally, a few nonterminal symbols are described by a descriptive phrase in sans-serif type in cases where it would be
impractical to list all the alternatives:</p>
<div class="gp">
<div class="lhs"><span class="nt">SourceCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="gprose">any Unicode code point</span></div>
</div>
</section>
</section>
<section id="sec-algorithm-conventions">
<h1><span class="secnum" id="sec-5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions" title="link to this section">5.2</a></span>
Algorithm Conventions</h1>
<p>The specification often uses a numbered list to specify steps in an algorithm. These algorithms are used to precisely
specify the required semantics of ECMAScript language constructs. The algorithms are not intended to imply the use of any
specific implementation technique. In practice, there may be more efficient algorithms available to implement a given
feature.</p>
<p>Algorithms may be explicitly parameterized, in which case the names and usage of the parameters must be provided as part of
the algorithm’s definition. In order to facilitate their use in multiple parts of this specification, some algorithms,
called <i>abstract</i> <i>operations</i>, are named and written in parameterized functional form so that they may be
referenced by name from within other algorithms.</p>
<p>Algorithms may be associated with productions of one of the ECMAScript grammars. A production that has multiple
alternative definitions will typically have a distinct algorithm for each alternative. When an algorithm is associated with a
grammar production, it may reference the terminal and nonterminal symbols of the production alternative as if they were
parameters of the algorithm. When used in this manner, nonterminal symbols refer to the actual alternative definition that is
matched when parsing the script souce code.</p>
<p>When an algorithm is associated with a production alternative, the alternative is typically shown without any “[
]” grammar annotations. Such annotations should only affect the syntactic recognition of the alternative and have no
effect on the associated semantics for the alternative.</p>
<p>Unless explicitly specified otherwise, all <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-context-free-grammars">chain productions</a> have an implicit
associated definition for every algorithm that is might be applied to that production’s left-hand side nonterminal. The
implicit definition simply reapplies the same algorithm name with the same parameters, if any, to the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-context-free-grammars">chain production</a>’s sole right-hand side nonterminal and then result. For example,
assume there is a production</p>
<div class="gp">
<div class="lhs"><span class="nt">Block</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <span class="nt">StatementList</span> <code class="t">}</code></div>
</div>
<p>but there is no <span style="font-family: Times New Roman">evaluation</span> algorithm that is explicitly specified for
that production. If in some algorithm there is a statement of the form: “<span style="font-family: Times New
Roman">Return the result of evaluating <i>Block</i></span>” it is implicit that the algorithm has an <span style="font-family: Times New Roman">evaluation</span> algorithm of the form:</p>
<p><b>Runtime Semantics: Evaluation</b></p>
<div class="gp prod"><span class="nt">Block</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">StatementList</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return the result of evaluating StatementList.</li>
</ol>
<p>For clarity of expression, algorithm steps may be subdivided into sequential substeps. Substeps are indented and may
themselves be further divided into indented substeps. Outline numbering conventions are used to identify substeps with the
first level of substeps labelled with lower case alphabetic characters and the second level of substeps labelled with lower
case roman numerals. If more than three levels are required these rules repeat with the fourth level using numeric labels. For
example:</p>
<ol class="proc">
<li>Top-level step
<ol class="block">
<li>Substep.</li>
<li>Substep.
<ol class="block">
<li>Subsubstep.
<ol class="block">
<li>Subsubsubstep
<ol class="block">
<li>Subsubsubsubstep
<ol class="block">
<li>Subsubsubsubsubstep</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>A step or substep may be written as an “if” predicate that conditions its substeps. In this case, the substeps
are only applied if the predicate is true. If a step or substep begins with the word “else”, it is a predicate
that is the negation of the preceding “if” predicate step at the same level.</p>
<p>A step may specify the iterative application of its substeps.</p>
<p>A step may assert an invariant condition of its algorithm. Such assertions are used to make explicit algorithmic invariants
that would otherwise be implicit. Such assertions add no additional semantic requirements and hence need not be checked by an
implementation. They are used simply to clarify algorithms.</p>
<p>Mathematical operations such as addition, subtraction, negation, multiplication, division, and the mathematical functions
defined later in this clause should always be understood as computing exact mathematical results on mathematical real numbers,
which do not include infinities and do not include a negative zero that is distinguished from positive zero. Algorithms in
this standard that model floating-point arithmetic include explicit steps, where necessary, to handle infinities and signed
zero and to perform rounding. If a mathematical operation or function is applied to a floating-point number, it should be
understood as being applied to the exact mathematical value represented by that floating-point number; such a floating-point
number must be finite, and if it is <span class="value">+0</span> or <span class="value">−0</span> then the
corresponding mathematical value is simply <span class="value">0</span>.</p>
<p>The mathematical function <span style="font-family: Times New Roman">abs(<i>x</i>)</span> produces the absolute value of
<var>x</var>, which is <span style="font-family: Times New Roman">−<i>x</i></span> if <var>x</var> is negative (less
than zero) and otherwise is <var>x</var> itself.</p>
<p>The mathematical function <span style="font-family: Times New Roman">sign(<i>x</i>)</span> produces <span style="font-family: Times New Roman">1</span> if <var>x</var> is positive and <span style="font-family: Times New
Roman">−1</span> if <var>x</var> is negative. The sign function is not used in this standard for cases when <var>x</var>
is zero.</p>
<p>The mathematical function <span style="font-family: Times New Roman">min(<i>x</i><sub>1</sub>,</span> <span style="font-family: Times New Roman"><i>x</i><sub>2</sub>, ..., <i>x</i><sub>n</sub>)</span> produces the mathematically
smallest of <span style="font-family: Times New Roman"><i>x</i><sub>1</sub></span> through <span style="font-family: Times New
Roman"><i>x</i><sub>n</sub></span>.</p>
<p>The notation “<span style="font-family: Times New Roman"><i>x</i> modulo <i>y</i></span>” (<var>y</var> must be
finite and nonzero) computes a value <var>k</var> of the same sign as <var>y</var> (or zero) such that <span style="font-family: Times New Roman">abs(<i>k</i>) &lt; abs(<i>y</i>) and <i>x</i>−<i>k</i> = <i>q</i></span> <span style="font-family: Times New Roman">×</span> <var>y</var> for some integer <var>q</var>.</p>
<p>The mathematical function <span style="font-family: Times New Roman">floor(<i>x</i>)</span> produces the largest integer
(closest to positive infinity) that is not larger than <var>x</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> floor(<i>x</i>) = <i>x</i>−(<i>x</i> modulo 1).</p>
</div>
</section>
<section id="sec-static-semantic-rules">
<h1><span class="secnum" id="sec-5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules" title="link to this section">5.3</a></span> Static
Semantic Rules</h1>
<p>Context-free grammars are not sufficiently powerful to express all the rules that define whether a stream of input elements
form a valid ECMAScript script that may be evaluated. In some situations additional rules are needed that may be expressed
using either ECMAScript algorithm conventions or prose requirements. Such rules are always associated with a production of a
grammar and are called the <i>static semantics</i> of the production.</p>
<p>Static Semantic Rules have names and typically are defined using an algorithm. Named Static Semantic Rules are associated
with grammar productions and a production that has multiple alternative definitions will typically have for each alternative a
distinct algorithm for each applicable named static semantic rule.</p>
<p>Unless otherwise specified every grammar production alternative in this specification implicitly has a definition for a
static semantic rule named <span style="font-family: Times New Roman">Contains</span> which takes an argument named
<var>symbol</var> whose value is a terminal or nonterminal of the grammar that includes the associated production. The default
definition of <span style="font-family: Times New Roman">Contains</span> is:</p>
<ol class="proc">
<li>For each terminal and nonterminal grammar symbol, <i>sym</i>, in the definition of this production do
<ol class="block">
<li>If <i>sym</i> is the same grammar symbol as <i>symbol</i>, return <b>true</b>.</li>
<li>If <i>sym</i> is a nonterminal, then
<ol class="block">
<li>Let contained be the result of Contains for <i>sym</i> with argument <i>symbol</i>.</li>
<li>If <i>contained</i> is <b>true</b>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>The above definition is explicitly over-ridden for specific productions.</p>
<p>A special kind of static semantic rule is an Early Error Rule. Early error rules define early error conditions (see <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-handling-and-language-extensions">clause 16</a>) that are associated with specific grammar productions.
Evaluation of most early error rules are not explicitly invoked within the algorithms of this specification. A conforming
implementation must, prior to the first evaluation of a <span class="nt">Script</span>, validate all of the early error rules
of the productions used to parse that <span class="nt">Script</span>. If any of the early error rules are violated the <span class="nt">Script</span> is invalid and cannot be evaluated.</p>
</section>
</section>
<section id="sec-ecmascript-data-types-and-values">
<div class="front">
<h1><span class="secnum" id="sec-6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values" title="link to this section">6</a></span>
ECMAScript Data Types and Values</h1>
<p>Algorithms within this specification manipulate values each of which has an associated type. The possible value types are
exactly those defined in this clause. Types are further subclassified into ECMAScript language types and specification
types.</p>
<p>Within this specification, the notation “<span style="font-family: Times New Roman">Type(<i>x</i>)</span>” is
used as shorthand for “<span style="font-family: Times New Roman">the type of <i>x</i></span>” where “<span style="font-family: Times New Roman">type</span>” refers to the ECMAScript language and specification types defined in
this clause.</p>
</div>
<section id="sec-ecmascript-language-types">
<div class="front">
<h1><span class="secnum" id="sec-6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types" title="link to this section">6.1</a></span>
ECMAScript Language Types</h1>
<p>An ECMAScript language type corresponds to values that are directly manipulated by an ECMAScript programmer using the
ECMAScript language. The ECMAScript language types are Undefined, Null, Boolean, String, Symbol, Number, and Object. An
ECMAScript language value is a value that is characterized by an ECMAScript language type.</p>
</div>
<section id="sec-ecmascript-language-types-undefined-type">
<h1><span class="secnum" id="sec-6.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type" title="link to this section">6.1.1</a></span> The Undefined Type</h1>
<p>The Undefined type has exactly one value, called <b>undefined</b>. Any variable that has not been assigned a value has
the value <b>undefined</b>.</p>
</section>
<section id="sec-ecmascript-language-types-null-type">
<h1><span class="secnum" id="sec-6.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-null-type" title="link to this section">6.1.2</a></span> The Null Type</h1>
<p>The Null type has exactly one value, called <b>null</b>.</p>
</section>
<section id="sec-ecmascript-language-types-boolean-type">
<h1><span class="secnum" id="sec-6.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-boolean-type" title="link to this section">6.1.3</a></span> The Boolean Type</h1>
<p>The Boolean type represents a logical entity having two values, called <b>true</b> and <b>false</b>.</p>
</section>
<section id="sec-ecmascript-language-types-string-type">
<h1><span class="secnum" id="sec-6.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type" title="link to this section">6.1.4</a></span> The String Type</h1>
<p>The String type is the set of all finite ordered sequences of zero or more 16-bit unsigned integer values
(“elements”). The String type is generally used to represent textual data in a running ECMAScript program, in
which case each element in the String is treated as a UTF-16 code unit value. Each element is regarded as occupying a
position within the sequence. These positions are indexed with nonnegative integers. The first element (if any) is at index
0, the next element (if any) at index 1, and so on. The length of a String is the number of elements (i.e., 16-bit values)
within it. The empty String has length zero and therefore contains no elements.</p>
<p>Where ECMAScript operations interpret String values, each element is interpreted as a single UTF-16 code unit. However,
ECMAScript does not place any restrictions or requirements on the sequence of code units in a String value, so they may be
ill-formed when interpreted as UTF-16 code unit sequences. Operations that do not interpret String contents treat them as
sequences of undifferentiated 16-bit unsigned integers. No operations ensure that Strings are in a normalized form. Only
operations that are explicitly specified to be language or locale sensitive produce language-sensitive results</p>
<div class="note">
<p><span class="nh">NOTE</span> The rationale behind this design was to keep the implementation of Strings as simple and
high-performing as possible. If ECMAScript source code is in Normalized Form C, string literals are guaranteed to also be
normalized, as long as they do not contain any Unicode escape sequences.</p>
</div>
<p>Some operations interpret String contents as UTF-16 encoded Unicode code points. In that case the interpretation is:</p>
<ul>
<li>
<p>A code unit in the range <span style="font-family: Times New Roman">0</span> to <span style="font-family: Times New
Roman">0xD7FF</span> or in the range <span style="font-family: Times New Roman">0xE000</span> to <span style="font-family: Times New Roman">0xFFFF</span> is interpreted as a code point with the same value.</p>
</li>
<li>
<p>A sequence of two code units, where the first code unit <var>c1</var> is in the range <span style="font-family: Times
New Roman">0xD800</span> to <span style="font-family: Times New Roman">0xDBFF</span> and the second code unit
<var>c2</var> is in the range <span style="font-family: Times New Roman">0xDC00</span> to <span style="font-family:
Times New Roman">0xDFFF</span>, is a surrogate pair and is interpreted as a code point with the value (<var>c1</var> -
<span style="font-family: Times New Roman">0xD800</span>) × <span style="font-family: Times New
Roman">0x400</span> + (<var>c2</var> – <span style="font-family: Times New Roman">0xDC00</span>) + <span style="font-family: Times New Roman">0x10000</span>.</p>
</li>
<li>
<p>A code unit that is in the range <span style="font-family: Times New Roman">0xD800</span> to <span style="font-family: Times New Roman">0xDFFF</span>, but is not part of a surrogate pair, is interpreted as a code point
with the same value.</p>
</li>
</ul>
</section>
<section id="sec-ecmascript-language-types-symbol-type">
<div class="front">
<h1><span class="secnum" id="sec-6.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type" title="link to this section">6.1.5</a></span> The Symbol Type</h1>
<p>The Symbol type is the set of all non-String values that may be used as the key of an Object property (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">6.1.7</a>).</p>
<p>Each possible Symbol values is unique and immutable.</p>
<p>Symbol values have an associated internal attribute called [[Description]] whose immutable value is either <span class="value">undefined</span> or a String value.</p>
</div>
<section id="sec-well-known-symbols">
<h1><span class="secnum" id="sec-6.1.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-well-known-symbols" title="link to this section">6.1.5.1</a></span> Well-Known Symbols</h1>
<p>Well-known symbols are built-in Symbol values that are explicitly referenced by algorithms of this specification. They
are typically used as the keys of properties whose values serve as extension points of a specification algorithm. Unless
otherwise specified, well-known symbols values are shared by all Code Realms (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">8.2</a>).</p>
<p>Within this specification a well-known symbol is referred to by using a notation of the form @@name, where
“name” is one of the values listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table 1</a>.</p>
<figure>
<figcaption><span id="table-1">Table 1</span>— Well-known Symbols</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Specification Name</th>
<th style="border-bottom: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">[[Description]]</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value and Purpose</th>
</tr>
<tr>
<td>@@create</td>
<td><code>"Symbol.create"</code></td>
<td>A method used to allocate an object. Called from the [[Construct]] internal method.</td>
</tr>
<tr>
<td>@@hasInstance</td>
<td><code>"Symbol.hasInstance"</code></td>
<td>A method that determines if a constructor object recognizes an object as one of the constructor’s instances. Called by the semantics of the <code>instanceof</code> operator.</td>
</tr>
<tr>
<td>@@isConcatSpreadable</td>
<td><code>"Symbol.isConcatSpreadable"</code></td>
<td>A Boolean value that if true indicates that an object should be flatten to its array elements by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.concat">Array.prototype.concat</a>.</td>
</tr>
<tr>
<td>@@isRegExp</td>
<td><code>"Symbol.isRegExp"</code></td>
<td>A Boolean value that if true indicates that an object may be used as a regular expression.</td>
</tr>
<tr>
<td>@@iterator</td>
<td><code>"Symbol.iterator"</code></td>
<td>A method that returns the default iterator for an object. Called by the semantics of the for-of statement.</td>
</tr>
<tr>
<td>@@toPrimitive</td>
<td><code>"Symbol.toPrimitive"</code></td>
<td>A method that converts an object to a corresponding primitive value. Called by the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a> abstract operation.</td>
</tr>
<tr>
<td>@@toStringTag</td>
<td><code>"Symbol.toStringTag"</code></td>
<td>A string value that is used in the creation of the default string description of an object. Called by the built-in method <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring">Object.prototype.toString</a>.</td>
</tr>
<tr>
<td>@@unscopables</td>
<td><code>"Symbol.unscopables"</code></td>
<td>An Array of string values that are property names that are excluded from the with environment bindings of the associated objects.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
<section id="sec-ecmascript-language-types-number-type">
<h1><span class="secnum" id="sec-6.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type" title="link to this section">6.1.6</a></span> The Number Type</h1>
<p>The Number type has exactly <span style="font-family: Times New Roman">18437736874454810627</span> (that is, <span style="font-family: Times New Roman">2<sup>64</sup>−2<sup>53</sup>+3</span>) values, representing the double-precision
64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic, except that the <span style="font-family: Times New Roman">9007199254740990</span> (that is, <span style="font-family: Times New
Roman">2<sup>53</sup>−2</span>) distinct “Not-a-Number” values of the IEEE Standard are represented in
ECMAScript as a single special <b>NaN</b> value. (Note that the <b>NaN</b> value is produced by the program expression
<code>NaN</code>.) In some implementations, external code might be able to detect a difference between various Not-a-Number
values, but such behaviour is implementation-dependent; to ECMAScript code, all NaN values are indistinguishable from each
other.</p>
<p>There are two other special values, called <b>positive Infinity</b> and <b>negative Infinity</b>. For brevity, these
values are also referred to for expository purposes by the symbols <span class="value">+∞</span> and <span class="value">−∞</span>, respectively. (Note that these two infinite Number values are produced by the program
expressions <code>+Infinity</code> (or simply <code>Infinity</code>) and <code>-Infinity</code>.)</p>
<p>The other <span style="font-family: Times New Roman">18437736874454810624</span> (that is, <span style="font-family:
Times New Roman">2<sup>64</sup>−2<sup>53</sup></span>) values are called the finite numbers. Half of these are
positive numbers and half are negative numbers; for every finite positive Number value there is a corresponding negative
value having the same magnitude.</p>
<p>Note that there is both a <b>positive zero</b> and a <b>negative zero</b>. For brevity, these values are also referred to
for expository purposes by the symbols <span class="value">+0</span> and <span class="value">−0</span>, respectively.
(Note that these two different zero Number values are produced by the program expressions <code>+0</code> (or simply
<code>0</code>) and <code>-0</code>.)</p>
<p>The <span style="font-family: Times New Roman">18437736874454810622</span> (that is, <span style="font-family: Times New
Roman">2<sup>64</sup>−2<sup>53</sup>−2</span>) finite nonzero values are of two kinds:</p>
<p><span style="font-family: Times New Roman">18428729675200069632</span> (that is, <span style="font-family: Times New
Roman">2<sup>64</sup>−2<sup>54</sup></span>) of them are normalized, having the form</p>
<div class="math-display"><i>s</i> × <i>m</i> × 2<sup><i>e</i></sup></div>
<p>where <var>s</var> is <span style="font-family: Times New Roman">+1</span> or <span style="font-family: Times New
Roman">−1</span>, <var>m</var> is a positive integer less than <span style="font-family: Times New
Roman">2<sup>53</sup></span> but not less than <span style="font-family: Times New Roman">2<sup>52</sup></span>, and
<var>e</var> is an integer ranging from <span style="font-family: Times New Roman">−1074</span> to <span style="font-family: Times New Roman">971</span>, inclusive.</p>
<p>The remaining <span style="font-family: Times New Roman">9007199254740990</span> (that is, <span style="font-family:
Times New Roman">2<sup>53</sup>−2</span>) values are denormalized, having the form</p>
<div class="math-display"><i>s</i> × <i>m</i> × 2<sup><i>e</i></sup></div>
<p>where <var>s</var> is <span style="font-family: Times New Roman">+1</span> or <span style="font-family: Times New
Roman">−1</span>, <var>m</var> is a positive integer less than <span style="font-family: Times New
Roman">2<sup>52</sup></span>, and <var>e</var> is <span style="font-family: Times New Roman">−1074</span>.</p>
<p>Note that all the positive and negative integers whose magnitude is no greater than <span style="font-family: Times New
Roman">2<sup>53</sup></span> are representable in the Number type (indeed, the integer <span style="font-family: Times New
Roman">0</span> has two representations, <code>+0</code> and <code>-0</code>).</p>
<p>A finite number has an <i>odd significand</i> if it is nonzero and the integer <var>m</var> used to express it (in one of
the two forms shown above) is odd. Otherwise, it has an <i>even significand</i>.</p>
<p>In this specification, the phrase “<span style="font-family: Times New Roman">the Number value for
<i>x</i></span>” where <var>x</var> represents an exact nonzero real mathematical quantity (which might even be an
irrational number such as <span style="font-family: Times New Roman">π</span>) means a Number value chosen in the
following manner. Consider the set of all finite values of the Number type, with <span class="value">−0</span> removed
and with two additional values added to it that are not representable in the Number type, namely <span style="font-family:
Times New Roman">2<sup>1024</sup></span> (which is <span style="font-family: Times New Roman">+1 ×
2<sup>53</sup></span> <span style="font-family: Times New Roman">× 2<sup>971</sup></span>) and <span style="font-family: Times New Roman">−2<sup>1024</sup></span> (which is <span style="font-family: Times New
Roman">−1 × 2<sup>53</sup></span> <span style="font-family: Times New Roman">× 2<sup>971</sup></span>).
Choose the member of this set that is closest in value to <var>x</var>. If two values of the set are equally close, then the
one with an even significand is chosen; for this purpose, the two extra values <span style="font-family: Times New
Roman">2<sup>1024</sup></span> and <span style="font-family: Times New Roman">−2<sup>1024</sup></span> are considered
to have even significands. Finally, if <span style="font-family: Times New Roman">2<sup>1024</sup></span> was chosen,
replace it with <span class="value">+∞</span>; if <span style="font-family: Times New
Roman">−2<sup>1024</sup></span> was chosen, replace it with <span class="value">−∞</span>; if <span class="value">+0</span> was chosen, replace it with <span class="value">−0</span> if and only if <var>x</var> is less
than zero; any other chosen value is used unchanged. The result is the Number value for <var>x</var>. (This procedure
corresponds exactly to the behaviour of the IEEE 754 “round to nearest” mode.)</p>
<p>Some ECMAScript operators deal only with integers in the range <span style="font-family: Times New
Roman">−2<sup>31</sup></span> through <span style="font-family: Times New Roman">2<sup>31</sup>−1</span>,
inclusive, or in the range <span style="font-family: Times New Roman">0</span> through <span style="font-family: Times New
Roman">2<sup>32</sup>−1</span>, inclusive. These operators accept any value of the Number type but first convert each
such value to one of <span style="font-family: Times New Roman">2<sup>32</sup></span> integer values. See the descriptions
of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a> operators in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">7.1.5</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">7.1.6</a>, respectively.</p>
</section>
<section id="sec-object-type">
<div class="front">
<h1><span class="secnum" id="sec-6.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type" title="link to this section">6.1.7</a></span> The
Object Type</h1>
<p>An Object is logically a collection of properties. Each property is either a data property, or an accessor
property:</p>
<p>A <i>data property</i> associates a key value with an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
value</a> and a set of Boolean attributes.</p>
<p>An <i>accessor property</i> associates a key value with one or two accessor functions, and a set of Boolean attributes.
The accessor functions are used to store or retrieve an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
value</a> that is associated with the property.</p>
<p>Properties are identified using key values. A key value is either an ECMAScript String value or a Symbol value. All
String and Symbol values, including the empty string, are valid as property keys.</p>
<p>Property keys are used to access properties and their values. There are two kinds of access for properties: <i>get</i>
and <i>set</i>, corresponding to value retrieval and assignment, respectively. The properties accessible via get and set
access includes both <i>own properties</i> that are a direct part of an object and <i>inherited properties</i> which are
provided by another associated object via a property inheritance relationship. Inherited properties may be either own or
inherited properties of the associated object. Each own properties of an object must each have a key value that is
distinct from the key values of the other own properties of that object.</p>
<p>All objects are logically collections of properties, but there are multiple forms of objects that differ in their
semantics for accessing and manipulating their properties. O<i>rdinary objects</i> are the most common form of objects
and have the default object semantics. An <i>exotic object</i> is any form of object whose property semantics differ in
any way from the default semantics.</p>
</div>
<section id="sec-property-attributes">
<h1><span class="secnum" id="sec-6.1.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-attributes" title="link to this section">6.1.7.1</a></span> Property Attributes</h1>
<p>Attributes are used in this specification to define and explain the state of Object properties. A data property
associates a key value with the attributes listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-2">Table 2</a>.</p>
<figure>
<figcaption><span id="table-2">Table 2</span> — Attributes of a Data Property</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Attribute Name</th>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Value Domain</th>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Description</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">[[Value]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language type</a></td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">The value retrieved by a get access of the property.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">[[Writable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Boolean</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If <b>false</b>, attempts by ECMAScript code to change the property’s [[Value]] attribute using [[Set]] will not succeed.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">[[Enumerable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Boolean</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If <b>true</b>, the property will be enumerated by a for-in enumeration (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-createperiterationenvironment">see 13.6.3.4</a>). Otherwise, the property is said to be non-enumerable.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">[[Configurable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Boolean</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If <b>false</b>, attempts to delete the property, change the property to be an accessor property, or change its attributes (other than [[Value]], or changing [[Writable]] to <b>false</b>) will fail.</td>
</tr>
</tbody></table>
</figure>
<p>An accessor property associates a key value with the attributes listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-3">Table 3</a>.</p>
<figure>
<figcaption><span id="table-3">Table 3</span> — Attributes of an Accessor Property</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Attribute Name</th>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Value Domain</th>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Description</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000">[[Get]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Object <i>or</i> Undefined</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If the value is an Object it must be a function Object. The function’s [[Call]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-6">Table 6</a>) is called with an empty arguments list to retrieve the property value each time a get access of the property is performed.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Set]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Object <i>or</i> Undefined</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If the value is an Object it must be a function Object. The function’s [[Call]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-6">Table 6</a>) is called with an arguments list containing the assigned value as its sole argument each time a set access of the property is performed. The effect of a property's [[Set]] internal method may, but is not required to, have an effect on the value returned by subsequent calls to the property's [[Get]] internal method.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Enumerable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Boolean</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If <b>true</b>, the property is to be enumerated by a for-in enumeration (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-createperiterationenvironment">see 13.6.3.4</a>). Otherwise, the property is said to be non-enumerable.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Configurable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">Boolean</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black">If <b>false</b>, attempts to delete the property, change the property to be a data property, or change its attributes will fail.</td>
</tr>
</tbody></table>
</figure>
<p>If the initial values of a property’s attributes are not explicitly specified by this specification, the default
value defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-4">Table 4</a> is used.</p>
<figure>
<figcaption><span id="table-4">Table 4</span> — Default Attribute Values</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Attribute Name</th>
<th style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">Default Value</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Value]]</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black"><b>undefined</b></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000">[[Get]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black"><b>undefined</b></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Set]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black"><b>undefined</b></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Writable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black"><b>false</b></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Enumerable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black"><b>false</b></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid #000000; border-top: 1px solid black">[[Configurable]]</td>
<td style="border-bottom: 1px solid black; border-right: 1px solid black"><b>false</b></td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-object-internal-methods-and-internal-slots">
<h1><span class="secnum" id="sec-6.1.7.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots" title="link to this section">6.1.7.2</a></span> Object Internal Methods and Internal Slots</h1>
<p>The actual semantics of objects, in ECMAScript, are specified via algorithms called <i>internal methods</i>. Each
object in an ECMAScript engine is associated with a set of internal methods that defines its runtime behaviour. These
internal methods are not part of the ECMAScript language. They are defined by this specification purely for expository
purposes. However, each object within an implementation of ECMAScript must behave as specified by the internal methods
associated with it. The exact manner in which this is accomplished is determined by the implementation.</p>
<p>Internal method names are polymorphic. This means that different object values may perform different algorithms when a
common internal method name is invoked upon them. If, at runtime, the implementation of an algorithm attempts to use an
internal method of an object that the object does not support, a <b>TypeError</b> exception is thrown.</p>
<p>Internal slots correspond to internal state that is associated with objects and used by various ECMAScript
specification algorithms. Internal slots are not object properties and they are not inherited. Depending upon the specific
internal slot specification, such state may consist of values of any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript
language type</a> or of specific ECMA specification type values. Unless explicitly specified otherwise, internal slots are
allocated as part of the process of creating an object and may not be dynamically added to an object. Unless specified
otherwise, the initial value of an internal slot is the value <span class="value">undefined</span>. Various algorithms
within this specification create objects that have internal slots. However, the ECMAScript language provides no direct way
to associate internal slots with an object.</p>
<p>Internal methods and internal slots are identified within this specification using names enclosed in double square
brackets [[ ]].</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-5">Table 5</a> summarizes the <i>essential internal methods</i> used by this specification that are
applicable to all objects created or manipulated by ECMAScript code. Every object must have algorithms for all of the
essential internal methods. However, all objects do not necessarily use the same algorithms for those methods.</p>
<p>The “Signature” column of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-5">Table 5</a> and other similar tables describes the invocation
pattern for each internal method. The invocation pattern always includes a parenthesized list of descriptive parameter
names. If a parameter name is the same as an ECMAScript type name then the name describes the required type of the
parameter value. If an internal method explicitly returns a value, its parameter list is followed by the symbol
“→” and the type name of the returned value. The type names used in signatures refer to the types defined
in clause 0 augmented by the following additional names. “<i>any</i>” means the value may be any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language type</a>. An internal method implicitly returns a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">6.2.2</a>. In addition to its parameters, an internal method always has
access to the object upon which it is invoked as a method.</p>
<figure>
<figcaption><span id="table-5">Table 5</span> — Essential Internal Methods</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Method</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Signature</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[GetPrototypeOf]]</td>
<td>()<b><i>→</i></b>Object or Null</td>
<td>Determine the object that provides inherited properties for this object. A <b>null</b> value indicates that there are no inherited properties.</td>
</tr>
<tr>
<td>[[SetPrototypeOf]]</td>
<td>(<i>Object</i> or Null)<b><i>→</i></b>Boolean</td>
<td>Associate with an object another object that provides inherited properties. Passing <b>null</b> indicates that there are no inherited properties. Returns <b>true</b> indicating that the operation was completed successfully or <b>false</b> indicating that the operation was not successful.</td>
</tr>
<tr>
<td>[[IsExtensible]]</td>
<td>( )<b><i>→</i></b>Boolean</td>
<td>Determine whether it is permitted to add additional properties to an object.</td>
</tr>
<tr>
<td>[[PreventExtensions]]</td>
<td>( )<b><i>→</i></b>Boolean</td>
<td>Control whether new properties may be added to an object. Returns <b>true</b> indicating that the operation was completed successfully or <b>false</b> indicating that the operation was not successful.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">[[GetOwnProperty]]</td>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">
<p>(<i>propertyKey</i>) →</p>
<p>Undefined or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a></p>
</td>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">Returns a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> for the own property of this object whose key is <i>propertyKey</i>, or <b>undefined</b> if no such property exists.</td>
</tr>
<tr>
<td>[[HasProperty]]</td>
<td>(<i>propertyKey</i>) <b><i>→</i></b> Boolean</td>
<td>Returns a Boolean value indicating whether the object already has either an own or inherited property whose key is <i>propertyKey</i>.</td>
</tr>
<tr>
<td>[[Get]]</td>
<td>(<i>propertyKey</i>, <i>Receiver</i>) <i><b>→</b> any</i></td>
<td>Retrieve the value of an object’s property using the <i>propertyKey</i> parameter. If any ECMAScript code must be executed to retrieve the property value, <i>Receiver</i> is used as the <b>this</b> value when evaluating the code.</td>
</tr>
<tr>
<td>[[Set]]</td>
<td>(<i>propertyKey</i>,<i>value</i>, <i>Receiver</i>) <i><b>→</b> Boolean</i></td>
<td>Try to set the value of an object’s property indentified by <i>propertyKey</i> to <i>value</i>. If any ECMAScript code must be executed to set the property value, <i>Receiver</i> is used as the <b>this</b> value when evaluating the code. Returns <b>true</b> indicating that the property value was set or <b>false</b> indicating that it could not be set.</td>
</tr>
<tr>
<td>[[Delete]]</td>
<td>(<i>propertyKey</i>) <b><i>→</i></b> Boolean</td>
<td>Removes the own property indentified by the <i>propertyKey</i> parameter from the object. Return <span class="value">false</span> if the property was not deleted and is still present. Return <span class="value">true</span> if the property was deleted or was not present.</td>
</tr>
<tr>
<td>[[DefineOwnProperty]]</td>
<td>(<i>propertyKey, PropertyDescriptor</i>) <b><i>→</i></b> Boolean</td>
<td>Creates or alters the named own property to have the state described by a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>. Returns <span class="value">true</span> indicating that the property was successfully created/updated or <b>false</b> indicating that the property could not be created or updated.</td>
</tr>
<tr>
<td>[[Enumerate]]</td>
<td>()<b><i>→</i></b>Object</td>
<td>Returns an iterator object over the string values of the keys of the enumerable properties of the object.</td>
</tr>
<tr>
<td>[[OwnPropertyKeys]]</td>
<td>()<b><i>→</i></b>Object</td>
<td>Returns an Iterator object that produces all of the own property keys for the object.</td>
</tr>
</tbody></table>
</figure>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-6">Table 6</a> summarizes additional essential internal methods that are supported by objects that may
be called as functions.</p>
<figure>
<figcaption><span id="table-6">Table 6</span> — Additional Essential Internal Methods of Function Objects</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Method</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Signature</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[Call]]</td>
<td>(<i>any</i>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <i>any</i>) <span style="font-family: Times New Roman"><b><i>→</i></b></span> <i>any</i></td>
<td>Executes code associated with the object. Invoked via a function call expression. The arguments to the internal method are a <b>this</b> value and a list containing the arguments passed to the function by a call expression. Objects that implement this internal method are <i>callable</i>.</td>
</tr>
<tr>
<td>[[Construct]]</td>
<td>(a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <i>any</i>) <span style="font-family: Times New Roman"><b><i>→</i></b></span> Object</td>
<td>Creates an object. Invoked via the <code>new</code> operator. The arguments to the internal method are the arguments passed to the <b>new</b> operator. Objects that implement this internal method are called <i>constructors</i>. A Function object is not necessarily a constructor and such non-constructor Function objects do not have a [[Construct]] internal method.</td>
</tr>
</tbody></table>
</figure>
<p>The semantics of the essential internal method for ordinary objects and standard exotic objects are specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-and-exotic-objects-behaviours">clause 9</a>. If any specified use of an exotic object's internal
methods is not supported by an implementation, that usage must throw a <b>TypeError</b> exception when attempted.</p>
</section>
<section id="sec-invariants-of-the-essential-internal-methods">
<h1><span class="secnum" id="sec-6.1.7.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invariants-of-the-essential-internal-methods" title="link to this section">6.1.7.3</a></span> Invariants of the Essential Internal Methods</h1>
<p>The Internal Methods of Objects of an ECMAScript engine must conform to the list of invariants specified below.
Ordinary ECMAScript Objects as well as all standard exotic objects in this specification maintain these invariants.
ECMAScript Proxy objects maintain these invariants by means of runtime checks on the result of traps invoked on the
[[ProxyHandler]] object.</p>
<p>Any implementation provided exotic objects must also maintain these invariants for those objects. Violation of these
invariants may cause ECMAScript code to have unpredictable behavior and create security issues. However, violation of
these invariants must never compromise the memory safety of an implementation.</p>
<p>Definitions:</p>
<p>● The <i>target</i> of an internal method is the object the internal method is called upon.</p>
<p>● A target is <i>non-extensible</i> if it has been observed to return false from its [[IsExtensible]]
internal method, or true from its [[PreventExtensions]] internal method.</p>
<p>● A <i>non-existent</i> property is a property that does not exist as an own property on a non-extensible
target.</p>
<p>● All references to <i><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a></i> are according to the definition of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a> algorithm specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">7.2.3</a>.</p>
<p><b>[[GetPrototypeOf]] ( )</b></p>
<p>● The Type of the return value must be either Object or Null.</p>
<p>● If target is non-extensible, and [[GetPrototypeOf]] returns a value v, then any future calls to
[[GetPrototypeOf]] should return the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a> as v.</p>
<p>● An object’s prototype chain must have finite length (that is, starting from any object, recursively
applying the [[GetPrototypeOf]] internal method to its result must eventually lead to the value null.</p>
<p><b>[[SetPrototypeOf]] (V)</b></p>
<p>● The Type of the return value must be Boolean.</p>
<p>● If target is non-extensible, [[SetPrototypeOf]] must return false, unless V is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a> as the target’s observed [[GetPrototypeOf]] value.</p>
<p><b>[[PreventExtensions]] ( )</b></p>
<p>● The Type of the return value must be Boolean.</p>
<p>● If [[PreventExtensions]] returns true, all future calls to [[IsExtensible]] must return false and the
target is now considered non-extensible.</p>
<p><b>[[GetOwnProperty]] (P)</b></p>
<p>● The Type of the return value must be either Object or Undefined.</p>
<p>● If the Type of the return value is Object, that object must be a complete property descriptor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completepropertydescriptor">see 6.2.4.6</a>).</p>
<p>● If a property is described as a data property and it may return different values over time, then either
or both of the Desc.[[Writable]] and Desc.[[Configurable]] attributes must be true even if no mechanism to change the
value is exposed via the other internal methods.</p>
<p>● If a property P is described as a data property with Desc.[[Value]] equal to v and Desc.[[Writable]] and
Desc.[[Configurable]] are both false, then the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a> must be returned for the
Desc.[[Value]] attribute of the property on all future calls to [[GetOwnProperty]] ( P ).</p>
<p>● If P’s attributes other than [[Writable]] may change over time or if the property might disappear,
then P’s [[Configurable]] attribute must be true.</p>
<p>● If the [[Writable]] attribute may change from false to true, then the [[Configurable]] attribute must be
true.</p>
<p>● If the target is non-extensible and P is non-existent, then all future calls to [[GetOwnProperty]] (P)
must describe P as non-existent (i.e. [[GetOwnProperty]] (P) must return undefined)</p>
<p><b>[[DefineOwnProperty]] (P, Desc)</b></p>
<p>● The Type of the return value must be Boolean.</p>
<p>●  [[DefineOwnProperty]] must return false if P has previously been observed as a non-configurable own
property, unless either:</p>
<p>1. P is a non-configurable writable own data property. A non-configurable writable data property can be changed
into a non-configurable non-writable data property.</p>
<p>2. All attributes in Desc are the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a> as P’s attributes.</p>
<p>●  [[DefineOwnProperty]] (P, Desc) must return false if target is non-extensible and P is a non-existent
own property. That is, a non-extensible target object cannot be extended with new properties.</p>
<p><b>[[HasProperty]] ( P )</b></p>
<p>● The Type of the return value must be Boolean.</p>
<p>● If P was previously observed as a non-configurable data or accessor own property, [[HasProperty]] must
return true.</p>
<p><b>[[Get]] (P, Receiver)</b></p>
<p>● If P was previously observed as a non-configurable, non-writable own data property with value v, then
[[Get]] must return the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>.</p>
<p>● If P was previously observed as a non-configurable own accessor whose [[Get]] attribute is undefined, the
[[Get]] operation must return undefined.</p>
<p><b>[[Set]] ( P, V, Receiver)</b></p>
<p>● The Type of the return value must be Boolean.</p>
<p>● If P was previously observed as a non-configurable, non-writable own data property, then [[Set]] must
return false unless V is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a> as P’s [[Value]] attribute.</p>
<p>● If P was previously observed as a non-configurable own accessor property whose [[Set]] attribute is
undefined, the [[Set]] operation must return false.</p>
<p><b>[[Delete]] ( P )</b></p>
<p>● The Type of the return value must be Boolean.</p>
<p>● If P was previously observed to be a non-configurable own data or accessor property, [[Delete]] must
return false.</p>
<p><b>[[Enumerate]] ( )</b></p>
<p>● The Type of the return value must be Object.</p>
<p><b>[[OwnPropertyKeys]] ( )</b></p>
<p>● The Type of the return value must be Object.</p>
<p><b>[[GetOwnPropertyNames]] ( )</b></p>
<p>● The Type of the return value must be Object.</p>
<p>● The return value must be an exotic Array object.</p>
<p>● The returned array must contain at least the string and symbol-valued names of all own data and accessor
properties P that have previously been observed as non-configurable.</p>
<p>● If the target is non-extensible, then it may not claim to have any own properties not observed by
[[GetOwnPropertyNames]].</p>
<p><b>[[Construct]] ( )</b></p>
<p>● The Type of the return value must be Object.</p>
</section>
<section id="sec-well-known-intrinsic-objects">
<h1><span class="secnum" id="sec-6.1.7.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-well-known-intrinsic-objects" title="link to this section">6.1.7.4</a></span> Well-Known Intrinsic Objects</h1>
<p>Well-known intrinsics are built-in objects that are explicitly referenced by the algorithms of this specification and
which usually have <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> specific identities. Unless otherwise specified each intrinsic
object actually corresponds to a set of similar objects, one per <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</p>
<p>Within this specification a reference such as %name% means the intrinsic object, associated with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the current Realm</a>, corresponding to the name. Determination of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the current Realm</a> and its intrinsics is described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">8.2</a>. The well-known intrinsics are listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-7">Table 7</a>.</p>
<figure>
<figcaption><span id="table-7">Table 7</span> — Well-known Intrinsic Objects</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Intrinsic Name</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Global Name</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">ECMAScript Language Association</th>
</tr>
<tr>
<td>%Object%</td>
<td><code>"Object"</code></td>
<td>The <code>Object</code> constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-constructor">19.1.1</a>)</td>
</tr>
<tr>
<td>%ObjectPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Object%</span>. (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>)</td>
</tr>
<tr>
<td>%ObjProto_toString%</td>
<td></td>
<td>The initial value of the <code>"toString"</code> data property of the intrinsic <span style="font-family: Times New Roman">%ObjectPrototype%</span>. (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring">19.1.3.6</a>)</td>
</tr>
<tr>
<td>%Function%</td>
<td><code>"Function"</code></td>
<td>The <code>Function</code> constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-constructor">19.2.1</a>)</td>
</tr>
<tr>
<td>%FunctionPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Function%.</span></td>
</tr>
<tr>
<td>%Array%</td>
<td><code>"Array"</code></td>
<td>The <code>Array</code> constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-constructor">22.1.1</a>)</td>
</tr>
<tr>
<td>%ArrayPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Array%.</span></td>
</tr>
<tr>
<td>%ArrayIteratorPrototype%</td>
<td></td>
<td>The prototype object used for<br>Iterator objects created by the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayiterator">CreateArrayIterator</a> abstract operation.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%String%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><code>"String"</code></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The <code>String</code> constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-constructor">21.1.1</a>)</td>
</tr>
<tr>
<td>%StringPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%String%.</span></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%StringIteratorPrototype%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The prototype object used for<br>Iterator objects created by the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createstringiterator">CreateStringIterator</a> abstract operation</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%Boolean%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><code>"Boolean"</code></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The initial value of the global object property named "<code>Boolean</code>".</td>
</tr>
<tr>
<td>%BooleanPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Boolean%.</span></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%Number%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><code>"Number"</code></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The initial value of the global object property named "<code>Number</code>".</td>
</tr>
<tr>
<td>%NumberPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Number%.</span></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%Date%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><code>"Date"</code></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The initial value of the global object property named "<code>Date</code>".</td>
</tr>
<tr>
<td>%DatePrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Date%.</span></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%RegExp%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><code>"RegExp"</code></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The initial value of the global object property named "<code>RegExp</code>".</td>
</tr>
<tr>
<td>%RegExpPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%RegExp%.</span></td>
</tr>
<tr>
<td>%Map%</td>
<td><code>"Map"</code></td>
<td>The initial value of the global object property named <code>"Map"</code>.</td>
</tr>
<tr>
<td>%MapPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Map%.</span></td>
</tr>
<tr>
<td>%MapIteratorPrototype%</td>
<td></td>
<td>The prototype object used for<br>Iterator objects created by the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmapiterator">CreateMapIterator</a> abstract operation</td>
</tr>
<tr>
<td>%WeakMap%</td>
<td><code>"WeakMap"</code></td>
<td>The initial value of the global object property named <code>"WeakMap"</code>.</td>
</tr>
<tr>
<td>%WeakMapPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%WeakMap%.</span></td>
</tr>
<tr>
<td>%Set%</td>
<td><code>"Set"</code></td>
<td>The initial value of the global object property named <code>"Set"</code>.</td>
</tr>
<tr>
<td>%SetPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%Set%.</span></td>
</tr>
<tr>
<td>%WeakSet%</td>
<td><code>"WeakSet"</code></td>
<td>The initial value of the global object property named <code>"WeakSet"</code>.</td>
</tr>
<tr>
<td>%WeakSetPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%WeakSet%.</span></td>
</tr>
<tr>
<td>%SetIteratorPrototype%</td>
<td></td>
<td>The prototype object used for<br>Iterator objects created by the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createsetiterator">CreateSetIterator</a> abstract operation</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%GeneratorFunction%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The initial value of the name "GeneratorFunction" exported from the built-in module "std:iteration".</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%Generator%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">The initial value of the name "Generator" exported from the built-in module "std:iteration"</td>
</tr>
<tr>
<td>%GeneratorPrototype%</td>
<td></td>
<td>The initial value of the <code>prototype</code> property of the %Generator% intrinsic</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%Error%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%EvalError%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%RangeError%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%ReferenceError%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%SyntaxError%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%TypeError%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">%URIError%</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>%ErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%EvalErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%RangeErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%ReferenceErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%SyntaxErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%TypeErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%URIErrorPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%ArrayBuffer%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%ArrayBufferPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%ArrayBuffer%.</span></td>
</tr>
<tr>
<td>%TypedArray%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%TypedArrayPrototype%</td>
<td></td>
<td>The initial value of the <code>"prototype"</code> data property of the intrinsic <span style="font-family: Times New Roman">%TypedArray%.</span></td>
</tr>
<tr>
<td>%Int8Array%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%Int8ArrayPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%DataView%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%DataViewPrototype%</td>
<td></td>
<td></td>
</tr>
<tr>
<td>%ThrowTypeError%</td>
<td></td>
<td>A function object that unconditionally throws a new instance of %TypeError%.</td>
</tr>
<tr>
<td>???</td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-ecmascript-specification-types">
<div class="front">
<h1><span class="secnum" id="sec-6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-specification-types" title="link to this section">6.2</a></span> ECMAScript Specification Types</h1>
<p>A specification type corresponds to meta-values that are used within algorithms to describe the semantics of ECMAScript
language constructs and ECMAScript language types. The specification types are <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical
Environment</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-data-blocks">Data Block</a>.
Specification type values are specification artefacts that do not necessarily correspond to any specific entity within an
ECMAScript implementation. Specification type values may be used to describe intermediate results of ECMAScript expression
evaluation but such values cannot be stored as properties of objects or values of ECMAScript language variables.</p>
</div>
<section id="sec-list-and-record-specification-type">
<h1><span class="secnum" id="sec-6.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type" title="link to this section">6.2.1</a></span> The List and Record Specification Type</h1>
<p>The List type is used to explain the evaluation of argument lists (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists">see 12.3.6</a>) in
<code>new</code> expressions, in function calls, and in other algorithms where a simple ordered list of values is needed.
Values of the List type are simply ordered sequences of list elements containing the individual values. These sequences may
be of any length. The elements of a list may be randomly accessed using 0-origin indices. For notational convience an
array-like syntax can be used to access List elements. For example, <i>arguments</i>[2] is shorthand for saying the
3<sup>th</sup> element of the List <i>arguments</i>.</p>
<p>The Record type is used to describe data aggregations within the algorithms of this specification. A Record type value
consists of one or more named fields. The value of each field is either an ECMAScript value or an abstract value
represented by a name associated with the Record type. Field names are always enclosed in double brackets, for example
[[value]]</p>
<p>For notational convenience within this specification, an object literal-like syntax can be used to express a Record
value. For example, {[[field1]]: 42, [[field2]]: <b>false</b>, [[field3]]: <b>empty</b>} defines a Record value that has
three fields each of which is initialized to a specific value. Field name order is not significant. Any fields that are not
explicitly listed are considered to be absent.</p>
<p>In specification text and algorithms, dot notation may be used to refer to a specific field of a Record value. For
example, if R is the record shown in the previous paragraph then R.[[field2]] is shorthand for “the field of R named
[[field2]]”.</p>
<p>Schema for commonly used Record field combinations may be named, and that name may be used as a prefix to a literal
Record value to identify the specific kind of aggregations that is being described. For example:
PropertyDescriptor{[[Value]]: 42, [[Writable]]: <b>false</b>, [[Configurable]]: <b>true</b>}.</p>
</section>
<section id="sec-completion-record-specification-type">
<div class="front">
<h1><span class="secnum" id="sec-6.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type" title="link to this section">6.2.2</a></span> The Completion Record Specification Type</h1>
<p>The Completion type is a Record used to explain the runtime propagation of values and control flow such as the
behaviour of statements (<code>break</code>, <code>continue</code>, <code>return</code> and <code>throw</code>) that
perform nonlocal transfers of control.</p>
<p>Values of the Completion type are Record values whole fields are defined as by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-8">Table 8</a>.</p>
<figure>
<figcaption><span id="table-8">Table 8</span> — Completion Record Fields</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[type]]</td>
<td>One of <b>normal</b>, <b>break</b>, <b>continue</b>, <b>return</b>, or <b>throw</b></td>
<td>The type of completion that occurred.</td>
</tr>
<tr>
<td>[[value]]</td>
<td>any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> or <b>empty</b></td>
<td>The value that was produced.</td>
</tr>
<tr>
<td>[[target]]</td>
<td>any ECMAScript string or <b>empty</b></td>
<td>The target label for directed control transfers.</td>
</tr>
</tbody></table>
</figure>
<p>The term “abrupt completion” refers to any completion with a <span style="font-family: Times New
Roman">[[type]]</span> value other than <b>normal</b>.</p>
</div>
<section id="sec-normalcompletion">
<h1><span class="secnum" id="sec-6.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion" title="link to this section">6.2.2.1</a></span>
NormalCompletion</h1>
<p>The abstract operation NormalCompletion with a single <i>argument</i>, such as:</p>
<ol class="proc">
<li>Return NormalCompletion(<i>argument</i>).</li>
</ol>
<p>Is a shorthand that is defined as follows:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">normal</span>, [[value]]: <i>argument</i>, [[target]]:<span style="font-family:
sans-serif">empty</span>}.</li>
</ol>
</section>
<section id="sec-implicit-completion-values">
<h1><span class="secnum" id="sec-6.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-implicit-completion-values" title="link to this section">6.2.2.2</a></span> Implicit Completion Values</h1>
<p>The algorithms of this specification often implicitly return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a> Records whose [[type]] is <b>normal</b>. Unless it is
otherwise obvious from the context, an algorithm statement that returns a value that is not a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>, such as:</p>
<ol class="proc">
<li>Return "Infinity".</li>
</ol>
<p>Generally means the same thing as:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<code>"Infinity"</code>).</li>
</ol>
<p>A “<span style="font-family: Times New Roman">return</span>” statement without a value in an algorithm step
means the same thing as:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
<p>Similarly, any reference to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> value that is
in a context that does not explicitly require a complete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion
Record</a> value is equivalent to an explicit reference to the [[value]] field of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> value unless the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</p>
</section>
<section id="sec-throw-an-exception">
<h1><span class="secnum" id="sec-6.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-throw-an-exception" title="link to this section">6.2.2.3</a></span> Throw an Exception</h1>
<p>Algorithms steps that say to throw an exception, such as</p>
<ol class="proc">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<p>Mean the same things as:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">throw</span>, [[value]]: a newly created <b>TypeError</b> object, [[target]]:<span style="font-family:
sans-serif">empty</span>}.</li>
</ol>
</section>
<section id="sec-returnifabrupt">
<h1><span class="secnum" id="sec-6.2.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt" title="link to this section">6.2.2.4</a></span>
ReturnIfAbrupt</h1>
<p>Algorithms steps that say</p>
<ol class="proc">
<li>ReturnIfAbrupt(<i>argument</i>).</li>
</ol>
<p>mean the same things as:</p>
<ol class="proc">
<li>If argument is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then return
argument.</li>
<li>Else if argument is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>, then let argument
be argument.[[value]].</li>
</ol>
</section>
</section>
<section id="sec-reference-specification-type">
<div class="front">
<h1><span class="secnum" id="sec-6.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type" title="link to this section">6.2.3</a></span> The Reference Specification Type</h1>
<div class="note">
<p><span class="nh">NOTE</span> The Reference type is used to explain the behaviour of such operators as
<code>delete</code>, <code>typeof</code>, the assignment operators, the <code>super</code> keyword and other language
features. For example, the left-hand operand of an assignment is expected to produce a reference.</p>
</div>
<p>A <b>Reference</b> is a resolved name or property binding. A Reference consists of three components, the
<var>base</var> value, the <var>referenced name</var> and the Boolean valued <var>strict reference</var> flag. The
<var>base</var> value is either <b>undefined</b>, an Object, a Boolean, a String, a Symbol, a Number, or an environment
record (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">8.1.1</a>). A <var>base</var> value of <b>undefined</b> indicates that the
Reference could not be resolved to a binding. The <var>referenced name</var> is a String or Symbol value.</p>
<p>A Super Reference is a Reference that is used to represents a name binding that was expressed using the super keyword.
A Super Reference has an additional <var>thisValue</var> component and its <var>base</var> value will never be an
environment record.</p>
<p>The following abstract operations are used in this specification to access the components of references:</p>
<ul>
<li>
<p>GetBase(V). Returns the <i>base</i> value component of the reference V.</p>
</li>
<li>
<p>GetReferencedName(V). Returns the <i>referenced name</i> component of the reference V.</p>
</li>
<li>
<p>IsStrictReference(V). Returns the <i>strict reference</i> flag component of the reference V.</p>
</li>
<li>
<p>HasPrimitiveBase(V). Returns <b>true</b> if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>base</i>)
is a Boolean, String, Symbol, or Number.</p>
</li>
<li>
<p>IsPropertyReference(V). Returns <b>true</b> if either the <i>base</i> value is an object or HasPrimitiveBase(V) is
<b>true</b>; otherwise returns <b>false</b>.</p>
</li>
<li>
<p>IsUnresolvableReference(V). Returns <b>true</b> if the <i>base</i> value is <b>undefined</b> and <b>false</b>
otherwise.</p>
</li>
<li>
<p>IsSuperReference(V). Returns <b>true</b> if this reference has a <i>thisValue</i> component.</p>
</li>
</ul>
<p>The following abstract operations are used in this specification to operate on references:</p>
</div>
<section id="sec-getvalue">
<h1><span class="secnum" id="sec-6.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue" title="link to this section">6.2.3.1</a></span> GetValue
(V)</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>V</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>, return <i>V</i>.</li>
<li>Let <i>base</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetBase</a>(<i>V</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsUnresolvableReference</a>(<i>V</i>), throw a <b>ReferenceError</b>
exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsPropertyReference</a>(<i>V</i>), then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">HasPrimitiveBase</a>(<i>V</i>) is <b>true</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: In this case, <i>base</i> will never be <b>null</b> or
<b>undefined</b>.</li>
<li>Let <i>base</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>base</i>).</li>
</ol>
</li>
<li>Return the [[Get]] internal method of <i>base</i> passing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>V</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisvalue">GetThisValue</a>(<i>V</i>) as the arguments.</li>
</ol>
</li>
<li>Else <i>base</i> must be an environment record,
<ol class="block">
<li>Return the result of calling the GetBindingValue (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">see 8.1.1</a>) concrete
method of <i>base</i> passing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>V</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsStrictReference</a>(<i>V</i>) as arguments.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The object that may be created in step 5.a.ii is not accessible outside of the above
abstract operation and the ordinary object [[Get]] internal method. An implementation might choose to avoid the actual
creation of the object.</p>
</div>
</section>
<section id="sec-putvalue">
<h1><span class="secnum" id="sec-6.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue" title="link to this section">6.2.3.2</a></span> PutValue
(V, W)</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>V</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>W</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>, throw a <b>ReferenceError</b> exception.</li>
<li>Let <i>base</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetBase</a>(<i>V</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsUnresolvableReference</a>(<i>V</i>), then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsStrictReference</a>(<i>V</i>) is <b>true</b>, then
<ol class="block">
<li>Throw <b>ReferenceError</b> exception.</li>
</ol>
</li>
<li>Let <i>globalObj</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getglobalobject">GetGlobalObject</a>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>globalObj</i>,<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>V</i>), <i>W</i>, <b>false</b>).</li>
</ol>
</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsPropertyReference</a>(<i>V</i>), then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">HasPrimitiveBase</a>(<i>V</i>) is <b>true</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: In this case, <i>base</i> will never be <b>null</b> or
<b>undefined</b>.</li>
<li>Set <i>base</i> to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>base</i>).</li>
</ol>
</li>
<li>Let <i>succeeded</i> be the result of calling the [[Set]] internal method of <i>base</i> passing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>V</i>), <i>W</i>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisvalue">GetThisValue</a>(<i>V</i>) as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>succeeded</i>).</li>
<li>If <i>succeeded</i> is <b>false</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsStrictReference</a>(<i>V</i>) is <b>true</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Return.</li>
</ol>
</li>
<li>Else <i>base</i> must be a reference whose base is an environment record. So,
<ol class="block">
<li>Return the result of calling the SetMutableBinding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">8.1.1</a>) concrete
method of <i>base</i>, passing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>V</i>),
<i>W</i>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsStrictReference</a>(<i>V</i>) as arguments.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The object that may be created in step 6.a.ii is not accessible outside of the above
algorithm and the ordinary object [[Set]] internal method. An implementation might choose to avoid the actual creation
of that object.</p>
</div>
</section>
<section id="sec-getthisvalue">
<h1><span class="secnum" id="sec-6.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisvalue" title="link to this section">6.2.3.3</a></span>
GetThisValue (V)</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsPropertyReference</a>(<i>V</i>) is <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsSuperReference</a>(<i>V</i>), then
<ol class="block">
<li>Return the value of the <i>thisValue</i> component of the reference <i>V</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetBase</a>(<i>V</i>).</li>
</ol>
</section>
</section>
<section id="sec-property-descriptor-specification-type">
<div class="front">
<h1><span class="secnum" id="sec-6.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type" title="link to this section">6.2.4</a></span> The Property Descriptor Specification Type</h1>
<p>The Property Descriptor type is used to explain the manipulation and reification of Object property attributes. Values
of the Property Descriptor type are Records composed of named fields where each field’s name is an attribute name
and its value is a corresponding attribute value as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-attributes">6.1.7.1</a>. In
addition, any field may be present or absent. The schema name used within this specification to tag literal descriptions
of Property Descriptor records is “PropertyDescriptor”.</p>
<p>Property Descriptor values may be further classified as data Property Descriptors and accessor Property Descriptors
based upon the existence or use of certain fields. A data Property Descriptor is one that includes any fields named either
[[Value]] or [[Writable]]. An accessor Property Descriptor is one that includes any fields named either [[Get]] or
[[Set]]. Any Property Descriptor may have fields named [[Enumerable]] and [[Configurable]]. A Property Descriptor value
may not be both a data Property Descriptor and an accessor Property Descriptor; however, it may be neither. A generic
Property Descriptor is a Property Descriptor value that is neither a data Property Descriptor nor an accessor Property
Descriptor. A fully populated Property Descriptor is one that is either an accessor Property Descriptor or a data Property
Descriptor and that has all of the fields that correspond to the property attributes defined in either <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-2">Table 2</a> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-3">Table 3</a>.</p>
<p>A Property Descriptor may be derived from an object that has properties that directly correspond to the fields of a
Property Descriptor. Such a derived Property Descriptor has an additional field named [[Origin]] whose value is the
object from which the Property Descriptor was derived.</p>
<p>The following abstract operations are used in this specification to operate upon Property Descriptor values:</p>
</div>
<section id="sec-isaccessordescriptor">
<h1><span class="secnum" id="sec-6.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor" title="link to this section">6.2.4.1</a></span> IsAccessorDescriptor ( Desc )</h1>
<p>When the abstract operation IsAccessorDescriptor is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span>, the following
steps are taken:</p>
<ol class="proc">
<li>If <i>Desc</i> is <b>undefined</b>, then return <b>false</b>.</li>
<li>If both <i>Desc</i>.[[Get]] and <i>Desc</i>.[[Set]] are absent, then return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-isdatadescriptor">
<h1><span class="secnum" id="sec-6.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor" title="link to this section">6.2.4.2</a></span>
IsDataDescriptor ( Desc )</h1>
<p>When the abstract operation IsDataDescriptor is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span>, the following
steps are taken:</p>
<ol class="proc">
<li>If <i>Desc</i> is <b>undefined</b>, then return <b>false</b>.</li>
<li>If both <i>Desc</i>.[[Value]] and <i>Desc</i>.[[Writable]] are absent, then return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-isgenericdescriptor">
<h1><span class="secnum" id="sec-6.2.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isgenericdescriptor" title="link to this section">6.2.4.3</a></span> IsGenericDescriptor ( Desc )</h1>
<p>When the abstract operation IsGenericDescriptor is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span>, the following
steps are taken:</p>
<ol class="proc">
<li>If <i>Desc</i> is <b>undefined</b>, then return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>Desc</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>Desc</i>) are both <b>false</b>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-frompropertydescriptor">
<h1><span class="secnum" id="sec-6.2.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-frompropertydescriptor" title="link to this section">6.2.4.4</a></span> FromPropertyDescriptor ( Desc )</h1>
<p>When the abstract operation FromPropertyDescriptor is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span>, the following
steps are taken:</p>
<ol class="proc">
<li>If <i>Desc</i> is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>If <i>Desc</i> has an [[Origin]] field, then return <i>Desc</i>.[[Origin]].</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%ObjectPrototype%</span>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>obj</i> is an extensible ordinary object with no own
properties.</li>
<li>If <i>Desc</i> has a [[Value]] field, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>obj</i>, "<b><span style="font-family: monospace">value</span>"</b>, and PropertyDescriptor{[[Value]]: <i>Desc</i>.[[Value]],
[[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}</li>
</ol>
</li>
<li>If <i>Desc</i> has a [[Writable]] field, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>obj</i>,
"<code>writable</code>", and PropertyDescriptor{[[Value]]: <i>Desc</i>.[[Writable]], [[Writable]]: <b>true</b>,
[[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
</ol>
</li>
<li>If <i>Desc</i> has a [[Get]] field, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>obj</i>,
"<code>get",</code> and PropertyDescriptor{[[Value]]: <i>Desc</i>.[[Get]], [[Writable]]: <b>true</b>,
[[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
</ol>
</li>
<li>If <i>Desc</i> has a [[Set]] field, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>obj</i>,
"<code>set</code>", and PropertyDescriptor{[[Value]]: <i>Desc</i>.[[Set]], [[Writable]]: <b>true</b>,
[[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
</ol>
</li>
<li>If <i>Desc</i> has an [[Enumerable]] field, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>obj</i>,
"<code>enumerable</code>", and PropertyDescriptor{[[Value]]: <i>Desc</i>.[[Enumerable]], [[Writable]]:
<b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
</ol>
</li>
<li>If <i>Desc</i> has a [[Configurable]] field, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>obj</i> ,
"<code>configurable</code>", and PropertyDescriptor{[[Value]]: <i>Desc</i>.[[Configurable]], [[Writable]]:
<b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
</ol>
</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
<section id="sec-topropertydescriptor">
<h1><span class="secnum" id="sec-6.2.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor" title="link to this section">6.2.4.5</a></span> ToPropertyDescriptor ( Obj )</h1>
<p>When the abstract operation ToPropertyDescriptor is called with object <span class="nt">Obj</span>, the following steps
are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>Obj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>Obj</i>) is not Object throw a <b>TypeError</b>
exception.</li>
<li>Let <i>desc</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> that
initially has no fields.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>Obj</i>, "<code>enumerable</code>") is <b>true</b>, then
<ol class="block">
<li>Let <i>enum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Obj</i>, "<code>enumerable</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>enum</i>).</li>
<li>Set the [[Enumerable]] field of <i>desc</i> to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>enum</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>Obj</i>, "<code>configurable</code>") is <b>true</b>, then
<ol class="block">
<li>Let <i>conf</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Obj</i>, "<code>configurable</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>conf</i>).</li>
<li>Set the [[Configurable]] field of <i>desc</i> to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>conf</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>Obj</i>, "<code>value</code>") is <b>true</b>, then
<ol class="block">
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Obj</i>, "<code>value</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>Set the [[Value]] field of <i>desc</i> to <i>value</i>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>Obj</i>, "<code>writable</code>") is <b>true</b>, then
<ol class="block">
<li>Let <i>writable</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Obj</i>, "<code>writable</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>writable</i>).</li>
<li>Set the [[Writable]] field of <i>desc</i> to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>writable</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>Obj</i>, "<code>get</code>") is <b>true</b>, then
<ol class="block">
<li>Let <i>getter</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Obj</i>, "<code>get</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>getter</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>getter</i>) is <b>false</b> and <i>getter</i> is not
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Set the [[Get]] field of <i>desc</i> to <i>getter</i>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>Obj</i>, "<code>set</code>") is <b>true</b>, then
<ol class="block">
<li>Let <i>setter</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Obj</i>, "<code>set</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>setter</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>setter</i>) is <b>false</b> and <i>setter</i> is not
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Set the [[Set]] field of <i>desc</i> to <i>setter</i>.</li>
</ol>
</li>
<li>If either <i>desc</i>.[[Get]] or <i>desc</i>.[[Set]] are present, then
<ol class="block">
<li>If either <i>desc</i>.[[Value]] or <i>desc</i>.[[Writable]] are present, then throw a <b>TypeError</b>
exception.</li>
</ol>
</li>
<li>Set the [[Origin]] field of <i>desc</i> to <i>Obj</i>.</li>
<li>Return <i>desc</i>.</li>
</ol>
</section>
<section id="sec-completepropertydescriptor">
<h1><span class="secnum" id="sec-6.2.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completepropertydescriptor" title="link to this section">6.2.4.6</a></span> CompletePropertyDescriptor ( Desc, LikeDesc )</h1>
<p>When the abstract operation CompletePropertyDescriptor is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span>, the following
steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>LikeDesc</i> is either a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> or <b>undefined</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>Desc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>Desc</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a></li>
<li>If <i>LikeDesc</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>like</i> be Record{[[Value]]: <b>undefined</b>, [[Writable]]: <b>false</b>, [[Get]]: <b>undefined</b>,
[[Set]]: <b>undefined</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b>}.</li>
</ol>
</li>
<li>else,
<ol class="block">
<li>Let <i>like</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> that is a
copy of <i>LikeDesc</i>.</li>
<li>Perform CompletePropertyDescriptor(<i>like</i>, <b>undefined</b>).</li>
</ol>
</li>
<li>If either <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isgenericdescriptor">IsGenericDescriptor</a>(<i>Desc</i>) or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>Desc</i>) is <b>true</b>, then
<ol class="block">
<li>If <i>Desc</i> does not have a [[Value]] field, then set <i>Desc</i>.[[Value]] to <i>like</i>.[[Value]].</li>
<li>If <i>Desc</i> does not have a [[Writable]] field, then set <i>Desc</i>.[[Writable]] to
<i>like</i>.[[Writable]].</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>If <i>Desc</i> does not have a [[Get]] field, then set <i>Desc</i>.[[Get]] to <i>like</i>.[[Get]].</li>
<li>If <i>Desc</i> does not have a [[Set]] field, then set <i>Desc</i>.[[Set]] to <i>like</i>.[[Set]].</li>
</ol>
</li>
<li>If <i>Desc</i> does not have an [[Enumerable]] field, then set <i>Desc</i>.[[Enumerable]] to
<i>like</i>.[[Enumerable]].</li>
<li>If <i>Desc</i> does not have a [[Configurable]] field, then set <i>Desc</i>.[[Configurable]] to
<i>like</i>.[[Configurable]].</li>
<li>Return <i>Desc</i>.</li>
</ol>
</section>
</section>
<section id="sec-lexical-environment-and-environment-record-specification-types">
<h1><span class="secnum" id="sec-6.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environment-and-environment-record-specification-types" title="link to this section">6.2.5</a></span> The Lexical Environment and Environment Record Specification Types</h1>
<p>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment
Record</a> types are used to explain the behaviour of name resolution in nested functions and blocks. These types and the
operations upon them are defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">8.1</a>.</p>
</section>
<section id="sec-data-blocks">
<div class="front">
<h1><span class="secnum" id="sec-6.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-data-blocks" title="link to this section">6.2.6</a></span> Data
Blocks</h1>
<p>The Data Block specification type is used to describe a distinct and mutable sequence of byte-sized (8 bit) numeric
values. A Data Block value is created with a fixed number of bytes that each have the initial value 0.</p>
<p>For notational convenience within this specification, an array-like syntax can be used to express to the individual
bytes of a Data Block value. This notation presents a Data Block value as a 0-origined integer indexed sequence of bytes.
For example, if <var>db</var> is a 5 byte Data Block value then <var>db</var>[2] can be used to express access to its
3<sup>rd</sup> byte.</p>
<p>The following abstract operations are used in this specification to operate upon Data Block values:</p>
</div>
<section id="sec-createbytedatablock">
<h1><span class="secnum" id="sec-6.2.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbytedatablock" title="link to this section">6.2.6.1</a></span> CreateByteDataBlock(size)</h1>
<p>When the abstract operation CreateByteDataBlock is called with integer argument <var>size</var>, the following steps
are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>size</i>≥0.</li>
<li>Let <i>db</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-data-blocks">Data Block</a> value consisting of <i>size</i> bytes. If it is
impossible to create such a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-data-blocks">Data Block</a>, then throw a <b>RangeError</b>
exception.</li>
<li>Set all of the bytes of <i>db</i> to 0.</li>
<li>Return <i>db</i>.</li>
</ol>
</section>
<section id="sec-copydatablockbytes">
<h1><span class="secnum" id="sec-6.2.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-copydatablockbytes" title="link to this section">6.2.6.2</a></span> CopyDataBlockBytes(toBlock, toIndex, fromBlock, fromIndex, count)</h1>
<p>When the abstract operation CopyDataBlockBytes is called the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>fromBlock</i> and <i>toBlock</i> are distinct <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-data-blocks">Data Block</a> values.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>fromIndex</i>, <i>toIndex</i>, and <i>count</i> are positive
integer values.</li>
<li>Let <i>fromSize</i> be the number of bytes in <i>fromBlock</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>fromIndex</i>+<i>count</i> ≤ <i>fromSize</i>.</li>
<li>Let <i>toSize</i> be the number of bytes in <i>toBlock</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>toIndex</i>+<i>count</i> ≤ <i>toSize</i>.</li>
<li>Repeat, while <i>count</i>&gt;0
<ol class="block">
<li>Set toBlock[toIndex] to the value of fromBlock[fromIndex].</li>
<li>Increment <i>toIndex</i> and <i>fromIndex</i> each by 1.</li>
<li>Decrement <i>count</i> by 1.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>)</li>
</ol>
</section>
</section>
</section>
</section>
<section id="sec-abstract-operations">
<div class="front">
<h1><span class="secnum" id="sec-7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations" title="link to this section">7</a></span> Abstract
Operations</h1>
<p>These operations are not a part of the ECMAScript language; they are defined here to solely to aid the specification of the
semantics of the ECMAScript language. Other, more specialized abstract operations are defined throughout this
specification.</p>
</div>
<section id="sec-type-conversion-and-testing">
<div class="front">
<h1><span class="secnum" id="sec-7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-type-conversion-and-testing" title="link to this section">7.1</a></span>
Type Conversion and Testing</h1>
<p>The ECMAScript language implicitly performs automatic type conversion as needed. To clarify the semantics of certain
constructs it is useful to define a set of conversion abstract operations. The conversion abstract operations are
polymorphic; they can accept a value of any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language type</a> or of a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> value. But no other specification types are used
with these operations.</p>
</div>
<section id="sec-toprimitive">
<h1><span class="secnum" id="sec-7.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive" title="link to this section">7.1.1</a></span>
ToPrimitive</h1>
<p>The abstract operation ToPrimitive takes an <span style="font-family: Times New Roman">input</span> <var>argument</var>
and an optional argument <span class="nt">PreferredType</span>. The abstract operation ToPrimitive converts its
<var>input</var> argument to a non-Object type. If an object is capable of converting to more than one primitive type, it
may use the optional hint <span class="nt">PreferredType</span> to favour that type. Conversion occurs according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-9">Table 9</a>:</p>
<figure>
<figcaption><span id="table-9">Table 9</span> — ToPrimitive Conversions</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Input Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <i>argument</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return <i>argument</i>. Otherwise return ToPrimitive(<i>argument</i>.[[value]]) also passing the optional hint <i>PreferredType</i>.</td>
</tr>
<tr>
<td>Undefined</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>Null</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>Boolean</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>Number</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>String</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>Symbol</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>Object</td>
<td>Perform the steps following this table.</td>
</tr>
</tbody></table>
</figure>
<p>When <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>)</span> is Object, the following steps are taken:</p>
<ol class="proc">
<li>If <i>PreferredType</i> was not passed, let <i>hint</i> be "<code>default</code>".</li>
<li>Else if <i>PreferredType</i> is hint String, let <i>hint</i> be "<code>string</code>".</li>
<li>Else <i>PreferredType</i> is hint Number, let <i>hint</i> be "<code>number</code>".</li>
<li>Let <i>exoticToPrim</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>argument</i>, @@toPrimitive).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exoticToPrim</i>).</li>
<li>If <i>exoticToPrim</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>result</i> be the result of calling the [[Call]] internal method of <i>exoticToPrim</i>, with
<i>argument</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>hint</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <i>result</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>result</i>) is not Object, then return
<i>result</i>.</li>
<li>Else, throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>If <i>hint</i> is "<code>default</code>" then, let <i>hint</i> be "<code>number</code>".</li>
<li>Return OrdinaryToPrimitive(<i>argument,hint</i>).</li>
</ol>
<p>When the OrdinaryToPrimitive is called with arguments <var>O</var> and <var>hint</var>, the following steps are
taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>hint</i>)
is String and its value is either "<code>string</code>" or "<code>number</code>".</li>
<li>If <i>hint</i> is "<code>string</code>", then
<ol class="block">
<li>Let <i>methodNames</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> (
"<code>toString</code>", "<code>valueOf</code>").</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>methodNames</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> ( "<code>valueOf</code>",
"<code>toString</code>").</li>
</ol>
</li>
<li>For each <i>name</i> in <i>methodNames</i> in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> order, do
<ol class="block">
<li>Let <i>method</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>method</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>method)</i> is <b>true</b> then,
<ol class="block">
<li>Let <i>result</i> be the result of calling the [[Call]] internal method of <i>method</i>, with <i>O</i> as
<i>thisArgument</i> and an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as
<i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>result</i>) is not Object, then return
<i>result</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> When ToPrimitive is called with no hint, then it generally behaves as if the hint were
Number. However, objects may over-ride this behaviour by defining a @@toPrimitive method. Of the objects defined in this
specification only Date objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-objects">see 20.3</a>) and Symbol objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype-@@toprimitive">see 19.4.3.4</a>) over-ride the default ToPrimitive behaviour. Date objects
treat no hint as if the hint were String.</p>
</div>
</section>
<section id="sec-toboolean">
<h1><span class="secnum" id="sec-7.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean" title="link to this section">7.1.2</a></span>
ToBoolean</h1>
<p>The abstract operation ToBoolean converts its <i>argument</i> to a value of type Boolean according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-10">Table 10</a>:</p>
<figure>
<figcaption><span id="table-10">Table 10</span> — ToBoolean Conversions</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Argument Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <i>argument</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return the argument. Otherwise return ToBoolean(<i>argument</i>.[[value]])</td>
</tr>
<tr>
<td>Undefined</td>
<td>Return <b>false</b></td>
</tr>
<tr>
<td>Null</td>
<td>Return <b>false</b></td>
</tr>
<tr>
<td>Boolean</td>
<td>Return the input argument (no conversion).</td>
</tr>
<tr>
<td>Number</td>
<td>Return <b>false</b> if the argument is <b>+0</b>, <b>−0</b>, or <b>NaN</b>; otherwise return <b>true</b>.</td>
</tr>
<tr>
<td>String</td>
<td>Return <b>false</b> if the argument is the empty String (its length is zero); otherwise return <b>true</b>.</td>
</tr>
<tr>
<td>Symbol</td>
<td>Return <b>true</b></td>
</tr>
<tr>
<td>Object</td>
<td>Return <b>true</b></td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-tonumber">
<div class="front">
<h1><span class="secnum" id="sec-7.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber" title="link to this section">7.1.3</a></span>
ToNumber</h1>
<p>The abstract operation ToNumber converts its <i>argument</i> to a value of type Number according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-11">Table 11</a>:</p>
<figure>
<figcaption><span id="table-11">Table 11</span> — ToNumber Conversions</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Argument Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <i>argument</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return <i>argument</i>. Otherwise return ToNumber(<i>argument</i>.[[value]])</td>
</tr>
<tr>
<td>Undefined</td>
<td>Return <b>NaN</b></td>
</tr>
<tr>
<td>Null</td>
<td>Return <b>+0</b></td>
</tr>
<tr>
<td>Boolean</td>
<td>Return <b>1</b> if <i>argument</i> is <b>true</b>. Return <b>+0</b> if <i>argument</i> is <b>false</b>.</td>
</tr>
<tr>
<td>Number</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
<tr>
<td>String</td>
<td>See grammar and conversion algorithm below.</td>
</tr>
<tr>
<td>Symbol</td>
<td>Return <b>NaN</b></td>
</tr>
<tr>
<td>Object</td>
<td>
<p>Apply the following steps:</p>
<ol class="proc">
<li>Let <i>primValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>argument</i>, hint Number).</li>
<li>Return ToNumber(<i>primValue</i>).</li>
</ol>
</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-tonumber-applied-to-the-string-type">
<div class="front">
<h1><span class="secnum" id="sec-7.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber-applied-to-the-string-type" title="link to this section">7.1.3.1</a></span> ToNumber Applied to the String Type</h1>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a> applied to Strings applies the following grammar to the input String. If the
grammar cannot interpret the String as an expansion of <span class="nt">StringNumericLiteral</span>, then the result of
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a> is <b>NaN</b>.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">StringNumericLiteral</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">StrWhiteSpace</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">StrWhiteSpace</span><sub>opt</sub> <span class="nt">StrNumericLiteral</span> <span class="nt">StrWhiteSpace</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StrWhiteSpace</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">StrWhiteSpaceChar</span> <span class="nt">StrWhiteSpace</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StrWhiteSpaceChar</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StrNumericLiteral</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">StrDecimalLiteral</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StrDecimalLiteral</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">StrUnsignedDecimalLiteral</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">StrUnsignedDecimalLiteral</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">StrUnsignedDecimalLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">Infinity</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <code class="t">.</code> <span class="nt">DecimalDigits</span><sub>opt</sub> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalDigits</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExponentPart</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">ExponentIndicator</span> <span class="nt">SignedInteger</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExponentIndicator</span> <span class="geq">:::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">e</code> <code class="t">E</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SignedInteger</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">DecimalDigits</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">HexIntegerLiteral</span> <span class="geq">:::</span></div>
<div class="rhs"><code class="t">0x</code> <span class="nt">HexDigit</span></div>
<div class="rhs"><code class="t">0X</code> <span class="nt">HexDigit</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">HexDigit</span> <span class="geq">:::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code> <code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> Some differences should be noted between the syntax of a <i>StringNumericLiteral</i>
and a <i>NumericLiteral</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">see 11.8.3</a>):</p>
<ul>
<li>
<p>A <i>StringNumericLiteral</i> may be preceded and/or followed by white space and/or line terminators.</p>
</li>
<li>
<p>A <i>StringNumericLiteral</i> that is decimal may have any number of leading <code>0</code> digits.</p>
</li>
<li>
<p>A <i>StringNumericLiteral</i> that is decimal may be preceded by <code>+</code> or <code>-</code> to indicate
its sign.</p>
</li>
<li>
<p>A <i>StringNumericLiteral</i> that is empty or contains only white space is converted to <b>+0</b>.</p>
</li>
<li>
<p><code>Infinity</code> <code>and –Infinity</code> are recognised as a <i>StringNumericLiteral</i> but not
as a <i>NumericLiteral</i>.</p>
</li>
</ul>
</div>
</div>
<section id="sec-runtime-semantics-mv-s">
<h1><span class="secnum" id="sec-7.1.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-mv-s" title="link to this section">7.1.3.1.1</a></span> Runtime Semantics: MV’s</h1>
<p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a
numeric literal (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">see 11.8.3</a>), but some of the details are different, so the
process for converting a String numeric literal to a value of Number type is given here in full. This value is
determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this
mathematical value is rounded as described below.</p>
<ul>
<li>
<p>The MV of <span class="prod"><span class="nt">StringNumericLiteral</span> <span class="geq">:::</span> <span class="grhsannot">[empty]</span></span> is 0.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StringNumericLiteral</span> <span class="geq">:::</span> <span class="nt">StrWhiteSpace</span></span> is 0.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StringNumericLiteral</span> <span class="geq">:::</span> <span class="nt">StrWhiteSpace</span><sub>opt</sub> <span class="nt">StrNumericLiteral</span> <span class="nt">StrWhiteSpace</span><sub>opt</sub></span> is the MV of <span class="nt">StrNumericLiteral</span>, no
matter whether white space is present or not.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrNumericLiteral</span> <span class="geq">:::</span> <span class="nt">StrDecimalLiteral</span></span> is the MV of <span class="nt">StrDecimalLiteral</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrNumericLiteral</span> <span class="geq">:::</span> <span class="nt">HexIntegerLiteral</span></span> is the MV of <span class="nt">HexIntegerLiteral</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">StrUnsignedDecimalLiteral</span></span> is the MV of <span class="nt">StrUnsignedDecimalLiteral</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrDecimalLiteral</span> <span class="geq">:::</span> <code class="t">+</code> <span class="nt">StrUnsignedDecimalLiteral</span></span> is the MV of <span class="nt">StrUnsignedDecimalLiteral</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrDecimalLiteral</span> <span class="geq">:::</span> <code class="t">-</code> <span class="nt">StrUnsignedDecimalLiteral</span></span> is the negative of the MV of <span class="nt">StrUnsignedDecimalLiteral</span>. (Note that if the MV of <span class="nt">StrUnsignedDecimalLiteral</span> is 0, the negative of this MV is also 0. The rounding rule described
below handles the conversion of this signless mathematical zero to a floating-point <b>+0</b> or <b>−0</b> as
appropriate.)</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">Infinity</span></span> is <span style="font-family: Times New Roman">10<sup>10000</sup></span> (a value
so large that it will round to <b>+∞</b>).</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span> <code class="t">.</code></span> is the MV of <span class="nt">DecimalDigits</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span> <code class="t">.</code> <span class="nt">DecimalDigits</span></span> is the MV of
the first <span class="nt">DecimalDigits</span> plus (the MV of the second <span class="nt">DecimalDigits</span>
times <span style="font-family: Times New Roman">10<sup>−<i>n</i></sup></span>), where <var>n</var> is the
number of characters in the second <span class="nt">DecimalDigits</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span> <code class="t">.</code> <span class="nt">ExponentPart</span></span> is the MV of
<i>DecimalDigits</i> times 10<sup><i>e</i></sup>, where <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span> <code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span></span> is (the MV of the first <i>DecimalDigits</i> plus (the MV of the second
<i>DecimalDigits</i> times 10<sup>−<i>n</i></sup>)) times 10<sup><i>e</i></sup>, where <i>n</i> is the number
of characters in the second <i>DecimalDigits</i> and <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <code class="t">.</code> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i> times
10<sup>−<i>n</i></sup>, where <i>n</i> is the number of characters in <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span></span> is the MV of
<i>DecimalDigits</i> times 10<sup><i>e</i>−<i>n</i></sup>, where <i>n</i> is the number of characters in
<i>DecimalDigits</i> and <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span></span> is the MV of <i>DecimalDigits</i> times
10<sup><i>e</i></sup>, where <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigits</span> <span class="geq">:::</span> <span class="nt">DecimalDigit</span></span> is the MV of <i>DecimalDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigits</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></span> is (the MV of <i>DecimalDigits</i> times
10) plus the MV of <i>DecimalDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">ExponentPart</span> <span class="geq">:::</span> <span class="nt">ExponentIndicator</span> <span class="nt">SignedInteger</span></span> is the MV of
<i>SignedInteger</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">SignedInteger</span> <span class="geq">:::</span> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">SignedInteger</span> <span class="geq">:::</span> <code class="t">+</code> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">SignedInteger</span> <span class="geq">:::</span> <code class="t">-</code> <span class="nt">DecimalDigits</span></span> is the negative of the MV of
<i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">0</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">0</code></span> is 0.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">1</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">1</code></span> is 1.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">2</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">2</code></span> is 2.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">3</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">3</code></span> is 3.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">4</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">4</code></span> is 4.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">5</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">5</code></span> is 5.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">6</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">6</code></span> is 6.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">7</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">7</code></span> is 7.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">8</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">8</code></span> is 8.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <code class="t">9</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">9</code></span> is 9.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span> <code class="t">a</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">A</code></span> is 10.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span> <code class="t">b</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">B</code></span> is 11.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span> <code class="t">c</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">C</code></span> is 12.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span> <code class="t">d</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">D</code></span> is 13.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span> <code class="t">e</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">E</code></span> is 14.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span> <code class="t">f</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">:::</span>
<code class="t">F</code></span> is 15.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexIntegerLiteral</span> <span class="geq">:::</span> <code class="t">0x</code> <span class="nt">HexDigit</span></span> is the MV of <i>HexDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexIntegerLiteral</span> <span class="geq">:::</span> <code class="t">0X</code> <span class="nt">HexDigit</span></span> is the MV of <i>HexDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexIntegerLiteral</span> <span class="geq">:::</span> <span class="nt">HexIntegerLiteral</span> <span class="nt">HexDigit</span></span> is (the MV of <i>HexIntegerLiteral</i>
times 16) plus the MV of <i>HexDigit</i>.</p>
</li>
</ul>
<p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type.
If the MV is 0, then the rounded value is +0 unless the first non white space character in the String numeric literal is
‘<code>-</code>’, in which case the rounded value is −0. Otherwise, the rounded value must be the
Number value for the MV (in the sense defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">6.1.6</a>), unless
the literal includes a <span class="nt">StrUnsignedDecimalLiteral</span> and the literal has more than 20 significant
digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each
significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each
significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is
<i>significant</i> if it is not part of an <span class="nt">ExponentPart</span> and</p>
<ul>
<li>it is not <b>0</b>; or</li>
<li>there is a nonzero digit to its left and there is a nonzero digit, not in the <span class="nt">ExponentPart</span>, to its right.</li>
</ul>
</section>
</section>
</section>
<section id="sec-tointeger">
<h1><span class="secnum" id="sec-7.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger" title="link to this section">7.1.4</a></span>
ToInteger</h1>
<p>The abstract operation ToInteger converts its <var>argument</var> to an integral numeric value. This abstract operation
functions as follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, return <b>+0</b>.</li>
<li>If <i>number</i> is <b>+0</b>, <b>−0</b>, <b>+∞,</b> or <b>−∞</b>, return <i>number</i>.</li>
<li>Return the result of computing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
</ol>
</section>
<section id="sec-toint32">
<h1><span class="secnum" id="sec-7.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32" title="link to this section">7.1.5</a></span> ToInt32:
(Signed 32 Bit Integer)</h1>
<p>The abstract operation ToInt32 converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>32</sup></span> integer values in the range <span style="font-family: Times New
Roman">−2<sup>31</sup></span> through <span style="font-family: Times New Roman">2<sup>31</sup>−1</span>,
inclusive. This abstract operation functions as follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, <b>+0</b>, <b>−0</b>, <b>+∞</b>, or <b>−∞</b>, return
<b>+0</b>.</li>
<li>Let <i>int</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
<li>Let <i>int32bit</i> be <i>int</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 2<sup>32</sup>.</li>
<li>If <i>int32bit</i> ≥ 2<sup>31</sup>, return <i>int32bit</i> − 2<sup>32</sup>, otherwise return
<i>int32bit</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Given the above definition of ToInt32:</p>
<ul>
<li>
<p>The ToInt32 abstract operation is idempotent: if applied to a result that it produced, the second application
leaves that value unchanged.</p>
</li>
<li>
<p><i>ToInt32(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(x))</i> is equal to ToInt32(<i>x</i>) for all values of <i>x</i>.
(It is to preserve this latter property that +<b>∞</b> and −<b>∞</b> are mapped to <b>+0</b>.)</p>
</li>
<li>
<p>ToInt32 maps <b>−0</b> to <b>+0</b>.</p>
</li>
</ul>
</div>
</section>
<section id="sec-touint32">
<h1><span class="secnum" id="sec-7.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32" title="link to this section">7.1.6</a></span> ToUint32:
(Unsigned 32 Bit Integer)</h1>
<p>The abstract operation ToUint32 converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>32</sup></span> integer values in the range <span style="font-family: Times New Roman">0</span> through <span style="font-family: Times New Roman">2<sup>32</sup>−1</span>, inclusive. This abstract operation functions as
follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>)..</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, +0, −0, +<b>∞</b>, or −<b>∞</b>, return <b>+0</b>.</li>
<li>Let <i>int</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
<li>Let <i>int32bit</i> be <i>int</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 2<sup>32</sup>.</li>
<li>Return <i>int32bit</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Given the above definition of ToUint32:</p>
<ul>
<li>
<p>Step 6 is the only difference between ToUint32 and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>.</p>
</li>
<li>
<p>The ToUint32 abstract operation is idempotent: if applied to a result that it produced, the second application
leaves that value unchanged.</p>
</li>
<li>
<p>ToUint32(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<i>x</i>)) is equal to ToUint32(<i>x</i>) for all values of <i>x</i>.
(It is to preserve this latter property that <b>+∞</b> and <b>−∞</b> are mapped to <b>+0</b>.)</p>
</li>
<li>
<p>ToUint32 maps <b>−0</b> to <b>+0</b>.</p>
</li>
</ul>
</div>
</section>
<section id="sec-toint16">
<h1><span class="secnum" id="sec-7.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint16" title="link to this section">7.1.7</a></span> ToInt16:
(Signed 16 Bit Integer)</h1>
<p>The abstract operation ToInt16 converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>16</sup></span> integer values in the range <span style="font-family: Times New Roman">−32768</span>
through <span style="font-family: Times New Roman">32767</span>, inclusive. This abstract operation functions as
follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, <b>+0</b>, <b>−0</b>, <b>+∞</b>, or <b>−∞</b>, return
<b>+0</b>.</li>
<li>Let <i>int</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
<li>Let <i>int16bit</i> be <i>int</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 2<sup>16</sup>.</li>
<li>If <i>int16bit</i> ≥ 2<sup>15</sup>, return <i>int16bit</i> − 2<sup>16</sup>, otherwise return
<i>int16bit</i>.</li>
</ol>
</section>
<section id="sec-touint16">
<h1><span class="secnum" id="sec-7.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16" title="link to this section">7.1.8</a></span> ToUint16:
(Unsigned 16 Bit Integer)</h1>
<p>The abstract operation ToUint16 converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>16</sup></span> integer values in the range <span style="font-family: Times New Roman">0</span> through <span style="font-family: Times New Roman">2<sup>16</sup>−1</span>, inclusive. This abstract operation functions as
follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>)..</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, +0, −0, +<b>∞</b>, or −<b>∞</b>, return <b>+0</b>.</li>
<li>Let <i>int</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
<li>Let <i>int16bit</i> be <i>int</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 2<sup>16</sup>.</li>
<li>Return <i>int16bit</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Given the above definition of ToUint16:</p>
<ul>
<li>The substitution of 2<sup>16</sup> for 2<sup>32</sup> in step 5 is the only difference between <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a> and ToUint16.</li>
<li>ToUint16 maps <b>−0</b> to <span style="font-family: sans-serif"><b>+0</b></span>.</li>
</ul>
</div>
</section>
<section id="sec-toint8">
<h1><span class="secnum" id="sec-7.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8" title="link to this section">7.1.9</a></span> ToInt8: (Signed
8 Bit Integer)</h1>
<p>The abstract operation ToInt8 converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>8</sup></span> integer values in the range <span style="font-family: Times New Roman">−128</span> through
<span style="font-family: Times New Roman">127</span>, inclusive. This abstract operation functions as follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>)..</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, <b>+0</b>, <b>−0</b>, <b>+∞</b>, or <b>−∞</b>, return
<b>+0</b>.</li>
<li>Let <i>int</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
<li>Let <i>int8bit</i> be <i>int</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 2<sup>8</sup>.</li>
<li>If <i>int8bit</i> ≥ 2<sup>7</sup>, return <i>int8bit</i> − 2<sup>8</sup>, otherwise return
<i>int8bit</i>.</li>
</ol>
</section>
<section id="sec-touint8">
<h1><span class="secnum" id="sec-7.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8" title="link to this section">7.1.10</a></span> ToUint8:
(Unsigned 8 Bit Integer)</h1>
<p>The abstract operation ToUint8 converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>8</sup></span> integer values in the range <span style="font-family: Times New Roman">0</span> through <span style="font-family: Times New Roman">255</span>, inclusive. This abstract operation functions as follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>)..</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, +0, −0, +<b>∞</b>, or −<b>∞</b>, return <b>+0</b>.</li>
<li>Let <i>int</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">sign</a>(<i>number</i>) × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>number</i>)).</li>
<li>Let <i>int8bit</i> be <i>int</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 2<sup>8</sup>.</li>
<li>Return <i>int8bit</i>.</li>
</ol>
</section>
<section id="sec-touint8clamp">
<h1><span class="secnum" id="sec-7.1.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp" title="link to this section">7.1.11</a></span>
ToUint8Clamp: (Unsigned 8 Bit Integer, Clamped)</h1>
<p>The abstract operation ToUint8Clamp converts its <var>argument</var> to one of <span style="font-family: Times New
Roman">2<sup>8</sup></span> integer values in the range <span style="font-family: Times New Roman">0</span> through <span style="font-family: Times New Roman">255</span>, inclusive. This abstract operation functions as follows:</p>
<ol class="proc">
<li>Let <i>number</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>)..</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>number</i>).</li>
<li>If <i>number</i> is <b>NaN</b>, return <b>+0</b>.</li>
<li>If <i>number</i> ≤ 0, return <b>+0</b>.</li>
<li>If <i>number</i> &gt; 255, return 255.</li>
<li>Let <i>f</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>number</i>).</li>
<li>If <i>f+0.5</i> ≤ <i>number</i>, then return <i>f</i>+1.</li>
<li>Return <i>f</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Note that unlike the other integer conversion abstract operation, ToUnit8Clamp rounds
rather than truncates non-integer values.</p>
</div>
</section>
<section id="sec-tostring">
<div class="front">
<h1><span class="secnum" id="sec-7.1.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring" title="link to this section">7.1.12</a></span>
ToString</h1>
<p>The abstract operation ToString converts its <i>argument</i> to a value of type String according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-12">Table 12</a>:</p>
<figure>
<figcaption><span id="table-12">Table 12</span> — ToString Conversions</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Argument Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <i>argument</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return <i>argument</i>. Otherwise return ToString(<i>argument</i>.[[value]])</td>
</tr>
<tr>
<td>Undefined</td>
<td><code>"undefined"</code></td>
</tr>
<tr>
<td>Null</td>
<td><code>"null"</code></td>
</tr>
<tr>
<td>Boolean</td>
<td>
<p>If <i>argument</i> is <b>true</b>, then return <code>"true"</code>.</p>
<p>If <i>argument</i> is <b>false</b>, then return <b><span style="font-family: monospace">"false"</span>.</b></p>
</td>
</tr>
<tr>
<td>Number</td>
<td>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring-applied-to-the-number-type">7.1.12.1</a>.</td>
</tr>
<tr>
<td>String</td>
<td>Return <i>argument</i> (no conversion)</td>
</tr>
<tr>
<td>Symbol</td>
<td>Throw a <b>TypeError</b> exception.</td>
</tr>
<tr>
<td>Object</td>
<td>
<p>Apply the following steps:</p>
<p>1. Let <i>primValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>argument</i>, hint String).</p>
<p>2. Return ToString(<i>primValue</i>).</p>
</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-tostring-applied-to-the-number-type">
<h1><span class="secnum" id="sec-7.1.12.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring-applied-to-the-number-type" title="link to this section">7.1.12.1</a></span> ToString Applied to the Number Type</h1>
<p>The abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a> converts a Number <var>m</var> to String format as
follows:</p>
<ol class="proc">
<li>If <i>m</i> is <b>NaN</b>, return the String <code>"NaN"</code>.</li>
<li>If <i>m</i> is <b>+0</b> or <b>−0</b>, return the String <code>"0"</code>.</li>
<li>If <i>m</i> is less than zero, return the String concatenation of the String <code>"-"</code> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(−<i>m</i>).</li>
<li>If <i>m</i> is +∞, return the String <code>"Infinity"</code>.</li>
<li>Otherwise, let <i>n</i>, <i>k</i>, and <i>s</i> be integers such that <i>k</i> ≥ 1, 10<sup><i>k</i>−1</sup>
≤ <i>s</i> &lt; 10<sup><i>k</i></sup>, the Number value for <i>s</i> × 10<sup><i>n−k</i></sup> is
<i>m</i>, and <i>k</i> is as small as possible. Note that <i>k</i> is the number of digits in the decimal
representation of <i>s</i>, that <i>s</i> is not divisible by 10, and that the least significant digit of <i>s</i>
is not necessarily uniquely determined by these criteria.</li>
<li>If <i>k</i> ≤ <i>n</i> ≤ 21, return the String consisting of the <i>k</i> digits of the decimal representation
of <i>s</i> (in order, with no leading zeroes), followed by <i>n−k</i> occurrences of the character
‘<code>0</code>’.</li>
<li>If 0 &lt; <i>n</i> ≤ 21, return the String consisting of the most significant <i>n</i> digits of the decimal
representation of <i>s</i>, followed by a decimal point ‘<code>.</code>’, followed by the remaining
<i>k−n</i> digits of the decimal representation of <i>s</i>.</li>
<li>If −6 &lt; <i>n</i> ≤ 0, return the String consisting of the character ‘<code>0</code>’,
followed by a decimal point ‘<code>.</code>’, followed by −<i>n</i> occurrences of the character
‘<code>0</code>’, followed by the <i>k</i> digits of the decimal representation of <i>s</i>.</li>
<li>Otherwise, if <i>k</i> = 1, return the String consisting of the single digit of <i>s</i>, followed by lowercase
character ‘<code>e</code>’, followed by a plus sign ‘<code>+</code>’ or minus sign
‘<code>−</code>’ according to whether <i>n</i>−1 is positive or negative, followed by the
decimal representation of the integer <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>n</i>−1) (with no
leading zeroes).</li>
<li>Return the String consisting of the most significant digit of the decimal representation of <i>s</i>, followed by a
decimal point ‘.’, followed by the remaining <i>k</i>−1 digits of the decimal representation of
<i>s</i>, followed by the lowercase character ‘<code>e</code>’, followed by a plus sign
‘<code>+</code>’ or minus sign ‘<code>−</code>’ according to whether <i>n</i>−1
is positive or negative, followed by the decimal representation of the integer <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>n</i>−1) (with no leading zeroes).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> The following observations may be useful as guidelines for implementations, but are
not part of the normative requirements of this Standard:</p>
<ul>
<li>
<p>If x is any Number value other than <b>−0</b>, then <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(x)) is exactly the same Number value as x.</p>
</li>
<li>
<p>The least significant digit of s is not always uniquely determined by the requirements listed in step 5.</p>
</li>
</ul>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> For implementations that provide more accurate conversions than required by the rules
above, it is recommended that the following alternative version of step 5 be used as a guideline:</p>
<p>Otherwise, let <i>n</i>, <i>k</i>, and <i>s</i> be integers such that <i>k</i> ≥ 1, 10<sup><i>k</i>−1</sup>
≤ <i>s</i> &lt; 10<sup><i>k</i></sup>, the Number value for <i>s</i> × 10<sup><i>n</i>−<i>k</i></sup> is
<i>m</i>, and <i>k</i> is as small as possible. If there are multiple possibilities for <i>s</i>, choose the value of
<i>s</i> for which <i>s</i> × 10<sup><i>n</i>−<i>k</i></sup> is closest in value to <i>m</i>. If there are
two such possible values of <i>s</i>, choose the one that is even. Note that <i>k</i> is the number of digits in the
decimal representation of <i>s</i> and that <i>s</i> is not divisible by 10.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> Implementers of ECMAScript may find useful the paper and code written by David M. Gay
for binary-to-decimal conversion of floating-point numbers:</p>
<p>Gay, David M. Correctly Rounded Binary-Decimal and Decimal-Binary Conversions. Numerical Analysis, Manuscript 90-10.
AT&amp;T Bell Laboratories (Murray Hill, New Jersey). November 30, 1990. Available as<br><span style="font-family:
sans-serif"><a href="http://cm.bell-labs.com/cm/cs/doc/90/4-10.ps.gz">http://cm.bell-labs.com/cm/cs/doc/90/4-10.ps.gz</a></span>.
Associated code available as<br><span style="font-family: sans-serif"><a href="http://netlib.sandia.gov/fp/dtoa.c">http://netlib.sandia.gov/fp/dtoa.c</a></span>&nbsp;and&nbsp;as<br><span style="font-family: sans-serif"><a href="http://netlib.sandia.gov/fp/g_fmt.c">http://netlib.sandia.gov/fp/g_fmt.c</a></span> and may also be found at the
various <code>netlib</code> mirror sites.</p>
</div>
</section>
</section>
<section id="sec-toobject">
<h1><span class="secnum" id="sec-7.1.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject" title="link to this section">7.1.13</a></span>
ToObject</h1>
<p>The abstract operation ToObject converts its <i>argument</i> to a value of type Object according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-13">Table 13</a>:</p>
<figure>
<figcaption><span id="table-13">Table 13</span> — ToObject Conversions</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Argument Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <i>argument</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return <i>argument</i>. Otherwise return ToObject(<i>argument</i>.[[value]])</td>
</tr>
<tr>
<td>Undefined</td>
<td>Throw a <b>TypeError</b> exception.</td>
</tr>
<tr>
<td>Null</td>
<td>Throw a <b>TypeError</b> exception.</td>
</tr>
<tr>
<td>Boolean</td>
<td>Return a new Boolean object whose [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is set to the value of <i>argument</i>. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-objects">19.3</a> for a description of Boolean objects.</td>
</tr>
<tr>
<td>Number</td>
<td>Return a new Number object whose [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is set to the value of <i>argument</i>. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-objects">20.1</a> for a description of Number objects.</td>
</tr>
<tr>
<td>String</td>
<td>Return a new String object whose [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is set to the value of <i>argument</i>. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-objects">21.1</a> for a description of String objects.</td>
</tr>
<tr>
<td>Symbol</td>
<td>Return a new Symbol object whose [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is set to the value of <i>argument</i>. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects">19.4</a> for a description of Symbol objects.</td>
</tr>
<tr>
<td>Object</td>
<td>Return <i>argument</i> (no conversion).</td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-topropertykey">
<h1><span class="secnum" id="sec-7.1.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey" title="link to this section">7.1.14</a></span>
ToPropertyKey</h1>
<p>The abstract operation ToPropertyKey converts its <var>argument</var> to a value that can be used as a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> by performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argument</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>) is Symbol, then
<ol class="block">
<li>Return <i>argument</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>argument</i>).</li>
</ol>
</section>
<section id="sec-tolength">
<h1><span class="secnum" id="sec-7.1.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength" title="link to this section">7.1.15</a></span>
ToLength</h1>
<p>The abstract operation ToLength converts its <var>argument</var> to an integer suitable for use as the length of an
array-like object. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>argument</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(len).</li>
<li>If <i>len</i> ≤ +0, then return +0.</li>
<li>Return min(<i>len</i>, 2<sup>53</sup>-1).</li>
</ol>
</section>
<section id="sec-canonicalnumericstring">
<h1><span class="secnum" id="sec-7.1.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-canonicalnumericstring" title="link to this section">7.1.16</a></span> CanonicalNumericString(argument)</h1>
<p>The abstract operation CanonicalNumeriString returns its <var>argument</var> converted to a numeric value if it is a
String representation of a Number that would be produced by ToSting. Otherwise, it returns <span class="value">undefined</span> This abstract operation functions as follows:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>) is String.</li>
<li>Let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>argument</i>).</li>
<li>If <i>n</i>=−0, then return +0.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>argument</i>) is
<b>false</b>, then return <b>undefined</b>.</li>
<li>Return <i>n</i>.</li>
</ol>
</section>
</section>
<section id="sec-testing-and-comparison-operations">
<div class="front">
<h1><span class="secnum" id="sec-7.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testing-and-comparison-operations" title="link to this section">7.2</a></span> Testing and Comparison Operations</h1>
</div>
<section id="sec-checkobjectcoercible">
<h1><span class="secnum" id="sec-7.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible" title="link to this section">7.2.1</a></span>
CheckObjectCoercible</h1>
<p>The abstract operation CheckObjectCoercible throws an error if its argument is a value that cannot be converted to an
Object using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>. It is defined by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-14">Table 14</a>:</p>
<figure>
<figcaption><span id="table-14">Table 14</span>&nbsp;— CheckObjectCoercible Results</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Argument Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <i>argument</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return <i>argument</i>. Otherwise return CheckObjectCoercible(<i>argument</i>.[[value]])</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Undefined</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Throw a <b>TypeError</b> exception.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Null</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Throw a <b>TypeError</b> exception.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Boolean</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return <i>argument</i></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Number</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return <i>argument</i></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">String</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return <i>argument</i></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Symbol</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return <i>argument</i></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Object</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return <i>argument</i></td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-iscallable">
<h1><span class="secnum" id="sec-7.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable" title="link to this section">7.2.2</a></span>
IsCallable</h1>
<p>The abstract operation IsCallable determines if its <var>argument</var>, which must be an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> or a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>, is a callable function Object according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-15">Table 15</a>:</p>
<figure>
<figcaption><span id="table-15">Table 15</span> — IsCallable Results</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Argument Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a></td>
<td>If <var>argument</var> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, return <var>argument</var>. Otherwise return IsCallable(<var>argument</var>.[[value]])</td>
</tr>
<tr>
<td>Undefined</td>
<td>Return <b>false</b>.</td>
</tr>
<tr>
<td>Null</td>
<td>Return <b>false</b>.</td>
</tr>
<tr>
<td>Boolean</td>
<td>Return <b>false</b>.</td>
</tr>
<tr>
<td>Number</td>
<td>Return <b>false</b>.</td>
</tr>
<tr>
<td>String</td>
<td>Return <b>false</b>.</td>
</tr>
<tr>
<td>Symbol</td>
<td>Return <b>false</b>.</td>
</tr>
<tr>
<td>Object</td>
<td>If <var>argument</var> has a [[Call]] internal method, then return <b>true</b>, otherwise return <b>false</b>.</td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-samevalue">
<h1><span class="secnum" id="sec-7.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue" title="link to this section">7.2.3</a></span> SameValue(x,
y)</h1>
<p>The internal comparison abstract operation SameValue(<var>x</var>, <var>y</var>), where <var>x</var> and <var>y</var> are
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>, produces <b>true</b> or <b>false</b>. Such a
comparison is performed as follows:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>y</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is different from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>), return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Undefined, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Null, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Number, then
<ol class="block">
<li>If <i>x</i> is NaN and <i>y</i> is NaN, return <b>true</b>.</li>
<li>If <i>x</i> is +0 and <i>y</i> is -0, return <b>false</b>.</li>
<li>If <i>x</i> is -0 and <i>y</i> is +0, return <b>false</b>.</li>
<li>If <i>x</i> is the same Number value as <i>y</i>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is String, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are exactly the same sequence of code units (same length and same code units in
corresponding positions) return <b>true</b>; otherwise, return <b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Boolean, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are both <b>true</b> or both <b>false</b>, then return <b>true</b>; otherwise, return
<b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Symbol, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are both the same Symbol value, then return <b>true</b>; otherwise, return
<b>false</b>.</li>
</ol>
</li>
<li>Return <b>true</b> if <i>x</i> and <i>y</i> are the same Object value. Otherwise, return <b>false</b>.</li>
</ol>
</section>
<section id="sec-samevaluezero">
<h1><span class="secnum" id="sec-7.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero" title="link to this section">7.2.4</a></span>
SameValueZero(x, y)</h1>
<p>The internal comparison abstract operation SameValueZero(<var>x</var>, <var>y</var>), where <var>x</var> and <var>y</var>
are <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>, produces <b>true</b> or <b>false</b>. Such a
comparison is performed as follows:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>y</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is different from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>), return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Undefined, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Null, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Number, then
<ol class="block">
<li>If <i>x</i> is NaN and <i>y</i> is NaN, return <b>true</b>.</li>
<li>If <i>x</i> is +0 and <i>y</i> is -0, return <b>true</b>.</li>
<li>If <i>x</i> is -0 and <i>y</i> is +0, return <b>true</b>.</li>
<li>If <i>x</i> is the same Number value as <i>y</i>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is String, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are exactly the same sequence of code units (same length and same code units in
corresponding positions) return <b>true</b>; otherwise, return <b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Boolean, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are both <b>true</b> or both <b>false</b>, then return <b>true</b>; otherwise, return
<b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Symbol, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are both the same Symbol value, then return <b>true</b>; otherwise, return
<b>false</b>.</li>
</ol>
</li>
<li>Return <b>true</b> if <i>x</i> and <i>y</i> are the same Object value. Otherwise, return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> SameValueZero differs from SameValue only in its treatment of +0 and -0.</p>
</div>
</section>
<section id="sec-isconstructor">
<h1><span class="secnum" id="sec-7.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor" title="link to this section">7.2.5</a></span>
IsConstructor</h1>
<p>The abstract operation IsConstructor determines if its <var>argument</var>, which must be an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> or a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>, is a function object with a [[Construct]] internal
method.</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argument</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>) is not Object, return <b>false</b>.</li>
<li>If <i>argument</i> has a [[Construct]] internal method, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-ispropertykey">
<h1><span class="secnum" id="sec-7.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey" title="link to this section">7.2.6</a></span>
IsPropertyKey</h1>
<p>The abstract operation IsPropertyKey determines if its <var>argument</var>, which must be an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> or a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>, is a value that may be used as a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>.</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argument</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>) is String, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>) is Symbol, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-isextensible-o">
<h1><span class="secnum" id="sec-7.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o" title="link to this section">7.2.7</a></span>
IsExtensible (O)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">IsExtensible</span> is used to determine whether
additional properties can be added to the object that is <var>O</var>. A Boolean value is returned. This abstract operation
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li>Return the result of calling the [[IsExtensible]] internal method of <i>O</i>.</li>
</ol>
</section>
<section id="sec-isinteger">
<h1><span class="secnum" id="sec-7.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger" title="link to this section">7.2.8</a></span>
IsInteger</h1>
<p>The abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a> determines if its <var>argument</var>, is a finite
integer numeric value..</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argument</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>argument</i>) is not Number, return <b>false</b>.</li>
<li>If <i>argument</i> is <b>NaN</b>, <b>+∞</b>, or <b>−∞</b>, return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>argument</i>)) ≠
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>argument</i>), then retun <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-abstract-relational-comparison">
<h1><span class="secnum" id="sec-7.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-relational-comparison" title="link to this section">7.2.9</a></span> Abstract Relational Comparison</h1>
<p>The comparison <var>x</var> &lt; <var>y</var>, where <var>x</var> and <var>y</var> are values, produces <b>true</b>,
<b>false</b>, or <b>undefined</b> (which indicates that at least one operand is <b>NaN</b>). In addition to <var>x</var> and
<var>y</var> the algorithm takes a Boolean flag named <span class="nt">LeftFirst</span> as a parameter. The flag is used to
control the order in which operations with potentially visible side-effects are performed upon <var>x</var> and
<var>y</var>. It is necessary because ECMAScript specifies left to right evaluation of expressions. The default value of
<span class="nt">LeftFirst</span> is <b>true</b> and indicates that the <var>x</var> parameter corresponds to an expression
that occurs to the left of the <var>y</var> parameter’s corresponding expression. If <span class="nt">LeftFirst</span>
is <b>false</b>, the reverse is the case and operations must be performed upon <var>y</var> before <var>x</var>. Such a
comparison is performed as follows:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>y</i>).</li>
<li>If the <i>LeftFirst</i> flag is <b>true</b>, then
<ol class="block">
<li>Let <i>px</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>x</i>, hint Number).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>px</i>).</li>
<li>Let <i>py</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>y</i>, hint Number).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>py</i>).</li>
</ol>
</li>
<li>Else the order of evaluation needs to be reversed to preserve left to right evaluation
<ol class="block">
<li>Let <i>py</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>y</i>, hint Number).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>py</i>).</li>
<li>Let <i>px</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>x</i>, hint Number).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>px</i>).</li>
</ol>
</li>
<li>If both <i>px</i> and <i>py</i> are Strings, then
<ol class="block">
<li>If <i>py</i> is a prefix of <i>px</i>, return <b>false</b>. (A String value <i>p</i> is a prefix of String value
<i>q</i> if <i>q</i> can be the result of concatenating <i>p</i> and some other String <i>r</i>. Note that any
String is a prefix of itself, because <i>r</i> may be the empty String.)</li>
<li>If <i>px</i> is a prefix of <i>py</i>, return <b>true</b>.</li>
<li>Let <i>k</i> be the smallest nonnegative integer such that the character at position <i>k</i> within <i>px</i> is
different from the character at position <i>k</i> within <i>py</i>. (There must be such a <i>k</i>, for neither
String is a prefix of the other.)</li>
<li>Let <i>m</i> be the integer that is the code unit value for the character at position <i>k</i> within
<i>px</i>.</li>
<li>Let <i>n</i> be the integer that is the code unit value for the character at position <i>k</i> within
<i>py</i>.</li>
<li>If <i>m</i> &lt; <i>n</i>, return <b>true</b>. Otherwise, return <b>false</b>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>nx</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>px</i>). Because <i>px</i> and <i>py</i> are primitive
values evaluation order is not important.</li>
<li>Let <i>ny</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>py</i>).</li>
<li>If <i>nx</i> is <b>NaN</b>, return <b>undefined</b>.</li>
<li>If <i>ny</i> is <b>NaN</b>, return <b>undefined</b>.</li>
<li>If <i>nx</i> and <i>ny</i> are the same Number value, return <b>false</b>.</li>
<li>If <i>nx</i> is <b>+0</b> and <i>ny</i> is <b>−0</b>, return <b>false</b>.</li>
<li>If <i>nx</i> is <b>−0</b> and <i>ny</i> is <b>+0</b>, return <b>false</b>.</li>
<li>If <i>nx</i> is <b>+∞</b>, return <b>false</b>.</li>
<li>If <i>ny</i> is <b>+∞</b>, return <b>true</b>.</li>
<li>If <i>ny</i> is <b>−∞</b>, return <b>false</b>.</li>
<li>If <i>nx</i> is <b>−∞</b>, return <b>true</b>.</li>
<li>If the mathematical value of <i>nx</i> is less than the mathematical value of <i>ny</i> —note that these
mathematical values are both finite and not both zero—return <b>true</b>. Otherwise, return
<b>false</b>.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> Step 5 differs from step 11 in the algorithm for the addition operator <code>+</code>
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addition-operator-plus">12.7.3</a>) in using “and” instead of “or”.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The comparison of Strings uses a simple lexicographic ordering on sequences of code unit
values. There is no attempt to use the more complex, semantically oriented definitions of character or string equality and
collating order defined in the Unicode specification. Therefore String values that are canonically equal according to the
Unicode standard could test as unequal. In effect this algorithm assumes that both Strings are already in normalized form.
Also, note that for strings containing supplementary characters, lexicographic ordering on sequences of UTF-16 code unit
values differs from that on sequences of code point values.</p>
</div>
</section>
<section id="sec-abstract-equality-comparison">
<h1><span class="secnum" id="sec-7.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-equality-comparison" title="link to this section">7.2.10</a></span> Abstract Equality Comparison</h1>
<p>The comparison <var>x</var> == <var>y</var>, where <var>x</var> and <var>y</var> are values, produces <b>true</b> or
<b>false</b>. Such a comparison is performed as follows:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is the same as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>), then
<ol class="block">
<li>Return the result of performing Strict Equality Comparison <i>x</i> === <i>y</i>.</li>
</ol>
</li>
<li>If <i>x</i> is <b>null</b> and <i>y</i> is <b>undefined</b>, return <b>true</b>.</li>
<li>If <i>x</i> is <b>undefined</b> and <i>y</i> is <b>null</b>, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Number and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>) is String,<br>return the result of the comparison
<i>x</i> == <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>y</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is String and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>) is Number,<br>return the result of the comparison <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>x</i>) == <i>y</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Boolean, return the result of the comparison
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>x</i>) == <i>y</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>) is Boolean, return the result of the comparison
<i>x</i> == <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>y</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is either String or Number and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>) is Object,<br>return the result of the comparison
<i>x</i> == <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>y</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>) is either String or Number,<br>return the result of
the comparison <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>x</i>) == <i>y</i>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-strict-equality-comparison">
<h1><span class="secnum" id="sec-7.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-equality-comparison" title="link to this section">7.2.11</a></span> Strict Equality Comparison</h1>
<p>The comparison <var>x</var> === <var>y</var>, where <var>x</var> and <var>y</var> are values, produces <b>true</b> or
<b>false</b>. Such a comparison is performed as follows:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is different from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>), return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Undefined, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Null, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Number, then
<ol class="block">
<li>If <i>x</i> is <b>NaN</b>, return <b>false</b>.</li>
<li>If <i>y</i> is <b>NaN</b>, return <b>false</b>.</li>
<li>If <i>x</i> is the same Number value as <i>y</i>, return <b>true</b>.</li>
<li>If <i>x</i> is <b>+0</b> and <i>y</i> is <b>−0</b>, return <b>true</b>.</li>
<li>If <i>x</i> is <b>−0</b> and <i>y</i> is <b>+0</b>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is String, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are exactly the same sequence of characters (same length and same characters in
corresponding positions), return <b>true</b>.</li>
<li>Else, return <b>false</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is Boolean, then
<ol class="block">
<li>If <i>x</i> and <i>y</i> are both <b>true</b> or both <b>false</b>, return <b>true</b>.</li>
<li>Else, return <b>false</b>.</li>
</ol>
</li>
<li>If <i>x</i> and <i>y</i> are the same Symbol value, return <b>true</b>.</li>
<li>If <i>x</i> and <i>y</i> are the same Object value, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This algorithm differs from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">the SameValue Algorithm</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">7.2.3</a>) in its treatment of signed zeroes and NaNs.</p>
</div>
</section>
</section>
<section id="sec-operations-on-objects">
<div class="front">
<h1><span class="secnum" id="sec-7.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-objects" title="link to this section">7.3</a></span>
Operations on Objects</h1>
</div>
<section id="sec-get-o-p">
<h1><span class="secnum" id="sec-7.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p" title="link to this section">7.3.1</a></span> Get (O, P)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">Get</span> is used to retrieve the value of a specific
property of an object. The operation is called with arguments <var>O</var> and <var>P</var> where <var>O</var> is the
object and <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. This abstract operation performs the following
steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Return the result of calling the [[Get]] internal method of <i>O</i> passing <i>P</i> and <i>O</i> as the
arguments.</li>
</ol>
</section>
<section id="sec-put-o-p-v-throw">
<h1><span class="secnum" id="sec-7.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw" title="link to this section">7.3.2</a></span> Put (O,
P, V, Throw)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">Put</span> is used to set the value of a specific
property of an object. The operation is called with arguments <var>O</var>, <var>P</var>, <var>V</var>, and <span class="nt">Throw</span> where <var>O</var> is the object, <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>,
<var>V</var> is the new value for the property and <span class="nt">Throw</span> is a Boolean flag. This abstract operation
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>Throw</i>) is Boolean.</li>
<li>Let <i>success</i> be the result of calling the [[Set]] internal method of <i>O</i> passing <i>P</i>, <i>V</i>, and
<i>O</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>success</i>).</li>
<li>If <i>success</i> is <b>false</b> and <i>Throw</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>success</i>.</li>
</ol>
</section>
<section id="sec-createdataproperty">
<h1><span class="secnum" id="sec-7.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty" title="link to this section">7.3.3</a></span>
CreateDataProperty (O, P, V)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CreateDataProperty</span> is used to create a new own
property of an object. The operation is called with arguments <var>O</var>, <var>P</var>, and <var>V</var> where
<var>O</var> is the object, <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>, and <var>V</var> is the value
for the property. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>newDesc</i> be the PropertyDescriptor{[[Value]]: <i>V</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>true</b>, [[Configurable]]: <b>true</b>}.</li>
<li>Return the result of calling the [[DefineOwnProperty]] internal method of <i>O</i> passing <i>P</i> and <i>newDesc</i>
as arguments.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This abstract operation creates a property whose attributes are set to the same defaults
used for properties created by the ECMAScript language assignment operator. Normally, the property will not already exist.
If it does exist and is not configurable or <b>O</b> is not extensible [[DefineOwnProperty]] will return <b>false</b>.</p>
</div>
</section>
<section id="sec-createdatapropertyorthrow">
<h1><span class="secnum" id="sec-7.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow" title="link to this section">7.3.4</a></span> CreateDataPropertyOrThrow (O, P, V)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CreateDataPropertyOrThrow</span> is used to create a
new own property of an object. It throws a <span class="value">TypeError</span> exception if the requested property update
cannot be performed. The operation is called with arguments <var>O</var>, <var>P</var>, and <var>V</var> where <var>O</var>
is the object, <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>, and <var>V</var> is the value for the
property. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>success</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>O</i>, <i>P</i>, <i>V</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>success</i>).</li>
<li>If <i>success</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>success</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This abstract operation creates a property whose attributes are set to the same defaults
used for properties created by the ECMAScript language assignment operator. Normally, the property will not already exist.
If it does exist and is not configurable or <b>O</b> is not extensible [[DefineOwnProperty]] will return <b>false</b>
<span style="font-family: sans-serif">causing this operation to throw a</span> <b>TypeError</b> <span style="font-family:
sans-serif">exception</span>.</p>
</div>
</section>
<section id="sec-definepropertyorthrow">
<h1><span class="secnum" id="sec-7.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow" title="link to this section">7.3.5</a></span>
DefinePropertyOrThrow (O, P, desc)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">DefinePropertyOrThrow</span> is used to call the
[[DefineOwnProperlty]] internal method of an object in a manner that will throw a <b>TypeError</b> exception if the
requested property update cannot be performed. The operation is called with arguments <var>O</var>, <var>P</var>, and
<var>desc</var> where <var>O</var> is the object, <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>, and
<var>desc</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> for the property. This
abstract operation perform, the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>success</i> be the result of calling the [[DefineOwnProperty]] internal method of <i>O</i> passing <i>P</i>
and <i>desc</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>success</i>).</li>
<li>If <i>success</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>success</i>.</li>
</ol>
</section>
<section id="sec-deletepropertyorthrow">
<h1><span class="secnum" id="sec-7.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow" title="link to this section">7.3.6</a></span>
DeletePropertyOrThrow (O, P)</h1>
<p>The abstract operation DeletePropertyOrThrow is used to remove a specific own property of an object. It throws an
exception if the property is not configurable. The operation is called with arguments <var>O</var> and <var>P</var> where
<var>O</var> is the object and <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. This abstract operation
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>success</i> be the result of calling the [[Delete]] internal method of <i>O</i> passing <i>P</i> as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>success</i>).</li>
<li>If <i>success</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>success</i>.</li>
</ol>
</section>
<section id="sec-getmethod">
<h1><span class="secnum" id="sec-7.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod" title="link to this section">7.3.7</a></span> GetMethod (O,
P)</h1>
<p>The abstract operation GetMethod is used to get the value of a specific property of an object when the value of the
property is expected to be a function. The operation is called with arguments <var>O</var> and <var>P</var> where
<var>O</var> is the object, <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. This abstract operation
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>func</i> be the result of calling the [[Get]] internal method of <i>O</i> passing <i>P</i> and <i>O</i> as the
arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>func</i>).</li>
<li>If <i>func</i> is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>func</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Return <i>func</i>.</li>
</ol>
</section>
<section id="sec-hasproperty">
<h1><span class="secnum" id="sec-7.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty" title="link to this section">7.3.8</a></span> HasProperty
(O, P)</h1>
<p>The abstract operation HasProperty is used to determine whether an object has a property with the specified <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. The property may be either an own or inherited. A Boolean value is returned. The
operation is called with arguments <var>O</var> and <var>P</var> where <var>O</var> is the object and <var>P</var> is the
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Return the result of calling the [[HasProperty]] internal method of <i>O</i> with argument <i>P</i>.</li>
</ol>
</section>
<section id="sec-hasownproperty">
<h1><span class="secnum" id="sec-7.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty" title="link to this section">7.3.9</a></span>
HasOwnProperty (O, P)</h1>
<p>The abstract operation HasOwnProperty is used to determine whether an object has an own property with the specified <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. A Boolean value is returned. The operation is called with arguments <var>O</var>
and <var>P</var> where <var>O</var> is the object and <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. This
abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> passing <i>P</i> as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>If <i>desc</i> is <b>undefined</b>, return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-invoke">
<h1><span class="secnum" id="sec-7.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke" title="link to this section">7.3.10</a></span> Invoke(O,P,
[args])</h1>
<p>The abstract operation <span style="font-family: Times New Roman">Invoke</span> is used to call a method property of an
object. The operation is called with arguments <var>O</var>, <var>P</var> , and optionally <var>args</var> where
<var>O</var> serves as both the lookup point for the property and the <b>this</b> value of the call, <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>, and <var>args</var> is the list of arguments values passed to the method. If
<var>args</var> is not present, an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> is used as its value.
This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>P</i> is a valid <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>.</li>
<li>If <i>args</i> was not passed, then let <i>args</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>func</i> be the result of calling the [[Get]] internal method of <i>obj</i> passing <i>P</i> and <i>O</i> as
the arguments.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>func</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>func</i>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>func</i> passing <i>O</i> as <i>thisArgument</i> and
<i>args</i> as <i>argumentsList</i>.</li>
</ol>
</section>
<section id="sec-setintegritylevel">
<h1><span class="secnum" id="sec-7.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setintegritylevel" title="link to this section">7.3.11</a></span>
SetIntegrityLevel (O, level)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">SetIntegrityLevel</span> is used to fix the set of own
properties of an object. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>level</i> is either "<code>sealed</code>" or
"<code>frozen</code>".</li>
<li>Let <i>keys</i> be the result of calling the [[OwnPropertyKeys]] internal method of <i>O</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).</li>
<li>Let <i>pendingException</i> be <b>undefined</b>.</li>
<li>If <i>level</i> is "<code>sealed</code>", then
<ol class="block">
<li>Repeat for each element <i>k</i> of <i>keys</i>,
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O</i>, <i>k</i>,
PropertyDescriptor{ [[Configurable]]: <b>false</b>}).</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <i>pendingException</i> is <b>undefined</b>, then set <i>pendingException</i> to <i>status</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Else <i>level</i> is "<code>frozen</code>",
<ol class="block">
<li>Repeat for each element <i>k</i> of <i>keys</i>,
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with
<i>k</i>.</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <i>pendingException</i> is <b>undefined</b>, then set <i>pendingException</i> to <i>status</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>currentDesc</i> be <i>status</i>.[[value]].</li>
<li>If <i>currentDesc</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>currentDesc</i>) is <b>true</b>,
then
<ol class="block">
<li>Let <i>desc</i> be the PropertyDescriptor{[[Configurable]]: <b>false</b>}.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>desc</i> be the PropertyDescriptor { [[Configurable]]: <b>false</b>, [[Writable]]:
<b>false</b> }.</li>
</ol>
</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O</i>,
<i>k</i>, <i>desc</i>).</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <i>pendingException</i> is <b>undefined</b>, then set <i>pendingException</i> to
<i>status</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>pendingException</i> is not <b>undefined</b>, then return <i>pendingException</i>.</li>
<li>Return the result of calling the [[PreventExtensions]] internal method of <i>O</i>.</li>
</ol>
</section>
<section id="sec-testintegritylevel">
<h1><span class="secnum" id="sec-7.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testintegritylevel" title="link to this section">7.3.12</a></span>
TestIntegrityLevel (O, level)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">TestIntegrityLevel</span> is used to determine if the
set of own properties of an object are fixed. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is
Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>level</i> is either "<code>sealed</code>" or
"<code>frozen</code>".</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>true</b>, then return <b>false</b></li>
<li>NOTE If the object is extensible, none of its properties are examined.</li>
<li>Let <i>keys</i> be the result of calling the [[OwnPropertyKeys]] internal method of <i>O</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).</li>
<li>Let <i>pendingException</i> be <b>undefined</b>.</li>
<li>Let <i>configurable</i> be <b>false</b>.</li>
<li>Let <i>writable</i> be <b>false</b>.</li>
<li>Repeat for each element <i>k</i> of <i>keys</i>,
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with <i>k</i>.</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <i>pendingException</i> is <b>undefined</b>, then set <i>pendingException</i> to <i>status</i>.</li>
<li>Let <i>configurable</i> be <b>true</b>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>currentDesc</i> be <i>status</i>.[[value]].</li>
<li>If <i>currentDesc</i> is not <b>undefined</b>, then
<ol class="block">
<li>Set <i>configurable</i> to <i>configurable</i> logically ored with
<i>currentDesc</i>.[[Configurable]].</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>currentDesc</i>) is <b>true</b>, then
<ol class="block">
<li>Set <i>writable</i> to <i>writable</i> logically ored with <i>currentDesc</i>.[[Writable]].</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>pendingException</i> is not <b>undefined</b>, then return <i>pendingException</i>.</li>
<li>If <i>level</i> is "<code>frozen</code>" and <i>writable</i> is <b>true</b>, then return <b>false</b>.</li>
<li>If <i>configurable</i> is <b>true</b>, then return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-createarrayfromlist">
<h1><span class="secnum" id="sec-7.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist" title="link to this section">7.3.13</a></span>
CreateArrayFromList (elements)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CreateArrayFromList</span> is used to create an Array
object whose elements are provided by a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>. This abstract operation
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>elements</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements are all <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>.</li>
<li>Let <i>array</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0) (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">see 9.4.2.2</a>).</li>
<li>Let <i>n</i> be 0.</li>
<li>For each element <i>e</i> of <i>elements</i>
<ol class="block">
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>array</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>e</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is <b>true</b>.</li>
<li>Increment <i>n</i> by 1.</li>
</ol>
</li>
<li>Return <i>array</i>.</li>
</ol>
</section>
<section id="sec-createlistfromarraylike">
<h1><span class="secnum" id="sec-7.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistfromarraylike" title="link to this section">7.3.14</a></span> CreateListFromArrayLike (obj)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CreateListFromArrayLike</span> is used to create a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> value whose elements are provided by the indexed properties of an
array-like object. This abstract operation performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>obj</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <code>"length"</code>).</li>
<li>Let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>Let <i>list</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>index</i> be 0.</li>
<li>Repeat while <i>index</i> &lt; <i>n</i>
<ol class="block">
<li>Let <i>indexName</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>).</li>
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>indexName</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Append <i>next</i> as the last element of <i>list</i>.</li>
<li>Set <i>index</i> to <i>index</i> + 1.</li>
</ol>
</li>
<li>Return <i>list</i>.</li>
</ol>
</section>
<section id="sec-ordinaryhasinstance">
<h1><span class="secnum" id="sec-7.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinaryhasinstance" title="link to this section">7.3.15</a></span>
OrdinaryHasInstance (C, O)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">OrdinaryHasInstance</span> implements the default
algorithm for determining if an object <var>O</var> inherits from the instance object inheritance path provided by
constructor <var>C</var>. This abstract operation performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>C</i>) is <b>false</b>, return <b>false</b>.</li>
<li>If <i>C</i> has a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundTargetFunction]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>BC</i> be the value of <i>C’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundTargetFunction]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instanceofoperator">InstanceofOperator</a>(<i>O</i>,<i>BC</i>) (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instanceofoperator">see 12.9.4</a>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <b>false</b>.</li>
<li>Let <i>P</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>C</i>, <code>"prototype"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>P</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>Repeat
<ol class="block">
<li>Set <i>O</i> to the result of calling the [[GetPrototypeOf]] internal method of <i>O</i> with no arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>If <i>O</i> is <code>null</code>, return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>P</i>, <i>O</i>) is <b>true</b>, return <b>true</b>.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-getprototypefromconstructor">
<h1><span class="secnum" id="sec-7.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor" title="link to this section">7.3.16</a></span> GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )</h1>
<p>The abstract operation <span style="font-family: Times New Roman">GetPrototypeFromConstructor</span> determines the
[[Prototype]] value that should be used to create an object corresponding to a specific constructor. The value is retrieved
from the constructor’s <code>prototype</code> property, if it exists. Otherwise the supplied default is used for
[[Prototype]]. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>intrinsicDefaultProto</i> is a string value that is this
specification’s name of an intrinsic object. The corresponding object must be an intrinsic that is intended to
be used as the [[Prototype]] value of an object.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a> (<i>constructor</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>constructor</i>, <code>"prototype"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>proto</i>) is not Object, then</li>
<li>If <i>constructor</i> has a [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, let
<i>realm</i> be <i>constructor’s</i> [[Realm]].</li>
<li>Else,
<ol class="block">
<li>Let <i>ctx</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>realm</i> be <i>ctx’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
</ol>
</li>
<li>Let <i>proto</i> be <i>realm’s</i> intrinsic object named <i>intrinsicDefaultProto</i>.</li>
<li>Return <i>proto</i>.</li>
<li>NOTE If <i>constructor</i> does not supply a [[Prototype]] value, the default value that is used is obtained from
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Code Realm</a> of the <i>constructor</i> function rather than from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>. This accounts for the possibility that a built-in
@@create method from a different <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Code Realm</a> might be installed on
<i>constructor</i>.</li>
</ol>
</section>
<section id="sec-createfromconstructor">
<h1><span class="secnum" id="sec-7.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor" title="link to this section">7.3.17</a></span>
CreateFromConstructor (F)</h1>
<p>When the abstract operation CreateFromConstructor is called with Object <var>F</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>creator</i> be GeMethodt(<i>F</i>, @@create).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>creator</i>).</li>
<li>If <i>creator</i> is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>Let <i>obj</i> be the result of calling the [[Call]] internal method of <i>creator</i> with arguments <i>F</i> and an
empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>obj</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Return <i>obj</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This operation is equivalent to: <code>F[Symbol.create]()</code><span style="font-family:
sans-serif">followed by an error check.</span></p>
</div>
</section>
<section id="sec-construct-f-argumentslist">
<h1><span class="secnum" id="sec-7.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist" title="link to this section">7.3.18</a></span> Construct (F, argumentsList)</h1>
<p>When the abstract operation Construct is called with Object <var>F</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <var>argumentsList</var> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>F</i>) is
Object.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor">CreateFromConstructor</a>(<i>F</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>If <i>obj</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%ObjectPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>obj</i>) is Object.</li>
</ol>
</li>
<li>Let <i>result</i> be the result of calling the [[Call]] internal method of <i>F</i>, providing <i>obj</i> and
<i>argumentsList</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>result</i>) is Object then return <i>result</i>.</li>
<li>Return <i>obj</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This operation is equivalent to: <code>new F(...argumentsList</code></p>
</div>
</section>
<section id="sec-getoption">
<h1><span class="secnum" id="sec-7.3.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption" title="link to this section">7.3.19</a></span> GetOption
(options, P)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">GetOption</span> is used to retrieve the value of a
specific property of an object in situation where the object may not be present. The operation is called with arguments
<var>options</var> and <var>P</var> where <var>options</var> is the object and <var>P</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>If <i>options</i> is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>options</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return the result of calling the [[Get]] internal method of <i>options</i> passing <i>P</i> and <i>options</i> as the
arguments.</li>
</ol>
</section>
</section>
<section id="sec-operations-on-iterator-objects">
<div class="front">
<h1><span class="secnum" id="sec-7.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects" title="link to this section">7.4</a></span> Operations on Iterator Objects</h1>
<p>See Commmon Iteration Interfaces(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-common-iteration-interfaces">25.1</a>).</p>
</div>
<section id="sec-getiterator">
<h1><span class="secnum" id="sec-7.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator" title="link to this section">7.4.1</a></span> GetIterator
( obj, method )</h1>
<p>The abstract operation GetIterator with argument <span style="font-family: Times New Roman"><i>obj</i> and</span>
optional argument <var>method</var> performs the following steps:</p>
<ol class="proc">
<li>If <i>method</i> was not passed, then
<ol class="block">
<li>Let <i>method</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isiterable">IsIterable</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>method</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>method</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.<i>.</i></li>
</ol>
</li>
<li>Let <i>iterator</i> be the result of calling the [[Call]] internal method of <i>method</i> with <i>obj</i> as
<i>thisArgument</i> and.and an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as
<i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>)<i>.</i></li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>iterator</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-isiterable">
<h1><span class="secnum" id="sec-7.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isiterable" title="link to this section">7.4.2</a></span> IsIterable (
obj )</h1>
<p>The abstract operation IsIterable with argument <var>obj</var> performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>obj</i>) is not Object, then return
<b>undefined</b>.</li>
<li>Let <i>iteratorGetter</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, @@Iterator).</li>
<li>Return <i>iteratorGetter</i>.</li>
</ol>
</section>
<section id="sec-iteratornext">
<h1><span class="secnum" id="sec-7.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratornext" title="link to this section">7.4.3</a></span>
IteratorNext ( iterator, value )</h1>
<p>The abstract operation IteratorNext with argument <var>iterator</var> and optional argument <var>value</var> performs the
following steps:</p>
<ol class="proc">
<li>If <i>value</i> was not passed, let <i>value</i> be <b>undefined</b>.
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>iterator</i>, <code>"next"</code>, ( )).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>iterator</i>, <code>"next"</code>, (<i>value</i>)).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>result</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
<section id="sec-iteratorcomplete">
<h1><span class="secnum" id="sec-7.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorcomplete" title="link to this section">7.4.4</a></span>
IteratorComplete ( iterResult )</h1>
<p>The abstract operation IteratorComplete with argument <var>iterResult</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>iterResult</i>) is Object.</li>
<li>Let <i>done</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>iterResult</i>, <code>"done"</code>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>done</i>).</li>
</ol>
</section>
<section id="sec-iteratorvalue">
<h1><span class="secnum" id="sec-7.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue" title="link to this section">7.4.5</a></span>
IteratorValue ( iterResult )</h1>
<p>The abstract operation IteratorValue with argument <var>iterResult</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>iterResult</i>) is Object.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>iterResult</i>, <code>"value"</code>).</li>
</ol>
</section>
<section id="sec-iteratorstep">
<h1><span class="secnum" id="sec-7.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep" title="link to this section">7.4.6</a></span>
IteratorStep ( iterator)</h1>
<p>The abstract operation IteratorStep with argument <var>iterator</var> requests the next value from <var>iterator</var>
and returns either <span class="value">false</span> indicating that the iterator has reached its end or the IteratorResult
object if a next value is available. IteratorStep performs the following steps:</p>
<ol class="proc">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratornext">IteratorNext</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>Let <i>done</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorcomplete">IteratorComplete</a>(<i>result</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>done</i>).</li>
<li>If <i>done</i> is <b>true</b>, then return <b>false</b>.</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
<section id="sec-createiterresultobject">
<h1><span class="secnum" id="sec-7.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject" title="link to this section">7.4.7</a></span>
CreateIterResultObject (value, done)</h1>
<p>The abstract operation CreateIterResultObject with arguments <var>value</var> and <var>done</var> creates an object that
supports the IteratorResult interface by performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>done</i>)
is Boolean.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%ObjectPrototype%</span>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>obj</i>, <code>"value"</code>, <i>value</i>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>obj</i>, <code>"done"</code>, <i>done</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
<section id="sec-createlistiterator">
<div class="front">
<h1><span class="secnum" id="sec-7.4.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistiterator" title="link to this section">7.4.8</a></span>
CreateListIterator (list)</h1>
<p>The abstract operation CreateListIterator with argument <var>list</var> creates an Iterator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface">25.1.2</a>) object whose next method returns the successive elements of <var>list</var>. It
performs the following steps:</p>
<ol class="proc">
<li>Let <i>iterator</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%,
([[IteratedList]], [[ListIteratorNextIndex]])).</li>
<li>Set <i>iterator’s</i> [[IteratedList]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>list</i>.</li>
<li>Set <i>iterator’s</i> [[ListIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to 0.</li>
<li>Define ListIterator <code>next</code> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-listiterator-next">7.4.8.1</a>) as an own property of
<i>iterator</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</div>
<section id="sec-listiterator-next">
<h1><span class="secnum" id="sec-7.4.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-listiterator-next" title="link to this section">7.4.8.1</a></span>
ListIterator next( )</h1>
<p>The ListIterator <code>next</code> method is a standard built-in function object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects">clause 17</a>) that performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <i>O</i> does not have a [[IteratedList]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>list</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is value of the
[[IteratedList] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>index</i> be the value of the [[ListIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>lenValue</i> be the number of elements of <i>list</i>.</li>
<li>If <i>index</i> ≥ <i>len</i>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
</ol>
</li>
<li>Set the value of the [[ListIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>O</i> to <i>index</i>+1.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>list</i>[<i>index</i>],
<b>false</b>).</li>
</ol>
</section>
</section>
<section id="sec-createemptyiterator">
<h1><span class="secnum" id="sec-7.4.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createemptyiterator" title="link to this section">7.4.9</a></span>
CreateEmptyIterator ( )</h1>
<p>The abstract operation CreateEmptyIterator with no arguments creates an Iterator object whose next method always reports
that the iterator is done. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>empty</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> with no elements.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistiterator">CreateListIterator</a>(<i>empty</i>).</li>
</ol>
</section>
</section>
<section id="sec-operations-on-promise-objects">
<div class="front">
<h1><span class="secnum" id="sec-7.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-promise-objects" title="link to this section">7.5</a></span> Operations on Promise Objects</h1>
<p>Promise Objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects">25.4</a>) serve as a place holder for the eventual result of a deferred
(and possibly asynchronous) computation.</p>
<p>Within this specification the adjective “eventual” mean a value or a Promise object that will ultimately
resolves to the value. For example, “Returns an eventual String” is equivalent to “Returns either a
String or a Promise object that will eventually resolves to a String”. A “resolved value” is the final
value of an “eventual value”.</p>
<div class="note">
<p><span class="nh">NOTE</span> The Promise related abstract operations defined in this subclause are used by
specification algorithms when they perform or respond to asynchronous operations. They ensure that the actual built-in
Promise operations are used by the algorithms, even if ECMAScript code has modified the properties of %Promise% or
%PromisePrototype%.</p>
</div>
</div>
<section id="sec-promisenew-executor-abstaction-operation">
<h1><span class="secnum" id="sec-7.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisenew-executor-abstaction-operation" title="link to this section">7.5.1</a></span> PromiseNew ( executor ) Abstaction Operation</h1>
<p>The abstract operation PromiseNew allocates and initilizes a new <var>promise</var> object for use by specification
algorithm. The <var>executor</var> argument initiates the deferred computation.</p>
<ol class="proc">
<li>Let <i>promise</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatepromise">AllocatePromise</a>(%Promise%).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializepromise">InitializePromise</a>(<i>promise</i>, <i>executor</i>).</li>
</ol>
</section>
<section id="sec-promisebuiltincapability-abstaction-operation">
<h1><span class="secnum" id="sec-7.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisebuiltincapability-abstaction-operation" title="link to this section">7.5.2</a></span> PromiseBuiltinCapability () Abstaction Operation</h1>
<p>The abstract operation PromiseNewCapability allocates a PromiseCapability record (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisecapability-records">25.4.1.1</a>) for a builtin <var>promise</var> object for use by specification
algorithm.</p>
<ol class="proc">
<li>Let <i>promise</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatepromise">AllocatePromise</a>(%Promise%).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createpromisecapabilityrecord">CreatePromiseCapabilityRecord</a>(<i>promise</i>, %Promise%).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This abstract operation is the same as the default built-in behavior of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a> abstraction operation (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-fulfillpromise">25.4.1.4</a>).</p>
</div>
</section>
<section id="sec-promiseof-value-abstaction-operation">
<h1><span class="secnum" id="sec-7.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseof-value-abstaction-operation" title="link to this section">7.5.3</a></span> PromiseOf (value) Abstaction Operation</h1>
<p>The abstract operation PromiseOf returns a new Promise that resolves to the argument <var>value</var>.</p>
<ol class="proc">
<li>Let <i>capability</i> be PromiseNewCapability( ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>capability</i>).</li>
<li>Let <i>resolveResult</i> be the result of calling the [[Call]] internal method of <i>capability</i>.[[Resolve]] with
<b>undefined</b> as <i>thisArgument</i> and (<i>value</i>) as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>resolveResult</i>).</li>
<li>Return <i>capability</i>.[[Promise]].</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This abstract operation is the same as the default built-in behavior of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.resolve">Promise.resolve</a> method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.resolve">25.4.4.5</a>).</p>
</div>
</section>
<section id="sec-promiseall-promiselist-abstaction-operation">
<h1><span class="secnum" id="sec-7.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseall-promiselist-abstaction-operation" title="link to this section">7.5.4</a></span> PromiseAll (promiseList) Abstaction Operation</h1>
</section>
<section id="sec-promisecatch-promise-rejectedaction-abstaction-operation">
<h1><span class="secnum" id="sec-7.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisecatch-promise-rejectedaction-abstaction-operation" title="link to this section">7.5.5</a></span> PromiseCatch (promise, rejectedAction) Abstaction Operation</h1>
</section>
<section id="sec-promisethen-promise-resolvedaction-rejectedaction-abstaction-operation">
<h1><span class="secnum" id="sec-7.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisethen-promise-resolvedaction-rejectedaction-abstaction-operation" title="link to this section">7.5.6</a></span> PromiseThen (promise, resolvedAction, rejectedAction) Abstaction
Operation</h1>
</section>
</section>
</section>
<section id="sec-executable-code-and-execution-contexts">
<div class="front">
<h1><span class="secnum" id="sec-8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-executable-code-and-execution-contexts" title="link to this section">8</a></span> Executable Code and Execution Contexts</h1>
</div>
<section id="sec-lexical-environments">
<div class="front">
<h1><span class="secnum" id="sec-8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments" title="link to this section">8.1</a></span>
Lexical Environments</h1>
<p>A <i>Lexical Environment</i> is a specification type used to define the association of <span class="nt">Identifiers</span> to specific variables and functions based upon the lexical nesting structure of ECMAScript
code. A Lexical Environment consists of an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> and a possibly null
reference to an <i>outer</i> Lexical Environment. Usually a Lexical Environment is associated with some specific syntactic
structure of ECMAScript code such as a <span class="nt">FunctionDeclaration</span>, a <span class="nt">BlockStatement</span>, or a <span class="nt">Catch</span> clause of a <span class="nt">TryStatement</span> and a
new Lexical Environment is created each time such code is evaluated.</p>
<p>An <i><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a></i> records the identifier bindings that are created
within the scope of its associated Lexical Environment.</p>
<p>The outer environment reference is used to model the logical nesting of Lexical Environment values. The outer reference
of a (inner) Lexical Environment is a reference to the Lexical Environment that logically surrounds the inner Lexical
Environment. An outer Lexical Environment may, of course, have its own outer Lexical Environment. A Lexical Environment may
serve as the outer environment for multiple inner Lexical Environments. For example, if a <span class="nt">FunctionDeclaration</span> contains two nested <span class="nt">FunctionDeclarations</span> then the Lexical
Environments of each of the nested functions will have as their outer Lexical Environment the Lexical Environment of the
current evaluation of the surrounding function.</p>
<p>A <i>global environment</i> is a Lexical Environment which does not have an outer environment. The global
environment’s outer environment reference is <b>null</b>. A global environment’s environment record may be
prepopulated with identifier bindings and includes an associated <i>global object</i> whose properties provide some of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment</a>’s identifier bindings. This global object is the
value of a global environment’s <code>this</code> binding. As ECMAScript code is executed, additional properties may
be added to the global object and the initial properties may be modified.</p>
<p>A method environment is a Lexical Environment that corresponds to the invocation of an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> that establishes a new <code>this</code> binding. A
method environment also captures the state necessary to support <code>super</code> method invocations.</p>
<p>Lexical Environments and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> values are purely specification
mechanisms and need not correspond to any specific artefact of an ECMAScript implementation. It is impossible for an
ECMAScript program to directly access or manipulate such values.</p>
</div>
<section id="sec-environment-records">
<div class="front">
<h1><span class="secnum" id="sec-8.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records" title="link to this section">8.1.1</a></span>
Environment Records</h1>
<p>There are two primary kinds of Environment Record values used in this specification: <i>declarative environment
records</i> and <i>object environment records</i>. Declarative environment records are used to define the effect of
ECMAScript language syntactic elements such as <span class="nt">FunctionDeclarations</span>, <span class="nt">VariableDeclarations</span>, and <span class="nt">Catch</span> clauses that directly associate identifier
bindings with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. Object environment records are used
to define the effect of ECMAScript elements such as <span class="nt">WithStatement</span> that associate identifier
bindings with the properties of some object. <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">Global Environment Records</a> and
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records">Function Environment Records</a> are specializations that are used for
specifically for <span class="nt">Script</span> global declarations and for top-level declarations within functions.</p>
<p>For specification purposes Environment Record values can be thought of as existing in a simple object-oriented
hierarchy where Environment Record is an abstract class with three concrete subclasses, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">global
environment record</a>. Function environment records are a subclass of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a>. The abstract class includes the abstract
specification methods defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-16">Table 16</a>. These abstract methods have distinct concrete
algorithms for each of the concrete subclasses.</p>
<figure>
<figcaption><span id="table-16">Table 16</span> — Abstract Methods of Environment Records</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Method</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">HasBinding(N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Determine if an environment record has a binding for an identifier. Return <b>true</b> if it does and <b>false</b> if it does not. The String value <var>N</var> is the text of the identifier.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">CreateMutableBinding(N, D)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Create a new but uninitialized mutable binding in an environment record. The String value <var>N</var> is the text of the bound name. If the optional Boolean argument <var>D</var> is <b>true</b> the binding is may be subsequently deleted.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">CreateImmutableBinding(N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Create a new but uninitialized immutable binding in an environment record. The String value N is the text of the bound name.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">InitializeBinding(N,V)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Set the value of an already existing but uninitialized binding in an environment record. The String value N is the text of the bound name. V is the value for the binding and is a value of any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language type</a>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">SetMutableBinding(N,V, S)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Set the value of an already existing mutable binding in an environment record. The String value <var>N</var> is the text of the bound name. <var>V</var> is the value for the binding and may be a value of any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language type</a>. <var>S</var> is a Boolean flag. If <var>S</var> is <b>true</b> and the binding cannot be set throw a <b>TypeError</b> exception. <var>S</var> is used to identify strict mode references.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">GetBindingValue(N,S)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Returns the value of an already existing binding from an environment record. The String value <var>N</var> is the text of the bound name. <var>S</var> is used to identify strict mode references. If <var>S</var> is <b>true</b> and the binding does not exist or is uninitialized throw a <b>ReferenceError</b> exception.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">DeleteBinding(N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Delete a binding from an environment record. The String value <var>N</var> is the text of the bound name If a binding for <var>N</var> exists, remove the binding and return <b>true</b>. If the binding exists but cannot be removed return <b>false</b>. If the binding does not exist return <b>true</b>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">HasThisBinding()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Determine if an environment record establishes a <code>this</code> binding. Return <b>true</b> if it does and <b>false</b> if it does not.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">HasSuperBinding()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Determine if an environment record establishes a <code>super</code> method binding. Return <b>true</b> if it does and <b>false</b> if it does not.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">WithBaseObject ()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">If this environment record is associated with a <code>with</code> statement, return the with object. Otherwise, return <span class="value">undefined</span>.</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-declarative-environment-records">
<div class="front">
<h1><span class="secnum" id="sec-8.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records" title="link to this section">8.1.1.1</a></span> Declarative Environment Records</h1>
<p>Each declarative environment record is associated with an ECMAScript program scope containing variable, constant,
let, class, module, import, and/or function declarations. A declarative environment record binds the set of identifiers
defined by the declarations contained within its scope.</p>
<p>The behaviour of the concrete specification methods for Declarative Environment Records is defined by the following
algorithms.</p>
</div>
<section id="sec-declarative-environment-records-hasbinding-n">
<h1><span class="secnum" id="sec-8.1.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-hasbinding-n" title="link to this section">8.1.1.1.1</a></span> HasBinding(N)</h1>
<p>The concrete environment record method HasBinding for declarative environment records simply determines if the
argument identifier is one of the identifiers bound by the record:</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>If <i>envRec</i> has a binding for the name that is the value of <i>N</i>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-declarative-environment-records-createmutablebinding-n-d">
<h1><span class="secnum" id="sec-8.1.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-createmutablebinding-n-d" title="link to this section">8.1.1.1.2</a></span> CreateMutableBinding (N, D)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateMutableBinding for declarative
environment records creates a new mutable binding for the name <var>N</var> that is uninitialized. A binding must not
already exist in this <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> for <var>N</var>. If Boolean argument
<var>D</var> is provided and has the value <b>true</b> the new binding is marked as being subject to deletion.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>envRec</i> does not already have a binding for <i>N</i>.</li>
<li>Create a mutable binding in <i>envRec</i> for <i>N</i> and record that it is uninitialized. If <i>D</i> is
<b>true</b> record that the newly created binding may be deleted by a subsequent DeleteBinding call.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
</section>
<section id="sec-declarative-environment-records-createimmutablebinding-n">
<h1><span class="secnum" id="sec-8.1.1.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-createimmutablebinding-n" title="link to this section">8.1.1.1.3</a></span> CreateImmutableBinding (N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateImmutableBinding for declarative
environment records creates a new immutable binding for the name <var>N</var> that is uninitialized. A binding must not
already exist in this environment record for <var>N</var>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>envRec</i> does not already have a binding for <i>N</i>.</li>
<li>Create an immutable binding in <i>envRec</i> for <i>N</i> and record that it is uninitialized.</li>
</ol>
</section>
<section id="sec-declarative-environment-records-initializebinding-n-v">
<h1><span class="secnum" id="sec-8.1.1.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-initializebinding-n-v" title="link to this section">8.1.1.1.4</a></span> InitializeBinding (N,V)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method InitializeBinding for declarative
environment records is used to set the bound value of the current binding of the identifier whose name is the value of
the argument <var>N</var> to the value of argument <var>V</var>. An uninitialized binding for <var>N</var> must already
exist.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>envRec</i> must have an uninitialized binding for
<i>N</i>.</li>
<li>Set the bound value for <i>N</i> in <i>envRec</i> to <i>V</i>.</li>
<li>Record that the binding for <i>N</i> in <i>envRec</i> has been initialized.</li>
</ol>
</section>
<section id="sec-declarative-environment-records-setmutablebinding-n-v-s">
<h1><span class="secnum" id="sec-8.1.1.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-setmutablebinding-n-v-s" title="link to this section">8.1.1.1.5</a></span> SetMutableBinding (N,V,S)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method SetMutableBinding for declarative
environment records attempts to change the bound value of the current binding of the identifier whose name is the value
of the argument <var>N</var> to the value of argument <var>V</var>. A binding for <var>N</var> must already exist. If
the binding is an immutable binding, a <b>TypeError</b> is thrown if <span style="font-family: Times New Roman">S</span>
is <span class="value">true</span>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>envRec</i> must have a binding for <i>N</i>.</li>
<li>If the binding for <i>N</i> in <i>envRec</i> has not yet been initialized throw a <b>ReferenceError</b>
exception.</li>
<li>Else if the binding for <i>N</i> in <i>envRec</i> is a mutable binding, change its bound value to <i>V</i>.</li>
<li>Else this must be an attempt to change the value of an immutable binding so if <i>S</i> is <b>true</b> throw a
<b>TypeError</b> exception.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
</section>
<section id="sec-declarative-environment-records-getbindingvalue-n-s">
<h1><span class="secnum" id="sec-8.1.1.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-getbindingvalue-n-s" title="link to this section">8.1.1.1.6</a></span> GetBindingValue(N,S)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method GetBindingValue for declarative
environment records simply returns the value of its bound identifier whose name is the value of the argument
<var>N</var>. The binding must already exist. If <var>S</var> is <b>true</b> and the binding is an uninitialized
immutable binding throw a <b>ReferenceError</b> exception.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>envRec</i> has a binding for <i>N</i>.</li>
<li>If the binding for <i>N</i> in <i>envRec</i> is an uninitialized binding, then
<ol class="block">
<li>If <i>S</i> is <b>false</b>, return the value <b>undefined</b>, otherwise throw a <b>ReferenceError</b>
exception.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Return the value currently bound to <i>N</i> in <i>envRec</i>.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-declarative-environment-records-deletebinding-n">
<h1><span class="secnum" id="sec-8.1.1.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-deletebinding-n" title="link to this section">8.1.1.1.7</a></span> DeleteBinding (N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method DeleteBinding for declarative
environment records can only delete bindings that have been explicitly designated as being subject to deletion.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>If <i>envRec</i> does not have a binding for the name that is the value of <i>N</i>, return <b>true</b>.</li>
<li>If the binding for <i>N</i> in <i>envRec</i> cannot be deleted, return <b>false</b>.</li>
<li>Remove the binding for <i>N</i> from <i>envRec</i>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-declarative-environment-records-hasthisbinding">
<h1><span class="secnum" id="sec-8.1.1.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-hasthisbinding" title="link to this section">8.1.1.1.8</a></span> HasThisBinding ()</h1>
<p>Regular Declarative Environment Records do not provide a <code>this</code> binding.</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-declarative-environment-records-hassuperbinding">
<h1><span class="secnum" id="sec-8.1.1.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-hassuperbinding" title="link to this section">8.1.1.1.9</a></span> HasSuperBinding ()</h1>
<p>Regular Declarative Environment Records do not provide a <code>super</code> binding.</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-declarative-environment-records-withbaseobject">
<h1><span class="secnum" id="sec-8.1.1.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records-withbaseobject" title="link to this section">8.1.1.1.10</a></span> WithBaseObject()</h1>
<p>Declarative Environment Records always return <b>undefined</b> as their WithBaseObject.</p>
<ol class="proc">
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
<section id="sec-object-environment-records">
<div class="front">
<h1><span class="secnum" id="sec-8.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records" title="link to this section">8.1.1.2</a></span> Object Environment Records</h1>
<p>Each object environment record is associated with an object called its <i>binding object</i>. An object environment
record binds the set of string identifier names that directly correspond to the property names of its binding object.
Property keys that are not strings in the form of an <span class="nt">IdentifierName</span> are not included in the set
of bound identifiers. Both own and inherited properties are included in the set regardless of the setting of their
[[Enumerable]] attribute. Because properties can be dynamically added and deleted from objects, the set of identifiers
bound by an object environment record may potentially change as a side-effect of any operation that adds or deletes
properties. Any bindings that are created as a result of such a side-effect are considered to be a mutable binding even
if the Writable attribute of the corresponding property has the value <b>false</b>. Immutable bindings do not exist for
object environment records.</p>
<p>Object environment records also have a possibly empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of
strings called <var>unscopables</var>. The strings in this <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
are excluded from the environment records set of bound names, regardless of whether or not they exist as property keys
of its binding object.</p>
<p>Object environment records created for <code>with</code> statements (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement">13.10</a>) can
provide their binding object as an implicit this value for use in function calls. The capability is controlled by a
<var>withEnvironment</var> Boolean value that is associated with each object environment record. By default, the value
of <var>withEnvironment</var> is <b>false</b> for any object environment record.</p>
<p>The behaviour of the concrete specification methods for Object Environment Records is defined by the following
algorithms.</p>
</div>
<section id="sec-object-environment-records-hasbinding-n">
<h1><span class="secnum" id="sec-8.1.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-hasbinding-n" title="link to this section">8.1.1.2.1</a></span> HasBinding(N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method HasBinding for object environment
records determines if its associated binding object has a property whose name is the value of the argument
<var>N</var>:</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li>If <i>N</i> is an element of <i>envRec’s unscopables</i>, then return <b>false</b>.</li>
<li>Let <i>bindings</i> be the binding object for <i>envRec</i>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>bindings</i>, <i>N</i>).</li>
</ol>
</section>
<section id="sec-object-environment-records-createmutablebinding-n-d">
<h1><span class="secnum" id="sec-8.1.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-createmutablebinding-n-d" title="link to this section">8.1.1.2.2</a></span> CreateMutableBinding (N, D)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateMutableBinding for object
environment records creates in an environment record’s associated binding object a property whose name is the
String value and initializes it to the value <b>undefined</b>. If Boolean argument <var>D</var> is provided and has the
value <b>true</b> the new property’s [[Configurable]] attribute is set to <b>true</b>, otherwise it is set to
<b>false</b>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li>Let <i>bindings</i> be the binding object for <i>envRec</i>.</li>
<li>If <i>D</i> is <b>true</b> then let <i>configValue</i> be <b>true</b> otherwise let <i>configValue</i> be
<b>false</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>bindings</i>, <i>N</i>,
PropertyDescriptor{[[Value]]:<b>undefined</b>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b> ,
[[Configurable]]: <i>configValue</i>}).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Normally <i>envRec</i> will not have a binding for <i>N</i> but if it does, the
semantics of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a> may result in an existing binding being
replaced or shadowed or cause an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> to be
returned.</p>
</div>
</section>
<section id="sec-object-environment-records-createimmutablebinding-n">
<h1><span class="secnum" id="sec-8.1.1.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-createimmutablebinding-n" title="link to this section">8.1.1.2.3</a></span> CreateImmutableBinding (N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateImmutableBinding is never used
within this specification in association with Object environment records.</p>
</section>
<section id="sec-object-environment-records-initializebinding-n-v">
<h1><span class="secnum" id="sec-8.1.1.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-initializebinding-n-v" title="link to this section">8.1.1.2.4</a></span> InitializeBinding (N,V)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method InitializeBinding for object
environment records is used to set the bound value of the current binding of the identifier whose name is the value of
the argument <var>N</var> to the value of argument <var>V</var>. An uninitialized binding for <var>N</var> must already
exist.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>envRec</i> must have an uninitialized binding for
<i>N</i>.</li>
<li>Record that the binding for <i>N</i> in <i>envRec</i> has been initialized.</li>
<li>Return the result of calling the SetMutableBinding concrete method of <i>envRec</i> with <i>N</i>, <i>V</i>, and
<b>false</b> as arguments.</li>
</ol>
</section>
<section id="sec-object-environment-records-setmutablebinding-n-v-s">
<h1><span class="secnum" id="sec-8.1.1.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-setmutablebinding-n-v-s" title="link to this section">8.1.1.2.5</a></span> SetMutableBinding (N,V,S)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method SetMutableBinding for object
environment records attempts to set the value of the environment record’s associated binding object’s
property whose name is the value of the argument <var>N</var> to the value of argument <var>V</var>. A property named
<var>N</var> normally already exists but if it does not or is not currently writable, error handling is determined by
the value of the Boolean argument <var>S</var>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li>Let <i>bindings</i> be the binding object for <i>envRec</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>bindings</i>, <i>N</i>, <i>V</i>, and <i>S</i>).</li>
</ol>
</section>
<section id="sec-object-environment-records-getbindingvalue-n-s">
<h1><span class="secnum" id="sec-8.1.1.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-getbindingvalue-n-s" title="link to this section">8.1.1.2.6</a></span> GetBindingValue(N,S)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method GetBindingValue for object environment
records returns the value of its associated binding object’s property whose name is the String value of the
argument identifier <var>N</var>. The property should already exist but if it does not the result depends upon the value
of the <var>S</var> argument:</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li>Let <i>bindings</i> be the binding object for <i>envRec</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>bindings</i>, <i>N</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <i>value</i> is <b>false</b>, then
<ol class="block">
<li>If <i>S</i> is <b>false</b>, return the value <b>undefined</b>, otherwise throw a <b>ReferenceError</b>
exception.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>bindings</i>, <i>N</i>).</li>
</ol>
</section>
<section id="sec-object-environment-records-deletebinding-n">
<h1><span class="secnum" id="sec-8.1.1.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-deletebinding-n" title="link to this section">8.1.1.2.7</a></span> DeleteBinding (N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method DeleteBinding for object environment
records can only delete bindings that correspond to properties of the environment object whose [[Configurable]]
attribute have the value <b>true</b>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li>Let <i>bindings</i> be the binding object for <i>envRec</i>.</li>
<li>Return the result of calling the [[Delete]] internal method of <i>bindings</i> passing <i>N</i> as the
argument.</li>
</ol>
</section>
<section id="sec-object-environment-records-hasthisbinding">
<h1><span class="secnum" id="sec-8.1.1.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-hasthisbinding" title="link to this section">8.1.1.2.8</a></span> HasThisBinding ()</h1>
<p>Regular Object Environment Records do not provide a <code>this</code> binding.</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-object-environment-records-hassuperbinding">
<h1><span class="secnum" id="sec-8.1.1.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-hassuperbinding" title="link to this section">8.1.1.2.9</a></span> HasSuperBinding ()</h1>
<p>Regular Object Environment Records do not provide a <code>super</code> binding.</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-object-environment-records-withbaseobject">
<h1><span class="secnum" id="sec-8.1.1.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records-withbaseobject" title="link to this section">8.1.1.2.10</a></span> WithBaseObject()</h1>
<p>Object Environment Records return <b>undefined</b> as their WithBaseObject unless their <var>withEnvironment</var>
flag is <b>true</b>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> for which the
method was invoked.</li>
<li>If the <i>withEnvironment</i> flag of <i>envRec</i> is <b>true</b>, return the binding object for
<i>envRec</i>.</li>
<li>Otherwise, return <b>undefined</b>.</li>
</ol>
</section>
</section>
<section id="sec-function-environment-records">
<div class="front">
<h1><span class="secnum" id="sec-8.1.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records" title="link to this section">8.1.1.3</a></span> Function Environment Records</h1>
<p>A function environment record is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a>
that is used to represent the outer most scope of a function that provides a <code>this</code> binding. In addition to
its identifier bindings, a function environment record contains the <b>this</b> value used within its scope. If such a
function references <code>super</code>, its function environment record also contains the state that is used to perform
<code>super</code> method invocations from within the function.</p>
<p>Function environment records store their <code>this</code> binding as the value of their <var>thisValue</var>. If the
associated function references <code>super</code>, the environment record stores in <span class="nt">HomeObject</span>
the object that the function is bound to as a method and in <span class="nt">MethodName</span> the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> used for unqualified super invocations from within the function. The default
value for <span class="nt">HomeObject</span> and <span class="nt">MethodName</span> is <span class="value">undefined</span>.</p>
<p>Methods environment records support all of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">Declarative Environment
Record</a> methods listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-16">Table 16</a> and share the same specifications for all of those methods
except for HasThisBinding and HasSuperBinding. In addition, declarative environment records support the methods listed
in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-17">Table 17</a>:</p>
<figure>
<figcaption><span id="table-17">Table 17</span> — Additional Methods of Function Environment Records</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Method</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">GetThisBinding()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return the value of this environment record’s <code>this</code> binding.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperbase">GetSuperBase</a>()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return the object that is the base for <code>super</code> property accesses bound in this environment record. The object is derived from this environment record’s <span style="font-family: Times New Roman">HomeObject</span> binding. If the value is Empty, return <span class="value">undefined</span>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethodname">GetMethodName</a>()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return the value of this environment record’s <span style="font-family: Times New Roman">MethodName</span> binding.</td>
</tr>
</tbody></table>
</figure>
<p>The behaviour of the additional concrete specification methods for Function Environment Records is defined by the
following algorithms:</p>
</div>
<section id="sec-function-environment-records-hasthisbinding">
<h1><span class="secnum" id="sec-8.1.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records-hasthisbinding" title="link to this section">8.1.1.3.1</a></span> HasThisBinding ()</h1>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records">Function Environment Records</a> always provide a <code>this</code>
binding.</p>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-function-environment-records-hassuperbinding">
<h1><span class="secnum" id="sec-8.1.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records-hassuperbinding" title="link to this section">8.1.1.3.2</a></span> HasSuperBinding ()</h1>
<ol class="proc">
<li>If this environment record’s <i>HomeObject</i> has the value <span style="font-family:
sans-serif">Empty</span>, then return <b>false</b>. Otherwise, return <b>true</b>.</li>
</ol>
</section>
<section id="sec-function-environment-records-getthisbinding">
<h1><span class="secnum" id="sec-8.1.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records-getthisbinding" title="link to this section">8.1.1.3.3</a></span> GetThisBinding ()</h1>
<ol class="proc">
<li>Return the value of this environment record’s <i>thisValue</i>.</li>
</ol>
</section>
<section id="sec-getsuperbase">
<h1><span class="secnum" id="sec-8.1.1.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperbase" title="link to this section">8.1.1.3.4</a></span> GetSuperBase ()</h1>
<ol class="proc">
<li>Let <i>home</i> be the value of this environment record’s <i>HomeObject</i>.</li>
<li>If <i>home</i> has the value <span style="font-family: sans-serif">Empty</span>, then return
<b>undefined</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>home</i>) is Object.</li>
<li>Return the result of calling <i>home’s</i> [[GetPrototypeOf]] internal method.</li>
</ol>
</section>
<section id="sec-getmethodname">
<h1><span class="secnum" id="sec-8.1.1.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethodname" title="link to this section">8.1.1.3.5</a></span> GetMethodName ()</h1>
<ol class="proc">
<li>Return the value of this environment record’s <i>MethodName</i>.</li>
</ol>
</section>
</section>
<section id="sec-global-environment-records">
<div class="front">
<h1><span class="secnum" id="sec-8.1.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records" title="link to this section">8.1.1.4</a></span> Global Environment Records</h1>
<p>A global environment record is used to represent the outer most scope that is shared by all of the ECMAScript <span class="nt">Script</span> elements that are processed in a common <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">8.2</a>). A global environment provides the bindings for built-in globals (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-object">clause 18</a>), properties of the global object, and for all declarations that are not
function code and that occur within <span class="nt">Script</span> productions.</p>
<p>A global environment record is logically a single record but it is specified as a composite encapsulating an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a>. The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> has as its base object the global object of the
associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>. This global object is also the value of the global environment
record’s <var>thisValue</var>. The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a>
component of a global environment record contains the bindings for all built-in globals (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-object">clause 18</a>) and all bindings introduced by a <span class="nt">FunctionDeclaration</span> or
<span class="nt">VariableStatement</span> contained in global code. The bindings for all other ECMAScript declarations
in global code are contained in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a>
component of the global environment record.</p>
<p>Properties may be created directly on a global object. Hence, the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object
environment record</a> component of a global environment record may contain both bindings created explicitly by <span class="nt">FunctionDeclaration</span> or <span class="nt">VariableStatement</span> declarations and binding created
implicitly as properties of the global object. In order to identify which bindings were explicitly created using
declarations, a global environment record maintains a list of the names bound using its CreateGlobalVarBindings and
CreateGlobalFunctionBindings concrete methods.</p>
<p>Global environment records have the additional state components listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-18">Table 18</a> and the
additional methods listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-19">Table 19</a>.</p>
<figure>
<figcaption><span id="table-18">Table 18</span> -- Components of Global Environment Records</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Component</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">ObjectEnvironment</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">An <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">Object Environment Record</a> whose base object is the global object. It contains global built-in bindings as well as bindings for <span class="nt">FunctionDeclaration</span> or <span class="nt">VariableStatement</span> declarations in global code for the associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">DeclarativeEnvironment</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">Declarative Environment Record</a> that contains bindings for all declarations in global for the associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> code except for <span class="nt">FunctionDeclaration</span> and <span class="nt">VariableStatement</span> declarations.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">VarNames</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the string names bound by <span class="nt">FunctionDeclaration</span> or <span class="nt">VariableStatement</span> declarations in global code for the associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</td>
</tr>
</tbody></table>
</figure>
<figure>
<figcaption><span id="table-19">Table 19</span> — Additional Methods of Global Environment Records</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Method</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">GetThisBinding()</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Return the value of this environment record’s <code>this</code> binding.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasvardeclaration">HasVarDeclaration</a> (N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Determines if the argument identifier has a binding in this environment record that was created using a <span class="nt">VariableStatement</span> or a <span style="font-family: Times New Roman"><i>FunctionDeclaration</i>.</span></td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-haslexicaldeclaration">HasLexicalDeclaration</a> (N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Determines if the argument identifier has a binding in this environment record that was created using a lexical declaration such as a <span class="nt">LexicalDeclaration</span> or a <span class="nt">ClassDeclaration</span>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-candeclareglobalvar">CanDeclareGlobalVar</a> (N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Determines if a corresponding <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalvarbinding">CreateGlobalVarBinding</a> call would succeed if called for the same argument <var>N</var>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-candeclareglobalfunction">CanDeclareGlobalFunction</a> (N)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Determines if a corresponding <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalfunctionbinding">CreateGlobalFunctionBinding</a> call would succeed if called for the same argument <var>N</var>.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalvarbinding">CreateGlobalVarBinding</a>(N, D)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Used to create global <code>var</code> bindings in the ObjectEnvironmentComponent of the environment record. The binding will be a mutable binding. The corresponding global object property will have attribute values approate for a <code>var</code>. The String value <var>N</var> is the text of the bound name. <i>V</i> is the initial value of the binding If the optional Boolean argument <var>D</var> is <b>true</b> the binding is may be subsequently deleted. This is logically equivalent to CreateMutableBinding but it allows var declarations to receive special treatment.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalfunctionbinding">CreateGlobalFunctionBinding</a>(N, V, D)</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Used to create and initialize global <code>function</code> bindings in the ObjectEnvironmentComponent of the environment record. The binding will be a mutable binding. The corresponding global object property will have attribute values approate for a <code>function</code>.The String value <var>N</var> is the text of the bound name. If the optional Boolean argument <var>D</var> is <b>true</b> the binding is may be subsequently deleted. This is logically equivalent to CreateMutableBinding followed by a SetMutableBinding but it allows function declarations to receive special treatment.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black"></td>
</tr>
</tbody></table>
</figure>
<p>The behaviour of the concrete specification methods for Global Environment Records is defined by the following
algorithms.</p>
</div>
<section id="sec-global-environment-records-hasbinding-n">
<h1><span class="secnum" id="sec-8.1.1.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-hasbinding-n" title="link to this section">8.1.1.4.1</a></span> HasBinding(N)</h1>
<p>The concrete environment record method HasBinding for global environment records simply determines if the argument
identifier is one of the identifiers bound by the record:</p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li>If the result of calling <i>DclRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
return <b>true</b>.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Return the result of calling <i>ObjRec’s</i> HasBinding concrete method with argument <i>N</i>.</li>
</ol>
</section>
<section id="sec-global-environment-records-createmutablebinding-n-d">
<h1><span class="secnum" id="sec-8.1.1.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-createmutablebinding-n-d" title="link to this section">8.1.1.4.2</a></span> CreateMutableBinding (N, D)</h1>
<p>The concrete environment record method CreateMutableBinding for global environment records creates a new mutable
binding for the name <var>N</var> that is uninitialized. The binding is created in the associated
DeclarativeEnvironment. A binding for <var>N</var> must not already exist in the DeclarativeEnvironment. If Boolean
argument <var>D</var> is provided and has the value <b>true</b> the new binding is marked as being subject to
deletion.</p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>DclRec</i> does not already have a binding for <i>N</i>.</li>
<li>Return the result of calling the CreateMutableBinding concrete method of <i>DclRec</i> with arguments <i>N</i> and
<i>D</i>.</li>
</ol>
</section>
<section id="sec-global-environment-records-createimmutablebinding-n">
<h1><span class="secnum" id="sec-8.1.1.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-createimmutablebinding-n" title="link to this section">8.1.1.4.3</a></span> CreateImmutableBinding (N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateImmutableBinding for global
environment records creates a new immutable binding for the name <var>N</var> that is uninitialized. A binding must not
already exist in this environment record for <var>N</var>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>DclRec</i> does not already have a binding for <i>N</i>.</li>
<li>Return the result of calling the CreateImmutableBinding concrete method of <i>DclRec</i> with argument
<i>N</i>.</li>
</ol>
</section>
<section id="sec-global-environment-records-initializebinding-n-v">
<h1><span class="secnum" id="sec-8.1.1.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-initializebinding-n-v" title="link to this section">8.1.1.4.4</a></span> InitializeBinding (N,V)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method InitializeBinding for global
environment records is used to set the bound value of the current binding of the identifier whose name is the value of
the argument <var>N</var> to the value of argument <var>V</var>. An uninitialized binding for <var>N</var> must already
exist.</p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li>If the result of calling <i>DclRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
then
<ol class="block">
<li>Return the result of calling <i>DclRec’s</i> InitializeBinding concrete method with arguments <i>N</i>
and <i>V</i>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If the binding exists it must be in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a>.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Return the result of calling <i>ObjRec’s</i> InitializeBinding concrete method with arguments <i>N</i> and
<i>V</i>.</li>
</ol>
</section>
<section id="sec-global-environment-records-setmutablebinding-n-v-s">
<h1><span class="secnum" id="sec-8.1.1.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-setmutablebinding-n-v-s" title="link to this section">8.1.1.4.5</a></span> SetMutableBinding (N,V,S)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method SetMutableBinding for global
environment records attempts to change the bound value of the current binding of the identifier whose name is the value
of the argument <var>N</var> to the value of argument <var>V</var>. If the binding is an immutable binding, a
<b>TypeError</b> is thrown if <span style="font-family: Times New Roman">S</span> is <span class="value">true</span>. A
property named <var>N</var> normally already exists but if it does not or is not currently writable, error handling is
determined by the value of the Boolean argument <var>S</var>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li>If the result of calling <i>DclRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
then
<ol class="block">
<li>Return the result of calling the SetMutableBinding concrete method of <i>DclRec</i> with arguments <i>N</i>,
<i>V</i>, and <i>S</i>.</li>
</ol>
</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Return the result of calling the SetMutableBinding concrete method of <i>ObjRec</i> with arguments <i>N</i>,
<i>V</i>, and <i>S</i>.</li>
</ol>
</section>
<section id="sec-global-environment-records-getbindingvalue-n-s">
<h1><span class="secnum" id="sec-8.1.1.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-getbindingvalue-n-s" title="link to this section">8.1.1.4.6</a></span> GetBindingValue(N,S)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method GetBindingValue for global environment
records simply returns the value of its bound identifier whose name is the value of the argument <var>N</var>. If
<var>S</var> is <b>true</b> and the binding is an uninitialized binding throw a <b>ReferenceError</b> exception. A
property named <var>N</var> normally already exists but if it does not or is not currently writable, error handling is
determined by the value of the Boolean argument <var>S</var>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li>If the result of calling <i>DclRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
then
<ol class="block">
<li>Return the result of calling the GetBindingValue concrete method of <i>DclRec</i> with arguments <i>N</i> and
<i>S</i>.</li>
</ol>
</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Return the result of calling the GetBindingValue concrete method of <i>ObjRec</i> with arguments <i>N</i>, and
<i>S</i>.</li>
</ol>
</section>
<section id="sec-global-environment-records-deletebinding-n">
<h1><span class="secnum" id="sec-8.1.1.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-deletebinding-n" title="link to this section">8.1.1.4.7</a></span> DeleteBinding (N)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method DeleteBinding for global environment
records can only delete bindings that have been explicitly designated as being subject to deletion.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li>If the result of calling <i>DclRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
then
<ol class="block">
<li>Return the result of calling the DeleteBinding concrete method of <i>DclRec</i> with argument <i>N</i>.</li>
</ol>
</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>If the result of calling <i>ObjRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
then
<ol class="block">
<li>Let <i>status</i> be the result of calling the DeleteBinding concrete method of <i>ObjRec</i> with argument
<i>N</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>varNames</i> be <i>envRec’s</i> VarNames <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>N</i> is an element of <i>varNames</i>, then remove that element from the <i>varNames</i>.</li>
</ol>
</li>
<li>Return <i>status</i>.</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-global-environment-records-hasthisbinding">
<h1><span class="secnum" id="sec-8.1.1.4.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-hasthisbinding" title="link to this section">8.1.1.4.8</a></span> HasThisBinding ()</h1>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">Global Environment Records</a> always provide a <code>this</code> binding
whose value is the associated global object.</p>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<p>HasSuperBinding ()</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-global-environment-records-withbaseobject">
<h1><span class="secnum" id="sec-8.1.1.4.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-withbaseobject" title="link to this section">8.1.1.4.9</a></span> WithBaseObject()</h1>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">Global Environment Records</a> always return <b>undefined</b> as their
WithBaseObject.</p>
<ol class="proc">
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-global-environment-records-getthisbinding">
<h1><span class="secnum" id="sec-8.1.1.4.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records-getthisbinding" title="link to this section">8.1.1.4.10</a></span> GetThisBinding ()</h1>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Let <i>bindings</i> be the binding object for <i>ObjRec</i>.</li>
<li>Return <i>bindings</i>.</li>
</ol>
</section>
<section id="sec-hasvardeclaration">
<h1><span class="secnum" id="sec-8.1.1.4.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasvardeclaration" title="link to this section">8.1.1.4.11</a></span> HasVarDeclaration (N)</h1>
<p>The concrete environment record method HasVarDeclaration for global environment records determines if the argument
identifier has a binding in this record that was created using a <span class="nt">VariableStatement</span> or a <span class="prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span></span></p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>varDeclaredNames</i> be <i>envRec’s</i> VarNames <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>varDeclaredNames</i> contains the value of <i>N</i>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-haslexicaldeclaration">
<h1><span class="secnum" id="sec-8.1.1.4.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-haslexicaldeclaration" title="link to this section">8.1.1.4.12</a></span> HasLexicalDeclaration (N)</h1>
<p>The concrete environment record method HasLexicalDeclaration for global environment records determines if the
argument identifier has a binding in this record that was created using a lexical declaration such as a <span class="nt">LexicalDeclaration</span> or a <span class="prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span></span></p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>DclRec</i> be <i>envRec’s</i> DeclarativeEnvironment.</li>
<li>Return the result of calling <i>DclRec’s</i> HasBinding concrete method with argument <i>N</i>.</li>
</ol>
</section>
<section id="sec-candeclareglobalvar">
<h1><span class="secnum" id="sec-8.1.1.4.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-candeclareglobalvar" title="link to this section">8.1.1.4.13</a></span> CanDeclareGlobalVar (N)</h1>
<p>The concrete environment record method CanDeclareGlobalVar for global environment records determines if a
corresponding <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalvarbinding">CreateGlobalVarBinding</a> call would succeed if called for the same
argument <var>N</var>. Redundent var declarations and var declarations for pre-existing global object properties are
allowed.</p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>If the result of calling <i>ObjRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>true</b>,
return <b>true</b>.</li>
<li>Let <i>bindings</i> be the binding object for <i>ObjRec</i>.</li>
<li>Let <i>extensible</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>bindings</i>).</li>
<li>Return <i>extensible</i>.</li>
</ol>
</section>
<section id="sec-candeclareglobalfunction">
<h1><span class="secnum" id="sec-8.1.1.4.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-candeclareglobalfunction" title="link to this section">8.1.1.4.14</a></span> CanDeclareGlobalFunction (N)</h1>
<p>The concrete environment record method CanDeclareGlobalFunction for global environment records determines if a
corresponding <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalfunctionbinding">CreateGlobalFunctionBinding</a> call would succeed if called
for the same argument <var>N</var>.</p>
<ol class="proc">
<li>Let <i>envRec</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> for which the
method was invoked.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Let <i>globalObject</i> be the binding object for <i>ObjRec</i>.</li>
<li>Let <i>extensible</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>globalObject</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensible</i>).</li>
<li>If the result of calling <i>ObjRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>false</b>,
then return <i>extensible</i>.</li>
<li>Let <i>existingProp</i> be the result of calling the [[GetOwnProperty]] internal method of <i>globalObject</i>
with argument <i>N</i>.</li>
<li>If <i>existingProp</i> is <b>undefined</b>, then return <i>extensible</i>.</li>
<li>If <i>existingProp</i>.[[Configurable]] is <b>true</b>, then return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>existingProp</i>) is <b>true</b> and
<i>existingProp</i> has attribute values {[[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>}, then return
<b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-createglobalvarbinding">
<h1><span class="secnum" id="sec-8.1.1.4.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalvarbinding" title="link to this section">8.1.1.4.15</a></span> CreateGlobalVarBinding (N, D)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateGlobalVarBinding for global
environment records creates a mutable binding in the associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object
environment record</a> and records the bound name in the associated VarNames <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>. If a binding already exists, it is reused.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>If the result of calling <i>ObjRec’s</i> HasBinding concrete method with argument <i>N</i> is <b>false</b>,
then
<ol class="block">
<li>Let <i>status</i> be the result of calling the CreateMutableBinding concrete method of <i>ObjRec</i> with
arguments <i>N</i> and <i>D</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Let <i>varDeclaredNames</i> be <i>envRec’s</i> VarNames <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>varDeclaredNames</i> does not contain the value of <i>N</i>, then
<ol class="block">
<li>Append <i>N</i> to <i>varDeclaredNames</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
</section>
<section id="sec-createglobalfunctionbinding">
<h1><span class="secnum" id="sec-8.1.1.4.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalfunctionbinding" title="link to this section">8.1.1.4.16</a></span> CreateGlobalFunctionBinding (N, V, D)</h1>
<p>The concrete <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> method CreateGlobalFunctionBinding for global
environment records creates a mutable binding in the associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object
environment record</a> and records the bound name in the associated VarNames <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>. If a binding already exists, it is replaced.</p>
<ol class="proc">
<li>Let <i>envRec</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> for
which the method was invoked.</li>
<li>Let <i>ObjRec</i> be <i>envRec’s</i> ObjectEnvironment.</li>
<li>Let <i>globalObject</i> be the binding object for <i>ObjRec</i>.</li>
<li>Let <i>existingProp</i> be the result of calling the [[GetOwnProperty]] internal method of <i>globalObject</i>
with argument <i>N</i>.</li>
<li>If <i>existingProp</i> is <b>undefined</b> or <i>existingProp</i>.[[Configurable]] is <b>true</b>, then
<ol class="block">
<li>Let <i>desc</i> be the PropertyDescriptor{[[Value]]:<i>V</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>true</b> , [[Configurable]]: <i>D</i>}.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>desc</i> be the PropertyDescriptor{[[Value]]:<i>V</i> }.</li>
</ol>
</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>globalObject</i>, <i>N</i>,
<i>desc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>varDeclaredNames</i> be <i>envRec’s</i> VarNames <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>varDeclaredNames</i> does not contain the value of <i>N</i>, then
<ol class="block">
<li>Append <i>N</i> to <i>varDeclaredNames</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Global function declarations are always represented as own properties of the global
object. If possible, an existing own property is reconfigured to have a standard set of attribute values.</p>
</div>
</section>
</section>
</section>
<section id="sec-lexical-environment-operations">
<div class="front">
<h1><span class="secnum" id="sec-8.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environment-operations" title="link to this section">8.1.2</a></span> Lexical Environment Operations</h1>
<p>The following abstract operations are used in this specification to operate upon lexical environments:</p>
</div>
<section id="sec-getidentifierreference">
<h1><span class="secnum" id="sec-8.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getidentifierreference" title="link to this section">8.1.2.1</a></span> GetIdentifierReference (lex, name, strict)</h1>
<p>The abstract operation GetIdentifierReference is called with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical
Environment</a> <var>lex</var>, a String <var>name</var>, and a Boolean flag <var>strict.</var> The value of
<var>lex</var> may be <b>null</b>. When called, the following steps are performed:</p>
<ol class="proc">
<li>If <i>lex</i> is the value <b>null</b>, then
<ol class="block">
<li>Return a value of type <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> whose base value is
<b>undefined</b>, whose referenced name is <i>name</i>, and whose strict reference flag is <i>strict</i>.</li>
</ol>
</li>
<li>Let <i>envRec</i> be <i>lex</i>’s environment record.</li>
<li>Let <i>exists</i> be the result of calling the HasBinding(<i>N</i>) concrete method of <i>envRec</i> passing
<i>name</i> as the argument <i>N</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exists</i>).</li>
<li>If <i>exists</i> is <code>true</code>, then
<ol class="block">
<li>Return a value of type <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> whose base value is
<i>envRec</i>, whose referenced name is <i>name</i>, and whose strict reference flag is <i>strict.</i></li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>outer</i> be the value of <i>lex’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">outer environment
reference</a>.</li>
<li>Return GetIdentifierReference(<i>outer</i>, <i>name</i>, <i>strict</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-newdeclarativeenvironment">
<h1><span class="secnum" id="sec-8.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment" title="link to this section">8.1.2.2</a></span> NewDeclarativeEnvironment (E)</h1>
<p>When the abstract operation NewDeclarativeEnvironment is called with either a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> or <b>null</b> as argument <var>E</var> the following steps are
performed:</p>
<ol class="proc">
<li>Let <i>env</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a>.</li>
<li>Let <i>envRec</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a>
containing no bindings.</li>
<li>Set <i>env’s</i> environment record to be <i>envRec</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">outer lexical environment reference</a> of <i>env</i> to <i>E</i>.</li>
<li>Return <i>env</i>.</li>
</ol>
</section>
<section id="sec-newobjectenvironment">
<h1><span class="secnum" id="sec-8.1.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newobjectenvironment" title="link to this section">8.1.2.3</a></span> NewObjectEnvironment (O, E)</h1>
<p>When the abstract operation NewObjectEnvironment is called with an Object <var>O</var> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> <var>E</var> (or <b>null)</b> as arguments, the following steps
are performed:</p>
<ol class="proc">
<li>Let <i>env</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a>.</li>
<li>Let <i>envRec</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a> containing
<i>O</i> as the binding object.</li>
<li>Set <i>envRec’s</i> <i>unscopables</i> to an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Set <i>env’s</i> environment record to <i>envRec</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">outer lexical environment reference</a> of <i>env</i> to <i>E</i>.</li>
<li>Return <i>env</i>.</li>
</ol>
</section>
<section id="sec-newfunctionenvironment">
<h1><span class="secnum" id="sec-8.1.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newfunctionenvironment" title="link to this section">8.1.2.4</a></span> NewFunctionEnvironment (F, T)</h1>
<p>When the abstract operation NewFunctionEnvironment is called with an ECMAScript function Object <var>F</var> and an
ECMAScript value <var>T</var> as arguments, the following steps are performed:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The value of <i>F’s</i> [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <span style="font-family:
sans-serif">lexical</span>.</li>
<li>Let <i>env</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a>.</li>
<li>Let <i>envRec</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records">Function environment record</a> containing
containing no bindings.</li>
<li>Set <i>envRec’s</i> <i>thisValue</i> to <i>T</i>.</li>
<li>If <i>F</i>’s [[NeedsSuper]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>true</b>, then
<ol class="block">
<li>Let <i>home</i> be the value of <i>F’s</i> [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>home</i> is <b>undefined</b>, then throw a <b>ReferenceError</b> exception.</li>
<li>Set <i>envRec’s</i> <i>HomeObject</i> to <i>home</i>.</li>
<li>Set <i>envRec’s</i> <i>MethodName</i> to the value of <i>F’s</i> [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Set <i>envRec’s</i> <i>HomeObject</i> to <span style="font-family: sans-serif">Empty</span>.</li>
</ol>
</li>
<li>Set <i>env’s</i> environment record to be <i>envRec</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">outer lexical environment reference</a> of <i>env</i> to the value of
<i>F’s</i> [[Environment]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>env</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-code-realms">
<div class="front">
<h1><span class="secnum" id="sec-8.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms" title="link to this section">8.2</a></span> Code
Realms</h1>
<p>Before it is evaluated, all ECMAScript code must be associated with a <i>Realm</i>. Conceptually, a realm consists of a
set of intrinsic objects, an ECMAScript global environment, all of the ECMAScript code that is loaded within the scope of
that global environment, a Loader object that can associate new ECMAScript code with the realm, and other associated state
and resources.</p>
<p>A Realm is specified as a Record with the fields specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-20">Table 20</a>:</p>
<figure>
<figcaption><span id="table-20">Table 20</span> — Realm Record Fields</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[intrinsics]]</td>
<td>A record whose field names are intrinsic keys and whose values are objects</td>
<td>These are the intrinsic values used by code associated with this Realm</td>
</tr>
<tr>
<td>[[globalThis]]</td>
<td>An object</td>
<td>The global object for this Realm</td>
</tr>
<tr>
<td>[[globalEnv]]</td>
<td>An ECMAScript environment</td>
<td>The global environment for this Realm</td>
</tr>
<tr>
<td>[[directEvalTranslate]]</td>
<td><b>undefined</b> or an object that is callable as a function.</td>
<td></td>
</tr>
<tr>
<td>[[directEvalFallback]]</td>
<td><b>undefined</b> or an object that is callable as a function.</td>
<td></td>
</tr>
<tr>
<td>[[indirectEval]]</td>
<td><b>undefined</b> or an object that is callable as a function.</td>
<td></td>
</tr>
<tr>
<td>[[Function]]</td>
<td><b>undefined</b> or an object that is callable as a function.</td>
<td></td>
</tr>
<tr>
<td>[[loader]]</td>
<td>any ECMAScript identifier or <b>empty</b></td>
<td>The Loader object that can associate ECMAScript code with this Realm</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-createrealm">
<h1><span class="secnum" id="sec-8.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createrealm" title="link to this section">8.2.1</a></span> CreateRealm
( )</h1>
<p>When the abstract operation CreateRealm is called with no arguments, the following steps are performed:</p>
<ol class="proc">
<li>Let <i>realmRec</i> be a new Record.</li>
<li>Let <i>intrinsics</i> be a record initialized with the values listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-7">Table 7</a>. Each intrinsic
object is a new object value fully and recursively populated with properties values as defined by the specification of
each object in clauses 18-26. All object property values are newly created object values. All values that are built-in
function objects are created by performing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction">CreateBuiltinFunction</a>(<i>realmRec</i>, &lt;steps&gt;) where &lt;steps&gt; is the
definition of that function provided by this specification.</li>
<li>Set <i>realmRec</i>.[[intrinsics]] be <i>intrinsics</i>.</li>
<li>Let <i>newGlobal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<b>null</b>).</li>
<li>Define the Global Object properties specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-object">clause 18</a> on <i>newGlobal</i> using
<i>intrinsics</i> as the source of the values.</li>
<li>Set <i>realmRec</i>.[[globalThis]] be <i>newGlobal</i>.</li>
<li>Let <i>newGlobalEnv</i> be NewGlobalEnvironment(<i>newGlobal</i>, <i>intrinsics</i>).</li>
<li>Set <i>realmRec</i>.[[globalEnv]] be <i>newGlobalEnv</i>.</li>
<li>Set each of <i>realmRec</i>.[[directEvalTranslate]], <i>realmRec</i>.[[directEvalFallback]],
<i>realmRec</i>.[[indirectEval]], and <i>realmRec</i>.[[Function]] to <b>undefined</b>.</li>
<li>Return <i>realmRec</i>.</li>
</ol>
</section>
</section>
<section id="sec-execution-contexts">
<div class="front">
<h1><span class="secnum" id="sec-8.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts" title="link to this section">8.3</a></span>
Execution Contexts</h1>
<p>An <i>execution context</i> is a specification device that is used to track the runtime evaluation of code by an
ECMAScript implementation. At any point in time, there is at most one execution context that is actually executing code.
This is known as the <i>running</i> execution context. A stack is used to track execution contexts. The running execution
context is always the top element of this stack. A new execution context is created whenever control is transferred from the
executable code associated with the currently running execution context to executable code that is not associated with that
execution context. The newly created execution context is pushed onto the stack and becomes the running execution
context.</p>
<p>An execution context contains whatever implementation specific state is necessary to track the execution progress of its
associated code. Each execution context has at least the state components listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-21">Table 21</a>.</p>
<figure>
<figcaption><span id="table-21">Table 21</span> —State Components for All Execution Contexts</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Component</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">code evaluation state</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Any state needed to perform, suspend, and resume evaluation of the code associated with this execution context.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> from which associated code accesses ECMAScript resources.</td>
</tr>
</tbody></table>
</figure>
<p>Evaluation of code by the running execution context may be suspended at various points defined within this specification.
Once the running execution context has been suspended a different execution context may become the running execution context
and commence evaluating its code. At some latter time a suspended execution context may again become the running execution
context and continue evaluating its code at the point where it had previously been suspended. Transition of the running
execution context status among execution contexts usually occurs in stack-like last-in/first-out manner. However, some
ECMAScript features require non-LIFO transitions of the running execution context.</p>
<p>The value is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> component of the running execution context is also called the
<i>current <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></i>.</p>
<p>Execution contexts for ECMAScript code have the additional state components listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-22">Table
22</a>.</p>
<figure>
<figcaption><span id="table-22">Table 22</span> — Additional State Components for ECMAScript Code Execution Contexts</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Component</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">LexicalEnvironment</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Identifies the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> used to resolve identifier references made by code within this execution context.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">VariableEnvironment</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Identifies the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> whose environment record holds bindings created by <span class="nt">VariableStatements</span> within this execution context.</td>
</tr>
</tbody></table>
</figure>
<p>The LexicalEnvironment and VariableEnvironment components of an execution context are always Lexical Environments. When
an execution context is created its LexicalEnvironment and VariableEnvironment components initially have the same value. The
value of the VariableEnvironment component never changes while the value of the LexicalEnvironment component may change
during execution of code within an execution context.</p>
<p>Execution contexts representing the evaluation of generator objects have the additional state components listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-23">Table 23</a>.</p>
<figure>
<figcaption><span id="table-23">Table 23</span> — Additional State Components for Generator Execution Contexts</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Component</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Generator</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">The GeneratorObject that this execution context is evaluating.</td>
</tr>
</tbody></table>
</figure>
<p>In most situations only the running execution context (the top of the execution context stack) is directly manipulated by
algorithms within this specification. Hence when the terms “LexicalEnvironment”, and
“VariableEnvironment” are used without qualification they are in reference to those components of the running
execution context.</p>
<p>An execution context is purely a specification mechanism and need not correspond to any particular artefact of an
ECMAScript implementation. It is impossible for ECMAScript code to directly access or observe an execution context.</p>
</div>
<section id="sec-resolvebinding">
<h1><span class="secnum" id="sec-8.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvebinding" title="link to this section">8.3.1</a></span>
ResolveBinding(name)</h1>
<p>The ResolveBinding abstract operation is used to determine the binding of <var>name</var> passed as a string value using
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution
context</a>. During execution of ECMAScript code, ResolveBinding is performed using the following algorithm:</p>
<ol class="proc">
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>If the syntactic production that is being evaluated is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode
code</a>, then let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getidentifierreference">GetIdentifierReference</a>(<i>env</i>, <i>name</i>, <i>strict</i> ).</li>
</ol>
<p>The result of resolving name is always a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> value with its
referenced name component equal to the <var>name</var> argument.</p>
</section>
<section id="sec-getthisenvironment">
<h1><span class="secnum" id="sec-8.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisenvironment" title="link to this section">8.3.2</a></span>
GetThisEnvironment</h1>
<p>The abstract operation <span style="font-family: Times New Roman">GetThisEnvironment</span> finds the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a> that currently supplies the binding of the keyword
<code>this</code>. <span style="font-family: Times New Roman">GetThisEnvironment</span> performs the following steps:</p>
<ol class="proc">
<li>Let <i>lex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Repeat
<ol class="block">
<li>Let <i>envRec</i> be <i>lex</i>’s environment record.</li>
<li>Let <i>exists</i> be the result of calling the HasThisBinding concrete method of <i>envRec</i>.</li>
<li>If <i>exists</i> is <code>true</code>, then return <i>envRec</i>.</li>
<li>Let <i>outer</i> be the value of <i>lex’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">outer environment
reference</a>.</li>
<li>Let <i>lex</i> be <i>outer</i>.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The loop in step 2 will always terminate because the llst of environments always ends with
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment</a> which has a <code>this</code> binding.</p>
</div>
</section>
<section id="sec-resolvethisbinding">
<h1><span class="secnum" id="sec-8.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvethisbinding" title="link to this section">8.3.3</a></span>
ResolveThisBinding</h1>
<p>The abstract operation ResolveThisBinding determines the binding of the keyword <code>this</code> using the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution
context</a>. ResolveThisBinding performs the following steps:</p>
<ol class="proc">
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisenvironment">GetThisEnvironment</a>( ).</li>
<li>Return the result of calling the GetThisBinding concrete method of <i>env</i>.</li>
</ol>
</section>
<section id="sec-getglobalobject">
<h1><span class="secnum" id="sec-8.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getglobalobject" title="link to this section">8.3.4</a></span>
GetGlobalObject</h1>
<p>The abstract operation <span style="font-family: Times New Roman">GetGlobalObject</span> returns the global object used
by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the currently running execution context</a>. <span style="font-family: Times New
Roman">GetGlobalObject</span> performs the following steps:</p>
<ol class="proc">
<li>Let <i>ctx</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>currentRealm</i> be <i>ctx’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>Return <i>currentRealm</i>.[[globalThis]].</li>
</ol>
</section>
</section>
<section id="sec-tasks-and-task-queues">
<div class="front">
<h1><span class="secnum" id="sec-8.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tasks-and-task-queues" title="link to this section">8.4</a></span> Tasks
and Task Queues</h1>
<p>A Task is an abstract operation that initiates an ECAMScript computation when no other ECMAScript computation is
currently in progress. A Task abstract operation may be defined to accept an arbitrary set of task parameters.</p>
<p>Execution of a Task can be initiated only when there is no running <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution
context</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> is empty. A PendingTask is a request for
the future execution of a Task. A PendingTask is an internal Record whose fields are specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-24">Table
24</a>.</p>
<figure>
<figcaption><span id="table-24">Table 24</span> — PendingTask Record Fields</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Task]]</td>
<td>The name of a Task abstract operation</td>
<td>This is the abstract operation that is performed when execution of this PendingTask is initiated. Tasks are abstract operations that use NextTask rather than Return to indicate that they have completed.</td>
</tr>
<tr>
<td>[[Arguments]]</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</td>
<td>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of argument values that are to be passed to [[Task]] when it is activated.</td>
</tr>
<tr>
<td>[[Realm]]</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> Record</td>
<td>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> for the initial <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> when this Pending Task is initiated.</td>
</tr>
</tbody></table>
</figure>
<p>A Task Queue is a FIFO queue of PendingTask records. Each Task Queue has a name and the full set of available Task Queues
are defined by an ECMAScript implementation. Every ECMAScript implementation has at least the task queues defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-25">Table 25</a>.</p>
<figure>
<figcaption><span id="table-25">Table 25</span> — Required Task Queues</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Name</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Purpose</th>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">LoadingTasks</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black">Tasks that validate, load, and evaluate ECMAScript <span class="nt">Script</span> and <span class="nt">Module</span> code units. See clauses 10 and 15.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">PromiseTasks</td>
<td style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black">Tasks that are responses to the settlement of a Promise (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects">see 25.4</a>).</td>
</tr>
</tbody></table>
</figure>
<p>A request for the future execution of a Task is made by enqueueing on a Task Queue a PendingTask record that includes a
Task abstract operation name and any necessary argument values. When there is no running <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>
is empty, the ECMAScript implementation removes the first PendingTask from a Task Queue and uses the information contained
in it to create an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> and starts execution of associated Task
abstraction operation.</p>
<p>The PendingTask records from a single Task Queue are always initiated in FIFO order. This specification does not define
the order in which multiple Task Queues are serviced. An ECMAScript implementation may interweave the FIFO evaluation of the
PendingTask records of a Task Queue with the evaluation of the PendingTask records of one or more other Task Queues. An
implementation must define what occurs when there are no running <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> and
all Task Queues are empty.</p>
<div class="note">
<p><span class="nh">NOTE</span> Typically an ECMAScript implementation will have its Task Queues are pre-initialized with
at least one PendingTask and one of those Tasks will be the first to be executed. An implementation might choose to free
all resources and terminate if the current Task completes and all Task Queues are empty. Alternatively, it might choose to
wait for a some implementation specific agent or mechanism to enqueue new PendingTask requests.</p>
</div>
<p>The following abstraction operations are used to create and manage Tasks and Task Queues:</p>
</div>
<section id="sec-enqueuetask">
<h1><span class="secnum" id="sec-8.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-enqueuetask" title="link to this section">8.4.1</a></span> EnqueueTask
( queueName, task, arguments) Abstract Operation</h1>
<p>The abstract operation requires three arguments: <var>queueName</var>, <var>task</var>, and <var>arguments</var>. It
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>queueName</i>) is String and its value is the name of a Task
Queue recognized by this implementation.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>task</i> is the name of a Task.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>arguments</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose size is the same as the number of parameters used by
<i>task</i>.</li>
<li>Let <i>callerContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>callerReam</i> be <i>callerContext’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>Let <i>pending</i> be PendingTask{ [[Task]]: <i>task</i>, [[Arguments]]: <i>arguments</i>, [[Realm]]:
<i>callerRealm</i> }.</li>
<li>Add <i>pending</i> at the back of the Task Queue named by <i>queueName</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
</ol>
</section>
<section id="sec-nexttask-result-algorithm-step">
<h1><span class="secnum" id="sec-8.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nexttask-result-algorithm-step" title="link to this section">8.4.2</a></span> NextTask ( result ) Algorithm Step</h1>
<p>A step such as:</p>
<ol class="proc">
<li>NextTask <i>result</i>.</li>
</ol>
<p>Is used in Task abstract operation in place of:</p>
<ol class="proc">
<li>Return <i>result</i>.</li>
</ol>
<p>Task abstraction operations must not contain a Return step or a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a> step.
The NextTask <var>result</var> operation is equivalent to the following steps:</p>
<ol class="proc">
<li>If <i>result</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then perform
implementation defined unhandled exception processing.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution
context</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context stack</a> is
now empty.</li>
<li>Let <i>nextQueue</i> be a non-empty Task Queue chosen in an implementation defined manner. If all Task Queues are
empty, the result is implementation defined.</li>
<li>Let <i>nextPending</i> be the PendingTask record at the front of <i>nextQueue</i>. Remove that record from
<i>nextQueue</i>.</li>
<li>Let <i>newContext</i> be a new exeution context.</li>
<li>Set <i>newContext</i>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> to <i>nextPending</i>.[[Realm]].</li>
<li>Push <i>newContext</i> onto <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>newContext</i> is
now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Perform the abstract operation named by <i>nextPending</i>.[[Task]] using the elements of
<i>nextPending</i>.[[Arguments]] as its arguments.</li>
</ol>
</section>
</section>
<section id="sec-initialization">
<h1><span class="secnum" id="sec-8.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initialization" title="link to this section">8.5</a></span>
Initialization</h1>
<p>An ECMAScript implementation performs the following steps prior to the execution of any Tasks or the evaluation of any
ECMAScript code.</p>
</section>
</section>
<section id="sec-ordinary-and-exotic-objects-behaviours">
<div class="front">
<h1><span class="secnum" id="sec-9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-and-exotic-objects-behaviours" title="link to this section">9</a></span> Ordinary and Exotic Objects Behaviours</h1>
</div>
<section id="sec-ordinary-object-internal-methods-and-internal-slots">
<div class="front">
<h1><span class="secnum" id="sec-9.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots" title="link to this section">9.1</a></span> Ordinary Object Internal Methods and Internal Slots</h1>
<p>All ordinary objects have an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> called
[[Prototype]]. The value of this <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is either
<b>null</b> or an object and is used for implementing inheritance. Data properties of the [[Prototype]] object are inherited
(are visible as properties of the child object) for the purposes of get access, but not for set access. Accessor properties
are inherited for both get access and set access.</p>
<p>Every ordinary object has a Boolean-valued [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> that controls whether or not properties may be
added to the object. If the value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is <b>false</b> then additional properties may not be added to the object. In addition, if [[Extensible]] is
<b>false</b> the value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
the object may not be modified. Once the value of an object’s [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> has been set to <b>false</b> it may not be
subsequently changed to <b>true</b>.</p>
<p>In the following algorithm descriptions, assume <var>O</var> is an ordinary object, <var>P</var> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key value</a>, <var>V</var> is any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript
language value</a>, and <span class="nt">Desc</span> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property
Descriptor</a> record.</p>
</div>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof">
<h1><span class="secnum" id="sec-9.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof" title="link to this section">9.1.1</a></span> [[GetPrototypeOf]] ( )</h1>
<p>When the [[GetPrototypeOf]] internal method of <var>O</var> is called the following steps are taken:</p>
<ol class="proc">
<li>Return the value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-setprototypeof-v">
<h1><span class="secnum" id="sec-9.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-setprototypeof-v" title="link to this section">9.1.2</a></span> [[SetPrototypeOf]] (V)</h1>
<p>When the [[SetPrototypeOf]] internal method of <var>O</var> is called with argument <var>V</var> the following steps are
taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: Either <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is Null.</li>
<li>Let <i>extensible</i> be the value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>current</i> be the value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>V</i>, <i>current</i>), then return <b>true.</b></li>
<li>If <i>extensible</i> is <b>false</b>, then return <b>false</b>.</li>
<li>If <i>V</i> is not <b>null</b>, then
<ol class="block">
<li>Let <i>p</i> be <i>V</i>.</li>
<li>Repeat, while <i>p</i> is not <b>null</b>
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>, <i>O</i>) is <b>true</b>, then return <b>false</b>.</li>
<li>Let <i>nextp</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>p</i> with no
arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextp</i>).</li>
<li>Let <i>p</i> be <i>nextp</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>extensible</i> be the value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>extensible</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>current2</i> be the value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>V</i>, <i>current2</i>) is <b>true</b>, then return <b>true.</b></li>
<li>Return <b>false.</b></li>
</ol>
</li>
<li>Set the value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i> to <i>V</i>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-isextensible">
<h1><span class="secnum" id="sec-9.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-isextensible" title="link to this section">9.1.3</a></span> [[IsExtensible]] ( )</h1>
<p>When the [[IsExtensible]] internal method of <var>O</var> is called the following steps are taken:</p>
<ol class="proc">
<li>Return the value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-preventextensions">
<h1><span class="secnum" id="sec-9.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-preventextensions" title="link to this section">9.1.4</a></span> [[PreventExtensions]] ( )</h1>
<p>When the [[PreventExtensions]] internal method of <var>O</var> is called the following steps are taken:</p>
<ol class="proc">
<li>Set the value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i> to <b>false</b>.</li>
<li>Return <b>true.</b></li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p">
<div class="front">
<h1><span class="secnum" id="sec-9.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p" title="link to this section">9.1.5</a></span> [[GetOwnProperty]] (P)</h1>
<p>When the [[GetOwnProperty]] internal method of <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>
<var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a> with arguments <i>O</i> and <i>P</i>.</li>
</ol>
</div>
<section id="sec-ordinarygetownproperty">
<h1><span class="secnum" id="sec-9.1.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarygetownproperty" title="link to this section">9.1.5.1</a></span> OrdinaryGetOwnProperty (O, P)</h1>
<p>When the abstract operation OrdinaryGetOwnProperty is called with Object <var>O</var> and with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>If <i>O</i> does not have an own property with key <i>P</i>, return <b>undefined</b>.</li>
<li>Let <i>D</i> be a newly created <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> with
no fields.</li>
<li>Let <i>X</i> be <i>O</i>’s own property whose key is <i>P</i>.</li>
<li>If <i>X</i> is a data property, then
<ol class="block">
<li>Set <i>D</i>.[[Value]] to the value of <i>X</i>’s [[Value]] attribute.</li>
<li>Set <i>D</i>.[[Writable]] to the value of <i>X</i>’s [[Writable]] attribute</li>
</ol>
</li>
<li>Else <i>X</i> is an accessor property, so
<ol class="block">
<li>Set <i>D</i>.[[Get]] to the value of <i>X</i>’s [[Get]] attribute.</li>
<li>Set <i>D</i>.[[Set]] to the value of <i>X</i>’s [[Set]] attribute.</li>
</ol>
</li>
<li>Set <i>D</i>.[[Enumerable]] to the value of <i>X</i>’s [[Enumerable]] attribute.</li>
<li>Set <i>D</i>.[[Configurable]] to the value of <i>X</i>’s [[Configurable]] attribute.</li>
<li>Return <i>D</i>.</li>
</ol>
</section>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc">
<div class="front">
<h1><span class="secnum" id="sec-9.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc" title="link to this section">9.1.6</a></span> [[DefineOwnProperty]] (P, Desc)</h1>
<p>When the [[DefineOwnProperty]] internal method of <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property
key</a> <var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span>, the following steps are taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>O</i>, <i>P</i>, and
<i>Desc</i>.</li>
</ol>
</div>
<section id="sec-ordinarydefineownproperty">
<h1><span class="secnum" id="sec-9.1.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty" title="link to this section">9.1.6.1</a></span> OrdinaryDefineOwnProperty (O, P, Desc)</h1>
<p>When the abstract operation <span style="font-family: Times New Roman">OrdinaryDefineOwnProperty</span> is called with
Object <var>O</var>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <span style="font-family: Times New
Roman"><i>P</i>,</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>current</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument
<i>P</i>.</li>
<li>Let <i>extensible</i> be the value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-validateandapplypropertydescriptor">ValidateAndApplyPropertyDescriptor</a>(<i>O</i>, <i>P</i>,
<i>extensible</i>, <i>Desc</i>, <i>current</i>).</li>
</ol>
</section>
<section id="sec-iscompatiblepropertydescriptor">
<h1><span class="secnum" id="sec-9.1.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscompatiblepropertydescriptor" title="link to this section">9.1.6.2</a></span> IsCompatiblePropertyDescriptor (Extensible, Desc, Current)</h1>
<p>When the abstract operation <span style="font-family: Times New Roman">IsCompatiblePropertyDescriptor</span> is called
with Boolean value <span class="nt">Extensible</span>, and Property Descriptors <span class="nt">Desc</span>, and <span class="nt">Current</span> the following steps are taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-validateandapplypropertydescriptor">ValidateAndApplyPropertyDescriptor</a>(<b>undefined</b>,
<b>undefined</b>, <i>Extensible</i>, <i>Desc</i>, <i>Current</i>).</li>
</ol>
</section>
<section id="sec-validateandapplypropertydescriptor">
<h1><span class="secnum" id="sec-9.1.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-validateandapplypropertydescriptor" title="link to this section">9.1.6.3</a></span> ValidateAndApplyPropertyDescriptor (O, P, extensible, Desc,
current)</h1>
<p>When the abstract operation <span style="font-family: Times New Roman">ValidateAndApplyPropertyDescriptor</span> is
called with Object <var>O</var>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <span style="font-family: Times New
Roman"><i>P</i>,</span> Boolean value <var>extensible</var>, and Property Descriptors <span class="nt">Desc</span>, and
<var>current</var> the following steps are taken:</p>
<p>This algorithm contains steps that test various fields of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span> for specific
values. The fields that are tested in this manner need not actually exist in <span class="nt">Desc</span>. If a field is
absent then its value is considered to be <b>false</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <b>undefined</b> is passed as the <i>O</i> argument only validation is performed and
no object updates are performed.</p>
</div>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>O</i> is not <b>undefined</b> then <i>P</i> is a valid <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>.</li>
<li>If <i>current</i> is <b>undefined</b>, then
<ol class="block">
<li>If <i>extensible</i> is <b>false</b>, then return <b>false</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>extensible</i> is <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isgenericdescriptor">IsGenericDescriptor</a>(<i>Desc</i>) or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>Desc</i>) is <b>true</b>, then
<ol class="block">
<li>If <i>O</i> is not <b>undefined</b>, then create an own data property named <i>P</i> of object <i>O</i>
whose [[Value]], [[Writable]], [[Enumerable]] and [[Configurable]] attribute values are described by
<i>Desc</i>. If the value of an attribute field of <i>Desc</i> is absent, the attribute of the newly created
property is set to its default value.</li>
</ol>
</li>
<li>Else <i>Desc</i> must be an accessor <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property
Descriptor</a>,
<ol class="block">
<li>If <i>O</i> is not <b>undefined</b>, then create an own accessor property named <i>P</i> of object <i>O</i>
whose [[Get]], [[Set]], [[Enumerable]] and [[Configurable]] attribute values are described by <i>Desc</i>.
If the value of an attribute field of <i>Desc</i> is absent, the attribute of the newly created property is
set to its default value.</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
<li>Return <b>true</b>, if every field in <i>Desc</i> is absent.</li>
<li>Return <b>true</b>, if every field in <i>Desc</i> also occurs in <i>current</i> and the value of every field in
<i>Desc</i> is the same value as the corresponding field in <i>current</i> when compared using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">the SameValue algorithm</a>.</li>
<li>If the [[Configurable]] field of <i>current</i> is <b>false</b> then
<ol class="block">
<li>Return <b>false</b>, if the [[Configurable]] field of <i>Desc</i> is <b>true</b>.</li>
<li>Return <b>false</b>, if the [[Enumerable]] field of <i>Desc</i> is present and the [[Enumerable]] fields of
<i>current</i> and <i>Desc</i> are the Boolean negation of each other.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isgenericdescriptor">IsGenericDescriptor</a>(<i>Desc</i>) is <b>true</b>, then no further
validation is required.</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>current</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>Desc</i>) have different results, then
<ol class="block">
<li>Return <b>false</b>, if the [[Configurable]] field of <i>current</i> is <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>current</i>) is <b>true</b>, then
<ol class="block">
<li>If <i>O</i> is not <b>undefined</b>, then convert the property named <i>P</i> of object <i>O</i> from a data
property to an accessor property. Preserve the existing values of the converted property’s
[[Configurable]] and [[Enumerable]] attributes and set the rest of the property’s attributes to their
default values.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>If <i>O</i> is not <b>undefined</b>, then convert the property named <i>P</i> of object <i>O</i> from an
accessor property to a data property. Preserve the existing values of the converted property’s
[[Configurable]] and [[Enumerable]] attributes and set the rest of the property’s attributes to their
default values.</li>
</ol>
</li>
</ol>
</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>current</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>Desc</i>) are both <b>true</b>, then
<ol class="block">
<li>If the [[Configurable]] field of <i>current</i> is <b>false</b>, then
<ol class="block">
<li>Return <b>false</b>, if the [[Writable]] field of <i>current</i> is <b>false</b> and the [[Writable]] field
of <i>Desc</i> is <b>true</b>.</li>
<li>If the [[Writable]] field of <i>current</i> is <b>false</b>, then
<ol class="block">
<li>Return <b>false</b>, if the [[Value]] field of <i>Desc</i> is present and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>Desc</i>.[[Value]], <i>current</i>.[[Value]]) is
<b>false</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Else the [[Configurable]] field of <i>current</i> is <b>true</b>, so any change is acceptable.</li>
</ol>
</li>
<li>Else <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>current</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>Desc</i>) are both <b>true</b>,
<ol class="block">
<li>If the [[Configurable]] field of <i>current</i> is <b>false</b>, then
<ol class="block">
<li>Return <b>false</b>, if the [[Set]] field of <i>Desc</i> is present and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>Desc</i>.[[Set]], <i>current</i>.[[Set]]) is <b>false</b>.</li>
<li>Return <b>false</b>, if the [[Get]] field of <i>Desc</i> is present and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>Desc</i>.[[Get]], <i>current</i>.[[Get]]) is <b>false</b>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>O</i> is not <b>undefined</b>, then
<ol class="block">
<li>For each attribute field of <i>Desc</i> that is present, set the correspondingly named attribute of the property
named <i>P</i> of object <i>O</i> to the value of the field.</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Step 8.b allows any field of Desc to be different from the corresponding field of
current if current’s [[Configurable]] field is <b>true</b>. This even permits changing the [[Value]] of a property
whose [[Writable]] attribute is <b>false</b>. This is allowed because a <b>true</b> [[Configurable]] attribute would
permit an equivalent sequence of calls where [[Writable]] is first set to <b>true</b>, a new [[Value]] is set, and then
[[Writable]] is set to <b>false</b>.</p>
</div>
</section>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p">
<h1><span class="secnum" id="sec-9.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p" title="link to this section">9.1.7</a></span> [[HasProperty]](P)</h1>
<p>When the [[HasProperty]] internal method of <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>
<var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>hasOwn</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasOwn</i>).</li>
<li>If <i>hasOwn</i> is not <b>undefined</b>, then return <b>true</b>.</li>
<li>Let <i>parent</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>O</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>parent</i>).</li>
<li>If <i>parent</i> is not <b>null</b>, then
<ol class="block">
<li>Return the result of calling the [[HasProperty]] internal method of <i>parent</i> with argument <i>P</i>.</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver">
<h1><span class="secnum" id="sec-9.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver" title="link to this section">9.1.8</a></span> [[Get]] (P, Receiver)</h1>
<p>When the [[Get]] internal method of <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>
and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> <span class="nt">Receiver</span> the following
steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>If <i>desc</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>parent</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>O</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>parent</i>).</li>
<li>If <i>parent</i> is <b>null</b>, then return <b>undefined.</b></li>
<li>Return the result of calling the [[Get]] internal method of <i>parent</i> with arguments <i>P</i> and
<i>Receiver</i>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>desc</i>) is <b>true</b>, return
<i>desc</i>.[[Value]].</li>
<li>Otherwise, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>desc</i>) must be <b>true</b> so, let
<i>getter</i> be <i>desc</i>.[[Get]].</li>
<li>If <i>getter</i> is <b>undefined</b>, return <b>undefined</b>.</li>
<li>Return the result of calling the [[Call]] internal method of <i>getter</i> with <i>Receiver</i> as the
<i>thisArgument</i> and an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as
<i>argumentsList</i>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver">
<h1><span class="secnum" id="sec-9.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver" title="link to this section">9.1.9</a></span> [[Set]] ( P, V, Receiver)</h1>
<p>When the [[Set]] internal method of <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>,
value <var>V</var>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> <span class="nt">Receiver</span>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>ownDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>ownDesc</i>).</li>
<li>If <i>ownDesc</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>parent</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>O</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>parent</i>).</li>
<li>If <i>parent</i> is not <b>null</b>, then
<ol class="block">
<li>Return the result of calling the [[Set]] internal method of <i>parent</i> with arguments <i>P</i>, <i>V</i>,
and <i>Receiver</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>ownDesc</i> be the PropertyDescriptor{[[Value]]: <b>undefined</b>, [[Writable]]: <b>true</b>,
[[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
</ol>
</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>ownDesc</i>) is <b>true</b>, then
<ol class="block">
<li>If <i>ownDesc</i>.[[Writable]] is <b>false</b>, return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>Receiver</i>) is not Object, return
<b>false</b>.</li>
<li>Let <i>existingDescriptor</i> be the result of calling the [[GetOwnProperty]] internal method of <i>Receiver</i>
with argument <i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>existingDescriptor</i>).</li>
<li>If <i>existingDescriptor</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>valueDesc</i> be the PropertyDescriptor{[[Value]]: <i>V</i>}.</li>
<li>Return the result of calling the [[DefineOwnProperty]] internal method of <i>Receiver</i> with arguments
<i>P</i> and <i>valueDesc</i>.</li>
</ol>
</li>
<li>Else <i>Receiver</i> does not currently have a property <i>P</i>,
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>Receiver</i>, <i>P</i>, <i>V</i>).</li>
</ol>
</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>ownDesc</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>setter</i> be <i>ownDesc</i>.[[Set]].</li>
<li>If <i>setter</i> is <b>undefined</b>, return <b>false</b>.</li>
<li>Let <i>setterResult</i> be the result of calling the [[Call]] internal method of <i>setter</i> providing
<i>Receiver</i> as <i>thisArgument</i> and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
containing <i>V</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>setterResult</i>).</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-delete-p">
<h1><span class="secnum" id="sec-9.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-delete-p" title="link to this section">9.1.10</a></span> [[Delete]] (P)</h1>
<p>When the [[Delete]] internal method of <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>
<var>P</var> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument
<i>P</i>.</li>
<li>If <i>desc</i> is <b>undefined</b>, then return <b>true</b>.</li>
<li>If <i>desc</i>.[[Configurable]] is <b>true</b>, then
<ol class="block">
<li>Remove the own property with name <i>P</i> from <i>O</i>.</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-enumerate">
<h1><span class="secnum" id="sec-9.1.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-enumerate" title="link to this section">9.1.11</a></span> [[Enumerate]] ()</h1>
<p>When the [[Enumerate]] internal method of <var>O</var> is called the following steps are taken:</p>
<ol class="proc">
<li>Return an Iterator object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface">25.1.2</a>) whose next method iterates over all the
String valued keys of enumerable property keys of <i>O</i>. The mechanics and order of enumerating the properties is
not specified but must conform to the rules specified below.</li>
</ol>
<p>Enumerated properties do not include properties whose <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> is a Symbol. Properties
of the object being enumerated may be deleted during enumeration. If a property that has not yet been visited during
enumeration is deleted, then it will not be visited. If new properties are added to the object being enumerated during
enumeration, the newly added properties are not guaranteed to be visited in the active enumeration. A property name must not
be visited more than once in any enumeration.</p>
<p>Enumerating the properties of an object includes enumerating properties of its prototype, and the prototype of the
prototype, and so on, recursively; but a property of a prototype is not enumerated if it is “shadowed” because
some previous object in the prototype chain has a property with the same name. The values of [[Enumerable]] attributes are
not considered when determining if a property of a prototype object is shadowed by a previous object on the prototype
chain.</p>
<p>The following is an informative algorithm that conforms to these rules</p>
<ol class="proc">
<li>Let <i>proto</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>O</i> with no arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>If <i>proto</i> is the value <b>null</b>, then
<ol class="block">
<li>Let <i>propList</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>propList</i> be the result of calling the [[Enumerate]] internal method of <i>proto</i>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propList</i>).</li>
<li>For each <i>name</i> that is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> of an own property of <i>O</i>
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>name</i>) is String, then
<ol class="block">
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument
<i>name</i>.</li>
<li>If <i>name</i> is an element of <i>propList</i>, then remove <i>name</i> as an element of
<i>propList</i>.</li>
<li>If <i>desc</i>.[[Enumerable]] is <b>true</b>, then add <i>name</i> as an element of <i>propList</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Order the elements of <i>propList</i> in an implementation defined order.</li>
<li>Return <i>propList</i>.</li>
</ol>
</section>
<section id="sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys">
<h1><span class="secnum" id="sec-9.1.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys" title="link to this section">9.1.12</a></span> [[OwnPropertyKeys]] ( )</h1>
<p>When the [[OwnPropertyKeys]] internal method of <var>O</var> is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>keys</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each own <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <i>P</i> of <i>O</i>
<ol class="block">
<li>Add <i>P</i> as the last element of <i>keys</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistiterator">CreateListIterator</a>(<i>keys</i>).</li>
</ol>
</section>
<section id="sec-objectcreate">
<h1><span class="secnum" id="sec-9.1.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate" title="link to this section">9.1.13</a></span>
ObjectCreate(proto, internalSlotsList) Abstract Operation</h1>
<p>The abstract operation ObjectCreate with argument <i>proto</i> (an object or null) is used to specify the runtime
creation of new ordinary objects. The optional argument <var>internalSlotsList</var> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of the names of additional internal slots that must be defined as
part of the object. If the list is not provided, an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> is
used. If no arguments are provided %ObjectPrototype% is used as the value of <i>proto</i>. This abstract operation performs
the following steps:</p>
<ol class="proc">
<li>If <i>internalslotsList</i> was not provided, let <i>internalSlotsList</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>obj</i> be a newly created object with an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> for each name in <i>internalSlotsList</i>.</li>
<li>Set <i>obj</i>’s essential internal methods to the default ordinary object definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to
<i>proto</i>.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to
<b>true</b>.</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
<section id="sec-ordinarycreatefromconstructor">
<h1><span class="secnum" id="sec-9.1.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor" title="link to this section">9.1.14</a></span> OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto,
internalSlotsList )</h1>
<p>The abstract operation OrdinaryCreateFromConstructor creates an ordinary object whose [[Prototype]] value is retrieved
from a constructor’s <code>prototype</code> property, if it exists. Otherwise the supplied default is used for
[[Prototype]]. The optional <var>internalSlotsList</var> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of
the names of additional internal slots that must be defined as part of the object. If the list is not provided, an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> is used. This abstract operation performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>intrinsicDefaultProto</i> is a string value that is this
specification’s name of an intrinsic object. The corresponding object must be an intrinsic that is intended to
be used as the [[Prototype]] value of an object.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>constructor</i>,
<i>intrinsicDefaultProto</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<i>proto</i>, <i>internalSlotsList</i>).</li>
</ol>
</section>
</section>
<section id="sec-ecmascript-function-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects" title="link to this section">9.2</a></span>
ECMAScript Function Objects</h1>
<p>ECMAScript function objects encapsulate parameterised ECMAScript code closed over a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a> and support the dynamic evaluation of that code. An ECMAScript
function object is an ordinary object and has the same internal slots and (except as noted below) the same internal methods
as other ordinary objects. The code of an ECMAScript function object may be either <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a>) or non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>.</p>
<p>ECMAScript function objects have the additional internal slots listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a>.</p>
<p>ECMAScript function objects whose code is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a>) provide an alternative definition for the [[GetOwnProperty]] internal method. This
alternative prevents the value of strict mode function from being revealed as the value of a function object property named
"<code>caller</code>". The alternative definition exist solely to preclude a non-standard legacy feature of some ECMAScript
implementations from revealing information about strict mode callers. If an implementation does not provide such a feature,
it need not implement this alternative internal method for ECMAScript function objects. ECMAScript function objects are
considered to be ordinary objects even though they may use the alternative definition of [[GetOwnProperty]].</p>
<figure>
<figcaption><span id="table-26">Table 26</span> -- Internal Slots of ECMAScript Function Objects</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[Environment]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a></td>
<td>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> that the function was closed over. Is used as the outer environment when evaluating the code of the function.</td>
</tr>
<tr>
<td>[[FormalParameters]]</td>
<td>Parse Node</td>
<td>The root parse node of the source code that defines the function’s formal parameter list.</td>
</tr>
<tr>
<td>[[FunctionKind]]</td>
<td>String</td>
<td>Either "<code>normal</code>" or "<code>generator</code>".</td>
</tr>
<tr>
<td>[[Code]]</td>
<td>Parse Node</td>
<td>The root parse node of the source code that defines the function’s body.</td>
</tr>
<tr>
<td>[[Realm]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> Record</td>
<td>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Code Realm</a> in which the function was created and which provides any intrinsic objects that are accessed when evaluating the function.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">[[ThisMode]]</td>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">(lexical, strict, global)</td>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">Defines how <code>this</code> references are interpreted within the formal parameters and code body of the function. <b>lexical</b> means that <code>this</code> refers to the <b>this</b> value of a lexically enclosing function. <b>strict</b> means that the <b>this</b> value is used exactly as provided by an invocation of the function. <b>global</b> means that a this value of <span class="value">undefined</span> is interpreted as a reference to the global object.</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">[[Strict]]</td>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080">Boolean</td>
<td style="border-bottom: 1px solid #808080; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080"><span class="value">true</span> if this is a strict mode function, <span class="value">false</span> this is not a strict mode function.</td>
</tr>
<tr>
<td>[[NeedsSuper]]</td>
<td>Boolean</td>
<td><span class="value">true</span> if this functions uses <code>super</code>.</td>
</tr>
<tr>
<td>[[HomeObject]]</td>
<td>Object</td>
<td>If the function uses <code>super</code>, this is the object whose [[GetPrototypeOf]] provides the object where super property lookups begin.</td>
</tr>
<tr>
<td>[[MethodName]]</td>
<td>String or Symbol</td>
<td>If the function uses <code>super</code>, this is the property keys that is used for unqualified references to <code>super</code>.</td>
</tr>
</tbody></table>
</figure>
<p>All ECMAScript function objects have the [[Call]] internal method defined here. ECMAScript functions that are also
constructors in addition have the [[Construct]] internal method. ECMAScript function objects whose code is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> have the [[Get]] and [[GetOwnProperty]] internal methods defined here.</p>
</div>
<section id="sec-construct-argumentslist">
<h1><span class="secnum" id="sec-9.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-argumentslist" title="link to this section">9.2.1</a></span>
[[Construct]] ( argumentsList)</h1>
<p>The [[Construct]] internal method for an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript Function object</a>
<var>F</var> is called with a single parameter <var>argumentsList</var> which is a possibly empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
values</a>. The following steps are taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
</section>
<section id="sec-ecmascript-function-objects-getownproperty-p">
<h1><span class="secnum" id="sec-9.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-getownproperty-p" title="link to this section">9.2.2</a></span> [[GetOwnProperty]] (P)</h1>
<p>When the [[GetOwnProperty]] internal method of non-strict <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function
object</a> <var>F</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the result of calling the default ordinary object [[GetOwnProperty]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p">9.1.5</a>) on <i>F</i> passing
<i>P</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>v</i>) is <b>true</b>, then
<ol class="block">
<li>If <i>P</i> is <code>"caller"</code> and <i>v</i>.[[Value]] is a strict mode Function object, then
<ol class="block">
<li>Set <i>v</i>.[[Value]] to <b>null</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return v.</li>
</ol>
<p>If an implementation does not provide a built-in <code>caller</code> property for non-strict ECMAScript function objects
then it must not use this definition. Instead the ordinary object [[GetOwnProperty]] internal method is used.</p>
</section>
<section id="sec-functionallocate">
<h1><span class="secnum" id="sec-9.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate" title="link to this section">9.2.3</a></span>
FunctionAllocate Abstract Operation</h1>
<p>The abstract operation FunctionAllocate requires the two arguments <span style="font-family: Times New
Roman"><i>functionPrototype</i> and <i>strict</i>.</span> It also accepts one optional argument, <var>functionKind</var>.
FunctionAllocate performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>functionPrototype</i>) is Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>functionKind</i> is present, its value is either
"<code>normal</code>" or "<code>generator</code>".</li>
<li>If <i>functionKind</i> is not present, then let <i>functionKind</i> be "<code>normal</code>".</li>
<li>Let <i>F</i> be a newly created <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> with the
internal slots listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a>. All of those internal slots are initialized to
<b>undefined</b>.</li>
<li>Set <i>F</i>’s essential internal methods except for [[GetOwnProperty]] to the default ordinary object
definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>If <i>strict</i> is <b>true</b>, set <i>F</i>’s [[GetOwnProperty]] internal method to the default ordinary
object definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Else, set <i>F</i>’s [[GetOwnProperty]] internal method to the definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-getownproperty-p">9.2.2</a>.</li>
<li>Set <i>F</i>’s [[Call]] internal method to the definition specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-argumentslist">9.2.1</a>.</li>
<li>Set the [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>strict</i>.</li>
<li>Set the [[FunctionKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>functionKind</i>.</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>functionPrototype</i>.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<b>true</b>.</li>
<li>Set the [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>Return <i>F</i>.</li>
</ol>
</section>
<section id="sec-ecmascript-function-objects-call-thisargument-argumentslist">
<h1><span class="secnum" id="sec-9.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist" title="link to this section">9.2.4</a></span> [[Call]] ( thisArgument, argumentsList)</h1>
<p>The [[Call]] internal method for an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>
<var>F</var> is called with parameters <var>thisArgument</var> and <var>argumentsList</var>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
values</a>. The following steps are taken:</p>
<ol class="proc">
<li>If <i>F</i>’s [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> has the value
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>callerContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>If <i>callerContext</i> is not already <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a>, then <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>callerContext</i>.</li>
<li>Let <i>calleeContext</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">ECMAScript Code execution context</a>.</li>
<li>Let <i>calleeRealm</i> be the value of <i>F’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Set <i>calleeContext’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> to <i>calleeRealm</i>.</li>
<li>Let <i>thisMode</i> be the value of <i>F</i>’s [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>needsThisWrapper</i> to <b>false.</b></li>
<li>If <i>thisMode</i> is <span style="font-family: sans-serif">lexical</span>, then
<ol class="block">
<li>Let <i>localEnv</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a> passing the value of the [[Environment]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>If <i>thisMode</i> is <span style="font-family: sans-serif">strict</span>, then let <i>thisValue</i> to
<i>thisArgument</i>.</li>
<li>Else
<ol class="block">
<li>if <i>thisArgument</i> is <b>null</b> or <b>undefined</b>, then
<ol class="block">
<li>Let <i>thisValue</i> to <i>calleeRealm</i>.[[globalThis]].</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>thisArgument</i>) is not Object, then let
<i>needsThisWrapper</i> to <b>true.</b>.</li>
<li>Let <i>thisValue</i> to <i>thisArgument</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>localEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newfunctionenvironment">NewFunctionEnvironment</a>(<i>F</i>,
<i>thisValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>localEnv</i>).</li>
<li><span style="font-family: sans-serif">NOTE Any exception objects produced by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newfunctionenvironment">NewFunctionEnvironment</a> are associated with</span> <i>callerReam</i>.</li>
</ol>
</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <i>calleeContext</i> to <i>localEnv</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> of <i>calleeContext</i> to <i>localEnv</i>.</li>
<li>Push <i>calleeContext</i> onto <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>calleeContext</i>
is now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>If <i>needsThisWrapper</i> is <b>true</b> then,
<ol class="block">
<li>Let <i>wrapperedThis</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>thisArgument</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>wrapperedThis</i> not not an abrupt conpletion.</li>
<li><span style="font-family: sans-serif">NOTE Wrappering deferred until</span> <i>calleeContext</i> <span style="font-family: sans-serif">is running so that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> produces objects
using</span> <i>calleeRealm</i>.</li>
<li>Let <i>funcionEnv</i> be <i>localEnv</i>’s environment.</li>
<li>Set <i>functionEnv</i>’s <i>thisValue</i> to <i>wrapperedThis</i>.</li>
</ol>
</li>
<li>Let <i>status</i> be the result of performing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation">Function Declaration
Instantiation</a> using the function <i>F</i>, <i>argumentsList</i> , and <i>localEnv</i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation">9.2.14</a>.</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>Remove <i>calleeContext</i> from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and restore
<i>callerContext</i> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Return <i>status</i>.</li>
</ol>
</li>
<li>Let <i>result</i> be the result of EvaluateBody of the production that is the value of <i>F</i>'s [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> passing <i>F</i> as the argument.</li>
<li>Remove <i>calleeContext</i> from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and restore
<i>callerContext</i> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> Most ECMAScript functions use a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records">Function
Environment Record</a> as their <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>. ECMAScript functions that are
arrow functions use a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">Declarative Environment Record</a> as their <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> When <i>calleeContext</i> is removed from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the
execution context stack</a> it must not be destroyed because it may have been <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> and retained by a generator object for later resumption<i>.</i></p>
</div>
</section>
<section id="sec-functioninitialize">
<h1><span class="secnum" id="sec-9.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioninitialize" title="link to this section">9.2.5</a></span>
FunctionInitialize Abstract Operation</h1>
<p>The abstract operation FunctionInitialize requires the arguments: a function object <var>F</var>, <var>kind</var> which
is one of (Normal, Method, Arrow), a parameter list production specified by <span class="nt">ParameterList</span>, a body
production specified by <span class="nt">Body</span>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a>
specified by <span style="font-family: Times New Roman"><i>Scope</i>.</span> FunctionInitialize performs the following
steps:</p>
<ol class="proc">
<li>Let <i>len</i> be the ExpectedArgumentCount of <i>ParameterList</i>.</li>
<li>Let <i>strict</i> be the vale of <i>F’s</i> [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i>, <code>"length"</code>,
PropertyDescriptor{[[Value]]: <i>len</i>, [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b>}).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>strict</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">AddRestrictedFunctionProperties</a>(<i>F</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Set the [[Environment]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to the
value of <i>Scope</i>.</li>
<li>Set the [[FormalParameters]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i>
to <i>ParameterList</i> .</li>
<li>Set the [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>Body</i>.</li>
<li>If <i>kind</i> is <span style="font-family: sans-serif">Arrow</span>, then set the [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to <span style="font-family:
sans-serif">lexical</span>.</li>
<li>Else if <i>strict</i> is <b>true</b>, then set the [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to <span style="font-family:
sans-serif">strict</span>.</li>
<li>Else set the [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<span style="font-family: sans-serif">global</span>.</li>
<li>Return <i>F</i>.</li>
</ol>
</section>
<section id="sec-functioncreate">
<h1><span class="secnum" id="sec-9.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate" title="link to this section">9.2.6</a></span>
FunctionCreate Abstract Operation</h1>
<p>The abstract operation FunctionCreate requires the arguments: <var>kind</var> which is one of (Normal, Method, Arrow), a
parameter list production specified by <span class="nt">ParameterList</span>, a body production specified by <span class="nt">Body</span>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> specified by <span class="nt">Scope</span>, a Boolean flag <span class="nt">Strict</span>, and optionally, an object <span style="font-family:
Times New Roman"><i>functionPrototype</i>.</span> FunctionCreate performs the following steps:</p>
<ol class="proc">
<li>If the <i>functionPrototype</i> argument was not passed, then
<ol class="block">
<li>Let <i>functionPrototype</i> be the intrinsic object %FunctionPrototype%.</li>
</ol>
</li>
<li>Let <i>F</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a>(<i>functionPrototype</i>, <i>Strict</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioninitialize">FunctionInitialize</a>(<i>F</i>, <i>kind</i>, <i>ParameterList</i>,
<i>Body</i>, <i>Scope</i>).</li>
</ol>
</section>
<section id="sec-generatorfunctioncreate">
<h1><span class="secnum" id="sec-9.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate" title="link to this section">9.2.7</a></span>
GeneratorFunctionCreate Abstract Operation</h1>
<p>The abstract operation GeneratorFunctionCreate requires the arguments: <var>kind</var> which is one of (Normal, Method,
Arrow), a parameter list production specified by <span class="nt">ParameterList</span>, a body production specified by <span class="nt">Body</span>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> specified by <span class="nt">Scope</span>, a Boolean flag <span class="nt">Strict</span>, and optionally, an object
<var>functionPrototype</var>. GeneratorFunctionCreate performs the following steps:</p>
<ol class="proc">
<li>If the <i>functionPrototype</i> argument was not passed, then
<ol class="block">
<li>Let <i>functionPrototype</i> be the intrinsic object %Generator%.</li>
</ol>
</li>
<li>Let <i>F</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a>(<i>functionPrototype</i>, <i>Strict</i>,
<code>"generator"</code>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioninitialize">FunctionInitialize</a>(<i>F</i>, <i>kind</i>, <i>ParameterList</i>,
<i>Body</i>, <i>Scope</i>).</li>
</ol>
</section>
<section id="sec-addrestrictedfunctionproperties">
<h1><span class="secnum" id="sec-9.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties" title="link to this section">9.2.8</a></span> AddRestrictedFunctionProperties Abstract Operation</h1>
<p>The abstract operation AddRestrictedFunctionProperties is called with a function object <var>F</var> as its argument. It
performs the following steps:</p>
<ol class="proc">
<li>Let <i>thrower</i> be the <span style="font-family: sans-serif">%ThrowTypeError%</span> intrinsic function
Object.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i>, <code>"caller"</code>,
PropertyDescriptor {[[Get]]: <i>thrower</i>, [[Set]]: <i>thrower</i>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b>}).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i> , <code>"arguments"</code>,
PropertyDescriptor {[[Get]]: <i>thrower</i>, [[Set]]: <i>thrower</i>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b>}).</li>
</ol>
<p>The %ThrowTypeError% object is a unique function object that is defined once for each <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> as follows:</p>
<ol class="proc">
<li>Let <i>realm</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> for which %ThrowTypeError% is being defined.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: %FunctionPrototype% for <i>realm</i> has already been
initialized.</li>
<li>Let <i>functionPrototype</i> be the intrinsic object %FunctionPrototype%.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the Global Environment</a> of <i>realm</i>.</li>
<li>Let <i>formalParameters</i> be the syntactic production: <span class="prod"><span class="nt">FormalParameters</span>
<span class="geq">:</span> <span class="grhsannot">[empty]</span></span> .</li>
<li>Let <i>steps</i> be the following algorithm steps:
<ol class="nested proc">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>F</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction">CreateBuiltinFunction</a>(<i>realm</i>, <i>steps</i>).</li>
<li>Call the [[PreventExtensions]] internal method of <i>F</i>.</li>
<li>Let %ThrowTypeError% be <i>F</i>.</li>
<li>Return <i>F.</i></li>
</ol>
</section>
<section id="sec-makeconstructor">
<h1><span class="secnum" id="sec-9.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor" title="link to this section">9.2.9</a></span>
MakeConstructor Abstract Operation</h1>
<p>The abstract operation MakeConstructor requires a Function argument <var>F</var> and optionally, a Boolean
<var>writablePrototype</var> and an object <var>prototype</var>. If <var>prototype</var> is provided it is assumed to
already contain, if needed, a <code>"constructor"</code> property whose value is <var>F</var>. This operation converts
<var>F</var> into a constructor by performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript
function object</a>.</li>
<li>Let <i>installNeeded</i> be <b>false</b>.</li>
<li>If the <i>prototype</i> argument was not provided, then
<ol class="block">
<li>Let <i>installNeeded</i> be <b>true</b>.</li>
<li>Let <i>prototype</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%ObjectPrototype%</span>).</li>
</ol>
</li>
<li>If the <i>writablePrototype</i> argument was not provided, then
<ol class="block">
<li>Let <i>writablePrototype</i> be <b>true</b>.</li>
</ol>
</li>
<li>Set <i>F</i>’s essential internal method [[Construct]] to the definition specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-argumentslist">9.2.1</a>.</li>
<li>If <i>installNeeded</i>, then
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>prototype</i>,
<code>"constructor"</code>, PropertyDescriptor{[[Value]]: <i>F</i>, [[Writable]]: <i>writablePrototype</i>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <i>writablePrototype</i> }).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i>,
<code>"prototype"</code>, and PropertyDescriptor{[[Value]]: <i>prototype</i>, [[Writable]]: <i>writablePrototype</i>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b>}.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</section>
<section id="sec-makemethod">
<h1><span class="secnum" id="sec-9.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod" title="link to this section">9.2.10</a></span> MakeMethod
( F, methodName, homeObject) Abstract Operation</h1>
<p>The abstract operation MakeMethod with arguments <var>F</var>, <var>methodName</var> and <var>homeObject</var> configures
<var>F</var> as a method by performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript
function object</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>methodName</i> is either <b>undefined</b> or a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>homeObject</i> ) is either Undefined or Object.</li>
<li>Set the [[NeedsSuper]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<b>true</b>.</li>
<li>Set the [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>homeObject</i>.</li>
<li>Set the [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>methodName</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</section>
<section id="sec-setfunctionname">
<h1><span class="secnum" id="sec-9.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname" title="link to this section">9.2.11</a></span>
SetFunctionName Abstract Operation</h1>
<p>The abstract operation SetFunctionName requires a Function argument <var>F</var>, a String or Symbol argument
<var>name</var> and optionally a String argument <var>prefix</var>. This operation adds a <code>name</code> property to
<var>F</var> by performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> is an extensible <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> that does not have a <code>name</code> own
property.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>name</i>)
is either Symbol or String.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>name</i>) is Symbol, then
<ol class="block">
<li>Let <i>description</i> be the values of <i>name</i>’s [[Description]].</li>
<li>If <i>description</i> is <b>undefined</b>, then let <i>name</i> be the empty String.</li>
<li>Else, let <i>name</i> be the concatenation of <code>"["</code>, <i>description</i>, and <code>"]"</code>.</li>
</ol>
</li>
<li>If <i>name</i> is not the empty string and <i>prefix</i> was passed, then let <i>name</i> be the concatenation of
<i>prefix</i>, Unicode code point U+0020 (Space) , and <i>name</i>.</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>F</i> with arguments <code>"name"</code> and
PropertyDescriptor{[[Value]]: <i>name</i>, [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b>}.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: Defining the <code>name</code> property will always succeed.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</section>
<section id="sec-getsuperbinding">
<h1><span class="secnum" id="sec-9.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperbinding" title="link to this section">9.2.12</a></span>
GetSuperBinding(obj) Abstract Operation</h1>
<p>The abstract operation GetSuperBinding is called with <var>obj</var> as its argument. It performs the following
steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>obj</i>) is not Object, then return
<b>undefined</b>.</li>
<li>If the value of <i>obj</i>’s [[NeedsSuper]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is not <b>true</b>, then return <b>undefined</b>.</li>
<li>Return the value of <i>obj’s</i> [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</section>
<section id="sec-clonemethod">
<h1><span class="secnum" id="sec-9.2.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonemethod" title="link to this section">9.2.13</a></span>
CloneMethod(function, newHome, newName) Abstract Operation</h1>
<p>The abstract operation Clone is called with a function object <var>function</var>, an object <var>newHome</var>, and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>newName</var> as its argument. It performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>function</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> or an exotic Built-in function object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>newHome</i>) is Object.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(newName) one
of Undefined, String, or Symbol.</li>
<li>If <i>function</i> is an ECMAScript function, then
<ol class="block">
<li>Let <i>new</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> that has all of
the same internal methods and internal slots as <i>function</i>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>function</i> is an exotic Built-in function object.</li>
<li>Let <i>new</i> be a new exotic Built-in function object that has all of the same internal methods and internal
slots as <i>function</i>.</li>
</ol>
</li>
<li>Set the value of each of <i>new’s</i> internal slots, except for [[Extensible]], [[HomeObject]] and
[[MethodName]] to the value of <i>function’s</i> corresponding <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Set <i>new</i>’s [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<b>true</b>.</li>
<li>If the value of <i>function</i>’s [[NeedsSuper]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>true</b>, then
<ol class="block">
<li>Set the value of <i>new’s</i> [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>newHome</i>.</li>
<li>If <i>newName</i> is not <b>undefined</b>, then
<ol class="block">
<li>Set the value of <i>new’s</i> [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>newName</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Set the value of <i>new’s</i> [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to the value of
<i>functions’s</i> [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>function</i> is an exotic Built-in function object or if <i>function</i>’s [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>true</b>, then
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">AddRestrictedFunctionProperties</a>(<i>new</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return <i>new</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The purpose of this abstract operation is to create a new function object that is
identical to the argument object in all always except for its identity and the value of its [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. However, properties of the function object,
except for the restricted function properties, are not created or copied.</p>
</div>
</section>
<section id="sec-function-declaration-instantiation">
<h1><span class="secnum" id="sec-9.2.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation" title="link to this section">9.2.14</a></span> Function Declaration Instantiation</h1>
<div class="note">
<p><span class="nh">NOTE</span> When an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> is established for
evaluating an ECMAScript function a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">Declarative Environment Record</a>
is created and bindings for each formal parameter are instantiated in that environment record. Each declaration in the
function body is also instantiated. If the function’s formal parameters do not include any default value
initializers then the body declarations are instantiated in the same environment record as the parameters. If default
value parameter initializers exist, a second environment record is created for the body declarations.. Formal parameters
and functions are initialized as part of function declaration instantiations. All other bindings are initialized during
evaluation of the function body.</p>
</div>
<p>Function Declaration Instantiation is performed as follows using arguments <var>func,</var> <var>argumentsList</var>, and
<var>env</var>. <var>func</var> is the function object that for which the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution
context</a> is being established. <var>env</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative
environment record</a> in which formal parameter bindings are to be created.</p>
<ol class="proc">
<li>Let <i>code</i> be the value of the [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>func</i>.</li>
<li>Let <i>strict</i> be the value of the [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>func</i>.</li>
<li>Let <i>formals</i> be the value of the [[FormalParameters]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>func</i>.</li>
<li>Let <i>parameterNames</i> be the BoundNames of <i>formals</i>.</li>
<li>If <i>parameterNames</i> has an duplicate entries, let <i>hasDuplicates</i> be true. Otherwise, let
<i>hasDuplicates</i> be false.</li>
<li>Let <i>needsParameterEnvironment</i> be ContainsExpression of <i>formals</i>.</li>
<li>Let <i>simpleParameterList</i> be IsSimpleParameterList of <i>formals</i>.</li>
<li>Let <i>varNames</i> be the VarDeclaratedNames of <i>code</i>.</li>
<li>Let <i>varDeclarations</i> be the VarScopedDeclarations of <i>code</i>.</li>
<li>Let <i>FunctionDeclarations</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>functionsToInitialize</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>d</i> in <i>varDeclarations</i>, in reverse list order do
<ol class="block">
<li>If <i>d</i> is not a <i>VariableStatement</i> then</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>d</i> is either a <i>FunctionDeclaration</i> or a
<i>GeneratorDeclaration</i>.</li>
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>d.</i></li>
<li>If <i>fn</i> is not an element of <i>functionNames</i>, then
<ol class="block">
<li>Remove <i>fn</i> from <i>varNames</i>.</li>
<li>Insert <i>fn</i> as the first element of <i>functionNames</i>.</li>
<li>NOTE If there are multiple <span style="font-family: Times New Roman"><i>FunctionDeclarations</i> or
<i>GeneratorDeclarations</i></span> for the same name, the last declaration is used.</li>
<li>Insert <i>d</i> as the first element of <i>functionsToInitialize</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>needsArgumentsBinding</i> be <b>true</b>.</li>
<li>Let <i>argumentsObjectNeeded</i> be <b>true</b>.</li>
<li>If the value of the [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>func</i> is lexical, then
<ol class="block">
<li>Let <i>needsArgumentsBinding</i> be <b>false</b>.</li>
</ol>
</li>
<li>Else if "<code>arguments</code>" is an element of <i>parameterNames</i>, then let <i>argumentsObjectNeeded</i> be
<b>false</b>.</li>
<li>Else if "<code>arguments</code>" is an element of <i>functionNames</i>, then let <i>argumentsObjectNeeded</i> be
<b>false</b>.</li>
<li>Else if "<code>arguments</code>" is an element of <i>lexicalNames</i>, then let <i>argumentsObjectNeeded</i> be
<b>false</b>.</li>
<li>If <i>needArgumentsBinding</i> is <b>true</b>, then
<ol class="block">
<li>If <i>strict</i> is <b>true</b>, <b>then</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> CreateImmutableBinding concrete method passing
"<code>arguments</code>" as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> CreateMutableBinding concrete method passing
"<code>arguments</code>" as the argument.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a></li>
<li>If <i>argumentsObjectNeeded</i> is <b>false</b>, then let <i>ao</i> be <b>undefined</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>ao</i> be InstantiateArgumentsObject(<i>argumentsList</i>)<i>.</i></li>
<li>If <i>strict</i> is <b>true</b> or if <i>simpleParameterList</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>ao</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createstrictargumentsobject">CreateStrictArgumentsObject</a>(<i>formals</i>,
<i>argumentsList</i>)<i>.</i></li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>ao</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmappedargumentsobject">CreateMappedArgumentsObject</a>(<i>func</i>,
<i>formals</i>, <i>argumentsList</i>, <i>env</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>ao</i>).</li>
</ol>
</li>
<li>Call <i>env</i>’s InitializeBinding concrete method passing "<code>arguments</code>" and <i>ao</i> as
arguments.</li>
</ol>
</li>
<li>For each String <i>paramName</i> in <i>parameterNames</i>, do
<ol class="block">
<li>Let <i>alreadyDeclared</i> be the result of calling <i>env’s</i> HasBinding concrete method passing
<i>paramName</i> as the argument.</li>
<li>NOTE Early errors ensure that duplicate parameter names can only occur in non-strict functions that do not have
parameter default values or rest parameters.</li>
<li>If <i>alreadyDeclared</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> CreateMutableBinding concrete method passing
<i>paramName</i> as the argument.</li>
<li>If <i>hasDuplicates</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> InitializeBinding concrete method passing
<i>paramName</i> and <b>undefined</b> as the argument.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> for either of the above
operations.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>hasDuplicates</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>formalStatus</i> be the result of performing IteratorBindingInitialisation for <i>formals</i> with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistiterator">CreateListIterator</a>(<i>argumentsList</i>) and <b>undefined</b> as
arguments.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>formalStatus</i> be the result of performing IteratorBindingInitialisation for <i>formals</i> with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistiterator">CreateListIterator</a>(<i>argumentsList</i>) and <i>env</i> as arguments.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>formalStatus</i>).</li>
<li>If <i>needsParameterEnvironment</i> is <b>true</b>, then
<ol class="block">
<li>NOTE A separate enviornemnt record is needed to ensure that closures created by parameter default value
expressions do not have visibility of declarations in the function body.</li>
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>env</i>).</li>
<li>Let <i>calleeContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <i>calleeContext</i> to <i>env</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> of <i>calleeContext</i> to <i>env</i>.</li>
</ol>
</li>
<li>For each <i>n</i> in <i>varNames</i>, do
<ol class="block">
<li>If <i>n</i> is not an element of <i>parameterNames</i>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> CreateMutableBinding concrete method passing
<i>n</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Call <i>env</i>’s InitializeBinding concrete method passing <i>n</i> and <b>undefined</b> as
arguments.</li>
<li>NOTE vars and functions whose names are the same as a formal parameter, use the same binding element as
the the parameter.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>lexDeclarations</i> be the LexicalDeclarations of <i>code</i>.</li>
<li>For each element <i>d</i> in <i>lexDeclarations</i> do
<ol class="block">
<li>NOTE A lexically declared name cannot be the same as a function/generator declaration, formal parameter, or a
var name. Lexically declared names are only instantiated here but not initialized.</li>
<li>For each element <i>dn</i> of the BoundNames of <i>d</i> do
<ol class="block">
<li>If IsConstantDeclaration of <i>d</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env</i>’s CreateImmutableBinding concrete method
passing <i>dn</i> as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env</i>’s CreateMutableBinding concrete method passing
<i>dn</i> and <b>false</b> as the arguments.</li>
</ol>
</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
<li>For each production <i>f</i> in <i>functionsToInitialize</i>, do
<ol class="block">
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>f.</i></li>
<li>Let <i>fo</i> be the result of performing InstantiateFunctionObject for <i>f</i> with argument <i>env</i>.</li>
<li>Let <i>fref</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvebinding">ResolveBinding</a>(<i>fn</i>).</li>
<li>Let <i>status</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>fref</i>, <i>fo</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
</ol>
</section>
</section>
<section id="sec-built-in-function-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects" title="link to this section">9.3</a></span>
Built-in Function Objects</h1>
<p>The built-in function objects defined in this specification may be implemented as either ECMAScript function objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">9.2</a>) whose behaviour is provided using ECMAScript code or as implementation
provided exotic function objects whose behaviour is provided in some other manner. In either case, the effect of calling
such functions must conform to their specifications.</p>
<p>If a built-in function object is implemented as an exotic object it must have the ordinary object behaviour specified in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a> except [[GetOwnProperty]] which must be as
specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-getownproperty-p">9.2.2</a>. All such exotic function objects also
have [[Prototype]] and [[Extensible]] internal slots.</p>
<p>Unless otherwise specified every built-in function object initially has the %FunctionPrototype% object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>) as the initial value of its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The behaviour specified for each built-in function via algorithm steps or other means is the specification of the
[[Call]] behaviour for that function with the [[Call]] <var>thisArgument</var> providing the <span class="value">this</span>
value and the [[Call]] <var>argumentsList</var> providing the named parameters for each built-in function. If the built-in
function is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> then this specified
behaviour must be implemented by the ECMAScript code that is the body of the function. Built-in functions that are
ECMAScript function objects must be strict mode functions.</p>
<p>Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method
unless otherwise specified in the description of a particular function. When a built-in constructor is called as part of a
<code>new</code> expression the <var>argumentsList</var> parameter of the invoked [[Construct]] internal method provides the
values for the built-in constructor’s named parameters.</p>
<p>Built-in functions that are not constructors do not have a <code>prototype</code> property unless otherwise specified in
the description of a particular function.</p>
<p>If a built-in function object is not implemented as an ECMAScript function it must have a [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. It must also have a [[Call]] internal method that
conforms to the following definition:</p>
</div>
<section id="sec-built-in-function-objects-call-thisargument-argumentslist">
<h1><span class="secnum" id="sec-9.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects-call-thisargument-argumentslist" title="link to this section">9.3.1</a></span> [[Call]] ( thisArgument, argumentsList)</h1>
<p>The [[Call]] internal method for a built-in function object <var>F</var> is called with parameters
<var>thisArgument</var> and <var>argumentsList</var>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>callerContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>If <i>callerContext</i> is not already <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a>, then <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>callerContext</i>.</li>
<li>Let <i>calleeContext</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a>.</li>
<li>Let <i>calleeRealm</i> be the value of <i>F’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Set <i>calleeContext’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> to <i>calleeRealm</i>.</li>
<li>Perform any necessary implementation defined initialisation of <i>calleeContext</i>.</li>
<li>Push <i>calleeContext</i> onto <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>calleeContext</i>
is now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>result</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> that is the result
of evaluating <i>F</i> in an implementation defined manner that conforms to this specification of <i>F</i>.</li>
<li>Remove <i>calleeContext</i> from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and restore
<i>callerContext</i> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> When <i>calleeContext</i> is removed from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the
execution context stack</a> it must not be destroyed because it may have been <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> and retained by a generator object for later resumption<i>.</i></p>
</div>
</section>
<section id="sec-createbuiltinfunction">
<h1><span class="secnum" id="sec-9.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction" title="link to this section">9.3.2</a></span>
CreateBuiltinFunction(realm, steps, internaSlotsList) Abstract Operation</h1>
<p>The abstract operation CreateBuiltinFunction takes arguments <var>realm</var> and <var>steps</var>. The optional argument
<var>internalSlotsList</var> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of the names of additional <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> that must be defined as part of the object. If the
list is not provided, an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> is used. CreateBuiltinFunction
returns a built-in function object created by the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>realm</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> Record.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>steps</i> is either a set of algorithm steps or other definition
of a functions behaviour provided in this specification.</li>
<li>Let <i>func</i> be a new built-in function object that when called performs the action described by <i>steps</i>. The
new function object has internal slots whose names are the the elements of <i>internalSlotsList</i>. The initial value
of each of those internal slots is <b>undefined<i>.</i></b></li>
<li>Set the [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>func</i> to
<i>realm</i>.</li>
<li>Perform the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">AddRestrictedFunctionProperties</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">9.2.8</a>) abstract operation with argument <i>func</i>.</li>
<li>Return <i>func</i>.</li>
</ol>
</section>
</section>
<section id="sec-built-in-exotic-object-internal-methods-and-data-fields">
<div class="front">
<h1><span class="secnum" id="sec-9.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-exotic-object-internal-methods-and-data-fields" title="link to this section">9.4</a></span> Built-in Exotic Object Internal Methods and Data Fields</h1>
<p>This specification defines several kinds of built-in exotic objects. These objects generally behave similar to ordinary
objects except for a few specific situations. The following exotic objects use the ordinary object internal methods except
where it is explicitly specified otherwise below:</p>
</div>
<section id="sec-bound-function-exotic-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects" title="link to this section">9.4.1</a></span> Bound Function Exotic Objects</h1>
<p>A <i>bound function</i> is an exotic object that wrappers another function object. A bound function is callable (it has
a [[Call]] internal method and may have a [[Construct]] internal method). Calling a bound function generally results in a
call of its wrapped function.</p>
<p>Bound function objects do not have the internal slots of ECMAScript function objects defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a>. Instead they have the internal slots defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-27">Table 27</a>.</p>
<figure>
<figcaption><span id="table-27">Table 27</span> -- Internal Slots of Exotic Bound Function Objects</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[BoundTargetFunction]]</td>
<td>Callable Object</td>
<td>The wrappered function object.</td>
</tr>
<tr>
<td>[[BoundThis]]</td>
<td>Any</td>
<td>The value that is always passed as the <b>this</b> value when calling the wrappered function.</td>
</tr>
<tr>
<td>[[BoundArguments]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of Any</td>
<td>A list of values that whose elements are used as the first arguments to any call to the wrappered function.</td>
</tr>
</tbody></table>
</figure>
<p>Unlike ECMAScript function objects, bound function objects do not use alternative definitions of the [[Get]] and
[[GetOwnProperty]] internal methods. Bound function objects provide all of the essential internal methods as specified in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>. However, they use the following definitions
for the essential internal methods of function objects.</p>
</div>
<section id="sec-call">
<h1><span class="secnum" id="sec-9.4.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call" title="link to this section">9.4.1.1</a></span>
[[Call]]</h1>
<p>When the [[Call]] internal method of an exotic <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">bound function</a> object,
<var>F</var>, which was created using the bind function is called with parameters <var>thisArgument</var> and
<var>argumentsList</var>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>boundArgs</i> be the value of <i>F’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundArguments]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>boundThis</i> be the value of <i>F’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundThis]]</a>
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>target</i> be the value of <i>F’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundTargetFunction]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>args</i> be a new list containing the same values as the list <i>boundArgs</i> in the same order followed by
the same values as the list <i>argumentsList</i> in the same order.</li>
<li>Return the result of calling the [[Call]] internal method of <i>target</i> providing <i>boundThis</i> as
<i>thisArgument</i> and providing <i>args</i> as <i>argumentsList</i>.</li>
</ol>
</section>
<section id="sec-bound-function-exotic-objects-construct">
<h1><span class="secnum" id="sec-9.4.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects-construct" title="link to this section">9.4.1.2</a></span> [[Construct]]</h1>
<p>When the [[Construct]] internal method of an exotic <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">bound function</a>
object, <var>F</var> that was created using the bind function is called with a list of arguments <span class="nt">ExtraArgs</span>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>target</i> be the value of <i>F’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundTargetFunction]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>target</i> has a [[Construct]] internal method.</li>
<li>Let <i>boundArgs</i> be the value of <i>F’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundArguments]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>args</i> be a new list containing the same values as the list <i>boundArgs</i> in the same order followed by
the same values as the list <i>ExtraArgs</i> in the same order.</li>
<li>Return the result of calling the [[Construct]] internal method of <i>target</i> providing <i>args</i> as the
arguments.</li>
</ol>
</section>
<section id="sec-boundfunctioncreate">
<h1><span class="secnum" id="sec-9.4.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boundfunctioncreate" title="link to this section">9.4.1.3</a></span> BoundFunctionCreate Abstract Operation</h1>
<p>The abstract operation BoundFunctionCreate with arguments <var>targetFunction</var>, <var>boundThis</var> and
<var>boundArgs</var> is used to specify the creation of new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">Bound
Function</a> exotic objects. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>proto</i> be the intrinsic <span style="font-family: sans-serif">%FunctionPrototype%</span>.</li>
<li>Let <i>obj</i> be a newly created object.</li>
<li>Set <i>obj</i>’s essential internal methods to the default ordinary object definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Set the [[Call]] internal method of <i>obj</i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call">9.4.1.1</a>.</li>
<li>If <i>targetFunction</i> has a [[Construct]] internal method, then
<ol class="block">
<li>Set the [[Construct]] internal method of <i>obj</i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects-construct">9.4.1.2</a>.</li>
</ol>
</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to
<i>proto</i>.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to
<b>true</b>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundTargetFunction]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to
<i>targetFunction</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundThis]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to the value of
<i>boundThis</i>.</li>
<li>Set the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundArguments]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to <i>boundArgs</i>.</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
</section>
<section id="sec-array-exotic-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects" title="link to this section">9.4.2</a></span>
Array Exotic Objects</h1>
<p>An <i>Array object</i> is an exotic object that gives special treatment to a certain class of property names. A
property name <var>P</var> (in the form of a String value) is an <i>array index</i> if and only if <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>P</i>))</span> is equal to <var>P</var> and <span style="font-family: Times New
Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>P</i>)</span> is not equal to <span style="font-family: Times New
Roman">2<sup>32</sup>−1</span>. A property whose property name is an array index is also called an <i>element</i>.
Every Array object has a <code>length</code> property whose value is always a nonnegative integer less than <span style="font-family: Times New Roman">2<sup>32</sup></span>. The value of the <code>length</code> property is numerically
greater than the name of every property whose name is an array index; whenever a property of an Array object is created or
changed, other properties are adjusted as necessary to maintain this invariant. Specifically, whenever a property is added
whose name is an array index, the <code>length</code> property is changed, if necessary, to be one more than the numeric
value of that array index; and whenever the <code>length</code> property is changed, every property whose name is an array
index whose value is not smaller than the new length is automatically deleted. This constraint applies only to own
properties of an Array object and is unaffected by <code>length</code> or array index properties that may be inherited
from its prototypes.</p>
<p>Exotic Array objects have the same internal slots as ordinary objects. They also have an [[ArrayInitialisationState]]
internal slot.</p>
<p>Exotic Array objects always have a non-configurable property named <b>"<span style="font-family:
monospace">length</span>"</b>.</p>
<p>Exotic Array objects provide an alternative definition for the [[DefineOwnProperty]] internal method. Except for that
internal method, exotic Array objects provide all of the other essential internal methods as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</p>
</div>
<section id="sec-array-exotic-objects-defineownproperty-p-desc">
<h1><span class="secnum" id="sec-9.4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects-defineownproperty-p-desc" title="link to this section">9.4.2.1</a></span> [[DefineOwnProperty]] ( P, Desc)</h1>
<p>When the [[DefineOwnProperty]] internal method of an exotic Array object <var>A</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property
Descriptor</a> <span class="nt">Desc</span> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>If <i>P</i> is <b>"</b>length<b>"</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraysetlength">ArraySetLength</a>(<i>A</i>, <i>Desc</i>).</li>
</ol>
</li>
<li>Else if <i>P</i> is an array index, then
<ol class="block">
<li>Let <i>oldLen</i> be <i>oldLenDesc</i>.[[Value]].</li>
<li>Let <i>index</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>P</i>).</li>
<li>Let <i>oldLenDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>A</i> passing
<b>"<span style="font-family: monospace">length</span>"</b> as the argument. The result will never be
<b>undefined</b> or an accessor descriptor because Array objects are created with a length data property that
cannot be deleted or reconfigured.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>index</i> will never be an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <i>index</i> ≥ <i>oldLen</i> and <i>oldLenDesc</i>.[[Writable]] is <b>false</b>, then return
<b>false</b>.</li>
<li>Let <i>succeeded</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> passing <i>A</i>, <i>P</i>, and <i>Desc</i>
as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>succeeded</i>).</li>
<li>If <i>succeeded</i> is <b>false</b>, then return <b>false</b>.</li>
<li>If <i>index</i> ≥ <i>oldLen</i>
<ol class="block">
<li>Set <i>oldLenDesc</i>.[[Value]] to <i>index</i> + 1.</li>
<li>Let <i>succeeded</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>A</i>,
<b>"<span style="font-family: monospace">length</span>"</b>, <i>oldLenDesc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>succeeded</i>).</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>A</i>, <i>P</i>, <i>Desc</i>).</li>
</ol>
</section>
<section id="sec-arraycreate">
<h1><span class="secnum" id="sec-9.4.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate" title="link to this section">9.4.2.2</a></span>
ArrayCreate(length) Abstract Operation</h1>
<p>The abstract operation ArrayCreate with argument <var>length</var> (a positive integer or <span class="value">undefined</span>) and optional argument <var>proto</var> is used to specify the creation of new exotic Array
objects. It performs the following steps:</p>
<ol class="proc">
<li>If the <i>proto</i> argument was not passed, then let <i>proto</i> be the intrinsic object <span style="font-family:
sans-serif">%ArrayPrototype%</span>.</li>
<li>Let <i>A</i> be a newly created <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects">Array exotic object</a>.</li>
<li>Set <i>A</i>’s essential internal methods except for [[DefineOwnProperty]] to the default ordinary object
definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Set the [[DefineOwnProperty]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects-defineownproperty-p-desc">9.4.2.1</a>.</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>A</i> to
<i>proto</i>.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>A</i> to
<b>true</b>.</li>
<li>If <i>length</i> is not <b>undefined</b>, then
<ol class="block">
<li>Set the [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
of <i>A</i> to <b>true</b>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Set the [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
of <i>A</i> to <b>false</b>.</li>
<li>Let <i>length</i> be 0.</li>
</ol>
</li>
<li>If <i>length</i>&gt;2<sup>32</sup>-1, then throw a <b>RangeError</b> exception.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> with arguments <i>A</i>,
<code>"length"</code> and PropertyDescriptor{[[Value]]: <i>length</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>false</b>, [[Configurable]]: <b>false</b>}.</li>
<li>Return <i>A</i>.</li>
</ol>
</section>
<section id="sec-arraysetlength">
<h1><span class="secnum" id="sec-9.4.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraysetlength" title="link to this section">9.4.2.3</a></span>
ArraySetLength(A, Desc) Abstract Operation</h1>
<p>When the abstract operation ArraySetLength is called with an exotic Array object <span style="font-family: Times New
Roman"><i>A</i>,</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span> the following steps are taken:</p>
<ol class="proc">
<li>If the [[Value]] field of <i>Desc</i> is absent, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>A</i>, <b>"<span style="font-family: monospace">length</span>"</b>, <i>Desc</i>).</li>
</ol>
</li>
<li>Let <i>newLenDesc</i> be a copy of <i>Desc</i>.</li>
<li>Let <i>newLen</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>Desc</i>.[[Value]]).</li>
<li>If <i>newLen</i> is not equal to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>( <i>Desc</i>.[[Value]]), throw a
<b>RangeError</b> exception.</li>
<li>Set <i>newLenDesc</i>.[[Value]] to <i>newLen</i>.</li>
<li>Let <i>oldLenDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>A</i> passing <b>"<span style="font-family: monospace">length</span>"</b> as the argument. The result will never be <b>undefined</b> or an
accessor descriptor because Array objects are created with a length data property that cannot be deleted or
reconfigured.</li>
<li>Let <i>oldLen</i> be <i>oldLenDesc</i>.[[Value]].</li>
<li>If <i>newLen</i> ≥<i>oldLen</i>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>A</i>, <b>"<span style="font-family: monospace">length</span>"</b>, <i>newLenDesc</i>).</li>
</ol>
</li>
<li>If <i>oldLenDesc</i>.[[Writable]] is <b>false</b>, then return <b>false</b>.</li>
<li>If <i>newLenDesc</i>.[[Writable]] is absent or has the value <b>true</b>, let <i>newWritable</i> be
<b>true</b>.</li>
<li>Else,
<ol class="block">
<li>Need to defer setting the [[Writable]] attribute to <b>false</b> in case any elements cannot be deleted.</li>
<li>Let <i>newWritable</i> be <b>false</b>.</li>
<li>Set <i>newLenDesc</i>.[[Writable]] to <b>true</b>.</li>
</ol>
</li>
<li>Let <i>succeeded</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>A</i>, <b>"<span style="font-family: monospace">length</span>"</b>, <i>newLenDesc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>succeeded</i>).</li>
<li>If <i>succeeded</i> is <b>false</b>, return <b>false</b>.</li>
<li>While <i>newLen</i> &lt; <i>oldLen</i> repeat,
<ol class="block">
<li>Set <i>oldLen</i> to <i>oldLen</i> – 1.</li>
<li>Let <i>deleteSucceeded</i> be the result of calling the [[Delete]] internal method of <i>A</i> passing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>oldLen</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>succeeded</i>).</li>
<li>If <i>deleteSucceeded</i> is <b>false</b>, then
<ol class="block">
<li>Set <i>newLenDesc</i>.[[Value]] to <i>oldLen+1</i>.</li>
<li>If <i>newWritable</i> is <b>false</b>, set <i>newLenDesc</i>.[[Writable]] to <b>false</b>.</li>
<li>Let <i>succeeded</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>A</i>,
<b>"<span style="font-family: monospace">length</span>"</b>, <i>newLenDesc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>succeeded</i>).</li>
<li>Return <b>false</b>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>newWritable</i> is <b>false</b>, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a> passing <i>A</i>, <b>"<span style="font-family: monospace">length</span>"</b>, and PropertyDescriptor{[[Writable]]: <b>false</b>} as
arguments. This call will always return <b>true</b>.</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> In steps 3 and 4, if <i>Desc</i>.[[Value]] is an object then its <code>valueOf</code>
method is called twice. This is legacy behaviour that was specified with this effect starting with the 2<sup>nd</sup>
Edition of this specification.</p>
</div>
</section>
</section>
<section id="sec-string-exotic-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects" title="link to this section">9.4.3</a></span>
String Exotic Objects</h1>
<p>A <i>String object</i> is an exotic object that encapsulates a String value and exposes virtual integer indexed data
properties corresponding to the individual code unit elements of the string value. Exotic String objects always have a
data property named <b>"<span style="font-family: monospace">length</span>"</b> whose value is the number of code unit
elements in the encapsulated String value. Both the code unit data properties and the <b>"<span style="font-family:
monospace">length</span>"</b> property are non-writable and non-configurable.</p>
<p>Exotic String objects have the same internal slots as ordinary objects. They also have a [[StringData]] internal
slot.</p>
<p>Exotic String objects provide alternative definitions for the following internal methods. All of the other exotic
String object essential internal methods that are not defined below are as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</p>
</div>
<section id="sec-string-exotic-objects-getownproperty-p">
<h1><span class="secnum" id="sec-9.4.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-getownproperty-p" title="link to this section">9.4.3.1</a></span> [[GetOwnProperty]] ( P )</h1>
<p>When the [[GetOwnProperty]] internal method of an exotic String object <var>S</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>desc</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a>(<i>S</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>If <i>desc</i> is not <b>undefined</b> return <i>desc</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>P</i>) is not String, then return
<b>undefined</b>.</li>
<li>Let <i>index</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>index</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Let <i>absIntIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>index</i>)).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>absIntIndex</i>, <i>P</i>) is <b>false</b> return
<b>undefined</b>.</li>
<li>Let <i>str</i> be the String value of the [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>S</i>, if the value of [[StringData]]
is <b>undefined</b> the empty string is used as its value.</li>
<li>Let <i>len</i> be the number of elements in <i>str</i>.</li>
<li>If <i>len</i> ≤ <i>index</i>, return <b>undefined</b>.</li>
<li>Let <i>resultStr</i> be a String value of length 1, containing one code unit from <i>str</i>, specifically the code
unit at position <i>index</i>, where the first (leftmost) element in <i>str</i> is considered to be at position 0,
the next one at position 1, and so on.</li>
<li>Return a PropertyDescriptor{ [[Value]]: <i>resultStr</i>, [[Enumerable]]: <b>true</b>, [[Writable]]: <b>false</b>,
[[Configurable]]: <b>false</b> }.</li>
</ol>
</section>
<section id="sec-string-exotic-objects-enumerate">
<h1><span class="secnum" id="sec-9.4.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-enumerate" title="link to this section">9.4.3.2</a></span> [[Enumerate]] ()</h1>
<p>When the [[Enumerate]] internal method of an exotic String object <var>O</var> is called the following steps are
taken:</p>
</section>
<section id="sec-string-exotic-objects-ownpropertykeys">
<h1><span class="secnum" id="sec-9.4.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-ownpropertykeys" title="link to this section">9.4.3.3</a></span> [[OwnPropertyKeys]] ( )</h1>
<p>When the [[OwnPropertyKeys]] internal method of an exotic String object <var>O</var> is called the following steps are
taken:</p>
</section>
<section id="sec-stringcreate">
<h1><span class="secnum" id="sec-9.4.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-stringcreate" title="link to this section">9.4.3.4</a></span>
StringCreate Abstract Operation</h1>
<p>The abstract operation StringCreate with argument <var>prototype</var> is used to specify the creation of new exotic
String objects. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>A</i> be a newly created <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects">String exotic object</a>.</li>
<li>Set <i>A</i>’s essential internal methods to the default ordinary object definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Set the [[GetOwnProperty]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-getownproperty-p">9.4.3.1</a>.</li>
<li>Set the [[DefineOwnProperty]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-enumerate">9.4.3.2</a>.</li>
<li>Set the [[Enumerate]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-enumerate">9.4.3.2</a>.</li>
<li>Set the [[OwnPropertyKeys]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-exotic-objects-ownpropertykeys">9.4.3.3</a>.</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>A</i> to
<i>prototype</i>.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>A</i> to
<b>true</b>.</li>
<li>Return <i>A</i>.</li>
</ol>
</section>
</section>
<section id="sec-arguments-exotic-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects" title="link to this section">9.4.4</a></span> Arguments Exotic Objects</h1>
<p>Most ECMAScript functions make an arguments objects available to their code. Depending upon the characteristics of the
function definition, its argument object is either an ordinary object or an <i>arguments exotic object</i>. An aguments
exotic object is an exotic object whose array index properties map to the formal parameters bindings of an invocation of
its associated ECMAScript function.</p>
<p>Arguments exotic objects have the same internal slots as ordinary objects. They also have a [[ParameterMap]] internal
slot.</p>
<p>Arguments exotic objects provide alternative definitions for the following internal methods. All of the other exotic
arguments object essential internal methods that are not defined below are as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a></p>
<div class="note">
<p><span class="nh">NOTE 1</span> For non-strict mode functions the integer indexed data properties of an arguments
object whose numeric name values are less than the number of formal parameters of the corresponding function object
initially share their values with the corresponding argument bindings in the function’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a>. This means that changing the property changes the corresponding
value of the argument binding and vice-versa. This correspondence is broken if such a property is deleted and then
redefined or if the property is changed into an accessor property. For strict mode functions, the values of the
arguments object’s properties are simply a copy of the arguments passed to the function and there is no dynamic
linkage between the property values and the formal parameter values.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The ParameterMap object and its property values are used as a device for specifying
the arguments object correspondence to argument bindings. The ParameterMap object and the objects that are the values of
its properties are not directly observable from ECMAScript code. An ECMAScript implementation does not need to actually
create or use such objects to implement the specified semantics.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> Arguments objects for strict mode functions define non-configurable accessor
properties named "<code>caller</code>" and "<code>callee</code>" which throw a <b>TypeError</b> exception on access. The
"<code>callee</code>" property has a more specific meaning for non-strict mode functions and a "<code>caller</code>"
property has historically been provided as an implementation-defined extension by some ECMAScript implementations. The
strict mode definition of these properties exists to ensure that neither of them is defined in any other manner by
conforming ECMAScript implementations.</p>
</div>
</div>
<section id="sec-arguments-exotic-objects-getownproperty-p">
<h1><span class="secnum" id="sec-9.4.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-getownproperty-p" title="link to this section">9.4.4.1</a></span> [[GetOwnProperty]] (P)</h1>
<p>The [[GetOwnProperty]] internal method of an arguments exotic object for a function when called with a property name
<var>P</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>desc</i> be the result of calling the default [[GetOwnProperty]] internal method for ordinary objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p">9.1.5</a>) on the arguments object
passing <i>P</i> as the argument.</li>
<li>If <i>desc</i> is <b>undefined</b> then return <i>desc</i>.</li>
<li>Let <i>map</i> be the value of the [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the arguments object.</li>
<li>Let <i>isMapped</i> be the result of calling the [[GetOwnProperty]] internal method of <i>map</i> passing <i>P</i>
as the argument.</li>
<li>If the value of <i>isMapped</i> is not <b>undefined</b>, then
<ol class="block">
<li>Set <i>desc</i>.[[Value]] to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>map</i>, <i>P</i>).</li>
</ol>
</li>
<li>If IsDATADescriptor(<i>desc</i>) is <b>true</b> and <i>P</i> is <code>"caller"</code> and <i>desc</i>.[[Value]] is a
strict mode Function object, throw a <b>TypeError</b> exception.</li>
<li>Return <i>desc</i>.</li>
</ol>
</section>
<section id="sec-arguments-exotic-objects-defineownproperty-p-desc">
<h1><span class="secnum" id="sec-9.4.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-defineownproperty-p-desc" title="link to this section">9.4.4.2</a></span> [[DefineOwnProperty]] (P, Desc)</h1>
<p>The [[DefineOwnProperty]] internal method of an arguments exotic object for a function when called with a property name
<var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> <span class="nt">Desc</span> performs the following steps:</p>
<ol class="proc">
<li>Let <i>map</i> be the value of the [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the arguments object.</li>
<li>Let <i>isMapped</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>map</i>, <i>P</i>).</li>
<li>Let <i>allowed</i> be the result of calling the default [[DefineOwnProperty]] internal method for ordinary objects
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc">9.1.6</a>) on the
arguments object passing <i>P</i> and <i>Desc</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>allowed</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <i>allowed</i> is <b>false</b>, then return <b>false</b>.</li>
<li>If the value of <i>isMapped</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>Desc</i>) is <b>true</b>, then
<ol class="block">
<li>Call the [[Delete]] internal method of <i>map</i> passing <i>P</i> as the argument.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>If <i>Desc</i>.[[Value]] is present, then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>map</i>, <i>P</i>,
<i>Desc</i>.[[Value]], <b>false</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>putStatus</i> is <b>true</b> because formal
parameters mapped by argument objects are always writable.</li>
</ol>
</li>
<li>If <i>Desc</i>.[[Writable]] is present and its value is <b>false</b>, then
<ol class="block">
<li>Call the [[Delete]] internal method of <i>map</i> passing <i>P</i> as the argument.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-arguments-exotic-objects-get-p-receiver">
<h1><span class="secnum" id="sec-9.4.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-get-p-receiver" title="link to this section">9.4.4.3</a></span> [[Get]] (P, Receiver)</h1>
<p>The [[Get]] internal method of an arguments exotic object for a with formal parameters when called with a property name
<var>P</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>args</i> be the arguments object.</li>
<li>Let <i>map</i> be the value of the [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the arguments object.</li>
<li>Let <i>isMapped</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>map</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>isMapped</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If the value of <i>isMapped</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>v</i> be the result of calling the default ordinary object [[Get]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver">9.1.8</a>) on <i>args</i> passing
<i>P</i> and <i>args</i> as the arguments.</li>
</ol>
</li>
<li>Else <i>map</i> contains a formal parameter mapping for <i>P</i>,
<ol class="block">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>map</i>, <i>P</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>.</li>
<li>If <i>P</i> is <code>"caller"</code> and <i>v</i> is a strict mode Function object, throw a <b>TypeError</b>
exception.</li>
<li>Return <i>v</i>.</li>
</ol>
</section>
<section id="sec-arguments-exotic-objects-set-p-v-receiver">
<h1><span class="secnum" id="sec-9.4.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-set-p-v-receiver" title="link to this section">9.4.4.4</a></span> [[Set]] ( P, V, Receiver)</h1>
<p>The [[Get]] internal method of an arguments exotic object for a with formal parameters when called with a property name
<var>P</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>args</i> be the arguments object.</li>
<li>Let <i>map</i> be the value of the [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the arguments object.</li>
<li>Let <i>isMapped</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>map</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>isMapped</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If the value of <i>isMapped</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the default ordinary object [[Set]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver">9.1.8</a>) on <i>args</i> passing
<i>P</i>, <i>V</i> and <i>receiver</i> as the arguments.</li>
</ol>
</li>
<li>Else <i>map</i> contains a formal parameter mapping for <i>P</i>,
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>map</i>, <i>P</i>, <i>V</i>, <b>false</b>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-arguments-exotic-objects-delete-p">
<h1><span class="secnum" id="sec-9.4.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-delete-p" title="link to this section">9.4.4.5</a></span> [[Delete]] (P)</h1>
<p>The [[Delete]] internal method of an arguments exotic object for a function with formal parameters when called with a
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>map</i> be the value of the [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the arguments object.</li>
<li>Let <i>isMapped</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>map</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>isMapped</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Let <i>result</i> be the result of calling the default [[Delete]] internal method for ordinary objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-delete-p">9.1.10</a>) on the arguments object passing
<i>P</i> as the argument.</li>
<li>If <i>result</i> is <b>true</b> and the value of <i>isMapped</i> is not <b>undefined</b>, then
<ol class="block">
<li>Call the [[Delete]] internal method of <i>map</i> passing <i>P</i> as the argument.</li>
</ol>
</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> For non-strict mode functions with simple parameter lists, those integer indexed data
properties of an arguments object whose numeric name values are less than the number of formal parameters of the
function initially share their values with the corresponding argument bindings in the function’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a>. This means that changing the property changes the corresponding
value of the argument binding and vice-versa. This correspondence is broken if such a property is deleted and then
redefined or if the property is changed into an accessor property. For strict mode functions, the values of the
arguments object’s properties are simply a copy of the arguments passed to the function and there is no dynamic
linkage between the property values and the formal parameter values.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The ParameterMap object and its property values are used as a device for specifying
the arguments object correspondence to argument bindings. The ParameterMap object and the objects that are the values of
its properties are not directly accessible from ECMAScript code. An ECMAScript implementation does not need to actually
create or use such objects to implement the specified semantics.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> Arguments objects for strict mode functions define non-configurable accessor
properties named "<code>caller</code>" and "<code>callee</code>" which throw a <b>TypeError</b> exception on access. The
"<code>callee</code>" property has a more specific meaning for non-strict mode functions and a "<code>caller</code>"
property has historically been provided as an implementation-defined extension by some ECMAScript implementations. The
strict mode definition of these properties exists to ensure that neither of them is defined in any other manner by
conforming ECMAScript implementations.</p>
</div>
</section>
<section id="sec-createstrictargumentsobject">
<h1><span class="secnum" id="sec-9.4.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createstrictargumentsobject" title="link to this section">9.4.4.6</a></span> CreateStrictArgumentsObject(formals, argumentsList) Abstract
Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CreateStrictArgumentsObject</span> called with an
arguments <var>formals</var> and <var>argumentsList</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>len</i> be the number of elements in <i>argumentsList</i>.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>obj</i>, <b>"<span style="font-family:
monospace">length</span>"</b>, PropertyDescriptor{[[Value]]: <i>len</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>false</b>, [[Configurable]]: <b>true</b>}).</li>
<li>Let <i>index</i> be 0.</li>
<li>Repeat while <i>index</i> &lt; <i>len</i>,
<ol class="block">
<li>Let <i>val</i> be the element of <i>argumentsList</i> at 0-origined list position <i>index</i>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>obj</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>), <i>val</i>).</li>
<li>Let <i>index</i> be <i>index</i> + 1</li>
</ol>
</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i>, <code>"caller"</code>,
PropertyDescriptor {[[Get]]: <i>thrower</i>, [[Set]]: <i>thrower</i>, [[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>false</b>}).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i>, <code>"callee"</code>,
PropertyDescriptor {[[Get]]: <i>thrower</i>, [[Set]]: <i>thrower</i>, [[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>false</b>}).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: the above property definitions will not produce an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Return <i>obj</i></li>
</ol>
</section>
<section id="sec-createmappedargumentsobject">
<div class="front">
<h1><span class="secnum" id="sec-9.4.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmappedargumentsobject" title="link to this section">9.4.4.7</a></span> CreateMappedArgumentsObject ( func, formals, argumentsList, env )
Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CreateMappedArgumentsObject</span> is called with
object <var>func</var>, grammar production <var>formals</var>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <var>argumentsList</var>, and environment record
<var>env</var>The following steps are performed:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>formals</i> does not contain a rest parameter, any binding
patterns, or any initializers. It may contain duplicate identifiers.</li>
<li>Let <i>len</i> be the number of elements in <i>argumentsList</i>.</li>
<li>Let <i>obj</i> be a newly created arguments exotic object with a [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Set the [[GetOwnProperty]] internal method of <i>obj</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-getownproperty-p">9.4.4.1</a>.</li>
<li>Set the [[DefineOwnProperty]] internal method of <i>obj</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-defineownproperty-p-desc">9.4.4.2</a>.</li>
<li>Set the [[Get]] internal method of <i>obj</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-get-p-receiver">9.4.4.3</a>.</li>
<li>Set the [[Set]] internal method of <i>obj</i> as specified in 8.</li>
<li>Set the [[Delete]] internal method of <i>obj</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects-delete-p">9.4.4.5</a>.</li>
<li>Set the remainder of <i>obj</i>’s essential internal methods to the default ordinary object definitions
specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i> to
%ObjectPrototype%.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i>
to <b>true</b>.</li>
<li>Let <i>parameterNames</i> be the BoundNames of <i>formals</i>.</li>
<li>Let <i>numberOfParameters</i> be the number of elements in <i>parameterNames</i></li>
<li>Let <i>index</i> be 0.</li>
<li>Repeat while <i>index</i> &lt; <i>len</i> ,
<ol class="block">
<li>Let <i>val</i> be the element of <i>args</i> at 0-origined list position <i>index</i>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>obj</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>), <i>val</i>).</li>
<li>Let <i>index</i> be <i>index</i> + 1</li>
</ol>
</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>obj</i>, <b>"<span style="font-family:
monospace">length</span>"</b>, PropertyDescriptor{[[Value]]: <i>len</i>, [[Writable]]: <b>true</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>true</b>}).</li>
<li>Let <i>map</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(null).</li>
<li>Let <i>mappedNames</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>index</i> be <i>numberOfParameters</i> − 1.</li>
<li>Repeat while <i>index</i> ≥ 0 ,
<ol class="block">
<li>Let <i>name</i> be the element of <i>parameterNames</i> at 0-origined list position <i>index</i>.</li>
<li>If <i>name</i> is not an element of <i>mappedNames</i>, then
<ol class="block">
<li>Add <i>name</i> as an element of the list <i>mappedNames</i>.</li>
<li>Let <i>g</i> be MakeArgGetter(<i>name</i>, <i>env</i>).</li>
<li>Let <i>p</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeargsetter">MakeArgSetter</a>(<i>name</i>, <i>env</i>).</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>map</i> passing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>) and the PropertyDescriptor{[[Set]]: <i>p</i>, [[Get]]:
<i>g,</i>[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>true</b>} as arguments.</li>
<li>Let <i>index</i> be <i>index</i> − 1</li>
</ol>
</li>
</ol>
</li>
<li>Set the [[ParameterMap]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>obj</i>
to <i>map</i>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>F</i>, <code>"callee"</code>,
PropertyDescriptor {[[Get]]: <i>thrower</i>, [[Set]]: <i>thrower</i>, [[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>false</b>}).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: the above property definition will not produce an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Return <i>obj</i></li>
</ol>
</div>
<section id="sec-namemakearggetter-name-env-abstract-operation">
<h1><span class="secnum" id="sec-9.4.4.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-namemakearggetter-name-env-abstract-operation" title="link to this section">9.4.4.7.1</a></span> nameMakeArgGetter ( name, env) Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">MakeArgGetter</span> called with String
<var>name</var> and environment record <var>env</var> creates a built-in function object that when executed returns the
value bound for <var>name</var> in <var>env</var>. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>realm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the current Realm</a>.</li>
<li>Let <i>steps</i> be the steps of a ArgGetter function as specified below.</li>
<li>Let <i>getter</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction">CreateBuiltinFunction</a>(<i>realm</i>, <i>steps</i>,
([[name]], [[env]]) ).</li>
<li>Set <i>getter’s</i> [[name]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>name</i>.</li>
<li>Set <i>getter’s</i> [[env]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>env</i>.</li>
<li>Return <i>getter</i>.</li>
</ol>
<p>An ArgGetter function is an anonymous built-in function with [[name]] and [[env]] internal slots. When an ArgGetter
function <var>f</var> is called with it performs the following steps:</p>
<ol class="proc">
<li>Let <i>name</i> be the value of <i>f’s</i> [[name]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>env</i> be the value of <i>f’s</i> [[env]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a></li>
<li>Return the result of calling the GetBindingValue concrete method of <i>env</i> with arguments <i>name</i> and
<b>false</b>.</li>
</ol>
</section>
<section id="sec-makeargsetter">
<h1><span class="secnum" id="sec-9.4.4.7.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeargsetter" title="link to this section">9.4.4.7.2</a></span> MakeArgSetter ( name, env) Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">MakeArgSetter</span> called with String
<var>name</var> and environment record <var>env</var> creates a built-in function object that when executed sets the
value bound for <var>name</var> in <var>env</var>. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>realm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the current Realm</a>.</li>
<li>Let <i>steps</i> be the steps of a ArgSetter function as specified below.</li>
<li>Let <i>setter</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction">CreateBuiltinFunction</a>(<i>realm</i>, <i>steps</i>,
([[name]], [[env]]) ).</li>
<li>Set <i>setter’s</i> [[name]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>name</i>.</li>
<li>Set <i>setter’s</i> [[env]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>env</i>.</li>
<li>Return <i>setter</i>.</li>
</ol>
<p>An ArgSetter function is an anonymous built-in function with [[name]] and [[env]] internal slots. When an ArgGetter
function <var>f</var> is called with argument <var>value</var> with it performs the following steps:</p>
<ol class="proc">
<li>Let <i>name</i> be the value of <i>f’s</i> [[name]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>env</i> be the value of <i>f’s</i> [[env]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a></li>
<li>Return the result of calling the SetMutableBinding concrete method of <i>env</i> with arguments <i>name</i>,
<i>value</i>, and <b>false</b>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-integer-indexed-exotic-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects" title="link to this section">9.4.5</a></span> Integer Indexed Exotic Objects</h1>
<p>An <i>Integer Indexed object</i> is an exotic object that performs special handling of integer property keys.</p>
<p>Integer Indexed exotic objects have the same internal slots as ordinary objects additionally [[ViewedArrayBuffer]],
[[ArrayLength]], [[ByteOffset]], and [[TypedArrayName]] internal slots.</p>
<p>Integer Indexed Exotic objects provide alternative definitions for the following internal methods. All of the other
Integer Indexed exotic object essential internal methods that are not defined below are as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</p>
</div>
<section id="sec-integer-indexed-exotic-objects-getownproperty-p">
<h1><span class="secnum" id="sec-9.4.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-getownproperty-p" title="link to this section">9.4.5.1</a></span> [[GetOwnProperty]] ( P )</h1>
<p>When the [[GetOwnProperty]] internal method of an Integer Indexed exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> is an Object that has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>P</i>) is String, then
<ol class="block">
<li>Let <i>numericIndex</i> be CannonicalNumericString(<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numericIndex</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <i>numericIndex</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedelementget">IntegerIndexedElementGet</a> (<i>O</i>,
<i>numericIndex</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <i>value</i> is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>Return a PropertyDescriptor{ [[Value]]: <i>value</i>, [[Enumerable]]: <b>true</b>, [[Writable]]:
<b>true</b>, [[Configurable]]: <b>false</b> }.</li>
</ol>
</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarygetownproperty">OrdinaryGetOwnProperty</a>(<i>O</i>, <i>P</i>).</li>
</ol>
</section>
<section id="sec-integer-indexed-exotic-objects-defineownproperty-p-desc">
<h1><span class="secnum" id="sec-9.4.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-defineownproperty-p-desc" title="link to this section">9.4.5.2</a></span> [[DefineOwnProperty]] ( P, Desc)</h1>
<p>When the [[DefineOwnProperty]] internal method of an Integer Indexed exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property
Descriptor</a> <span class="nt">Desc</span> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> is an Object that has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>P</i>) is String, then
<ol class="block">
<li>Let <i>numericIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-canonicalnumericstring">CanonicalNumericString</a> (<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numericIndex</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <i>numericIndex</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">IsInteger</a>(<i>numericIndex</i>) is <b>false</b> then return
<b>undefined</b></li>
<li>Let <i>intIndex</i> be <i>numericIndex</i>.</li>
<li>If <i>intIndex</i> &lt; 0, then return <b>false</b>.</li>
<li>Let <i>length</i> be the value of <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>intIndex</i> ≥ <i>length</i>, then return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>Desc</i>) is <b>true</b>, then return
<b>false.</b></li>
<li>If <i>Desc</i> has a [[Configurable]] field and if <i>Desc</i>.[[Configurable]] is <b>true</b>, then return
<b>false<i>.</i></b></li>
<li>If <i>Desc</i> has an [[Enumerable]] field and if <i>Desc</i>.[[Enumerable]] is <b>false</b>, then return
<b>false<i>.</i></b></li>
<li>If <i>Desc</i> has a [[Writable]] field and if <i>Desc</i>.[[Writable]] is <b>false</b>, then return
<b>false</b>.</li>
<li>If <i>Desc</i> has a [[Value]] field, then
<ol class="block">
<li>Let <i>value</i> be <i>Desc</i>.[[Value]].</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedelementset">IntegerIndexedElementSet</a> (<i>O</i>,
<i>intIndex</i>, <i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<i>O</i>, <i>P</i>).</li>
</ol>
</section>
<section id="sec-integer-indexed-exotic-objects-get-p-receiver">
<h1><span class="secnum" id="sec-9.4.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-get-p-receiver" title="link to this section">9.4.5.3</a></span> [[Get]] (P, Receiver)</h1>
<p>When the [[Get]] internal method of an Integer Indexed exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
value</a> <span class="nt">Receiver</span> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>P</i>) is String and if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>O</i>, <i>Receiver</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>numericIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-canonicalnumericstring">CanonicalNumericString</a> (<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numericIndex</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <i>numericIndex</i> is not <b>undefined</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedelementget">IntegerIndexedElementGet</a> (<i>O</i>,
<i>numericIndex</i>).</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of calling the default ordinary object [[Get]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver">9.1.8</a>) on <i>O</i> passing
<i>P</i> and <i>Receiver</i> as arguments.</li>
</ol>
</section>
<section id="sec-integer-indexed-exotic-objects-set-p-v-receiver">
<h1><span class="secnum" id="sec-9.4.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-set-p-v-receiver" title="link to this section">9.4.5.4</a></span> [[Set]] ( P, V, Receiver)</h1>
<p>When the [[Set]] internal method of an Integer Indexed exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, value <var>V</var>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> <span class="nt">Receiver</span>, the following steps
are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>P</i>) is String and if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>O</i>, <i>Receiver</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>numericIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-canonicalnumericstring">CanonicalNumericString</a> (<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numericIndex</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <i>numericIndex</i> is not <b>undefined</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedelementset">IntegerIndexedElementSet</a> (<i>O</i>, <i>numericIndex</i>,
<i>V</i>)).</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of calling the default ordinary object [[Set]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver">9.1.8</a>) on <i>O</i> passing
<i>P</i>, <i>V</i>, and <i>Receiver</i> as arguments.</li>
</ol>
</section>
<section id="sec-integer-indexed-exotic-objects-enumerate">
<h1><span class="secnum" id="sec-9.4.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-enumerate" title="link to this section">9.4.5.5</a></span> [[Enumerate]] ()</h1>
</section>
<section id="sec-integer-indexed-exotic-objects-ownpropertykeys">
<h1><span class="secnum" id="sec-9.4.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-ownpropertykeys" title="link to this section">9.4.5.6</a></span> [[OwnPropertyKeys]] ()</h1>
</section>
<section id="sec-integerindexedobjectcreate">
<h1><span class="secnum" id="sec-9.4.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedobjectcreate" title="link to this section">9.4.5.7</a></span> IntegerIndexedObjectCreate Abstract Operation</h1>
<p>The abstract operation IntegerIndexedObjectCreate with argument <var>prototype</var> is used to specify the creation of
new Integer Indexed exotic objects. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>A</i> be a newly created object.</li>
<li>Set <i>A</i>’s essential internal methods to the default ordinary object definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots">9.1</a>.</li>
<li>Set the [[GetOwnProperty]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-getownproperty-p">9.4.5.1</a>.</li>
<li>Set the [[DefineOwnProperty]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-defineownproperty-p-desc">9.4.5.2</a>.</li>
<li>Set the [[Get]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-get-p-receiver">9.4.5.3</a>.</li>
<li>Set the [[Set]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-set-p-v-receiver">9.4.5.4</a>.</li>
<li>Set the [[Enumerate]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-enumerate">9.4.5.5</a>.</li>
<li>Set the [[OwnPropertyKeys]] internal method of <i>A</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integer-indexed-exotic-objects-ownpropertykeys">9.4.5.6</a>.</li>
<li>Set the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>A</i> to
<i>prototype</i>.</li>
<li>Set the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>A</i> to
<b>true</b>.</li>
<li>Return <i>A</i>.</li>
</ol>
</section>
<section id="sec-integerindexedelementget">
<h1><span class="secnum" id="sec-9.4.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedelementget" title="link to this section">9.4.5.8</a></span> IntegerIndexedElementGet ( O, index ) Abstract Operation</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>index</i>) is Number.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> is an Object that has [[ViewedArrayBuffer]],
[[ArrayLength]], [[ByteOffset]], and [[TypedArrayName]] internal slots.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">IsInteger</a>(<i>index</i>) is <b>false</b> then return <b>undefined</b></li>
<li>Let <i>length</i> be the value of <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>index</i> &lt; 0 or <i>index</i> ≥ <i>length</i>, then return <b>undefined</b>.</li>
<li>Let <i>offset</i> be the value of <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>arrayTypeName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for <i>arrayTypeName</i>.</li>
<li>Let <i>indexedPosition</i> = (<i>index</i> × <i>elementSize</i>) + <i>offset</i>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>arrayTypeName</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvaluefrombuffer">GetValueFromBuffer</a>(<i>buffer</i>, <i>indexedPosition</i>,
<i>elementType</i>).</li>
</ol>
</section>
<section id="sec-integerindexedelementset">
<h1><span class="secnum" id="sec-9.4.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedelementset" title="link to this section">9.4.5.9</a></span> IntegerIndexedElementSet ( O, index, value ) Abstract Operation</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>index</i>) is Number.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> is an Object that has [[ViewedArrayBuffer]],
[[ArrayLength]], [[ByteOffset]], and [[TypedArrayName]] internal slots.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">IsInteger</a>(<i>index</i>) is <b>false</b> then return <b>false</b></li>
<li>Let <i>length</i> be the value of <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>numValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>value)</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>numValue</i>).</li>
<li>If <i>index</i> &lt; 0 or <i>index</i> ≥ <i>length</i>, then return <b>false</b>.</li>
<li>Let <i>offset</i> be the value of <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>arrayTypeName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for <i>arrayTypeName</i>.</li>
<li>Let <i>indexedPosition</i> = (<i>index</i> × <i>elementSize</i>) + <i>offset</i>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>arrayTypeName</i>.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer">SetValueInBuffer</a>(<i>buffer</i>, <i>indexedPosition</i>,
<i>elementType</i>, <i>numValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
</section>
<section id="sec-module-exotic-objects">
<div class="front">
<h1><span class="secnum" id="sec-9.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects" title="link to this section">9.4.6</a></span>
Module Exotic Objects</h1>
<p>A <i>module object</i> is an exotic object that exposes the bindings exported from an ECMScript <span class="nt">Module</span> <var>(See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-modules">15.2</a>)</var>. There is a one-to-one correspondence between
the own properties of a module exoticobject and the ExportedBindings of the <span class="nt">Module</span>. Each own
property name is the StringValue of the corresponding exported binding. These are the only properties of an module exotic
object. Each such property have the attributes {[[Configurable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">true</span>}. Module objects are not extensible.</p>
<p>Bound function objects do not have the internal slots of ECMAScript function objects defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a>. Instead they have the internal slots defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-28">Table 28</a>.</p>
<figure>
<figcaption><span id="table-28">Table 28</span> -- Internal Slots of Module Exotic Objects</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[ModuleEnviornment]]</td>
<td>Environment</td>
<td>The Declrative <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> that contains all of the declared top-level bindings for the corresponding module.</td>
</tr>
<tr>
<td>[[Exports]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of String</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the bound names exposed as own properties of this object. The list is ordered as an Array of the the same values had been sorted using <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">Array.prototype.sort</a></code> using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a> as <i><span style="font-family: Times New Roman">comparefn</span>.</i></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
<p>Module exotic objects provide alternative definitions for all of the internal methods.</p>
</div>
<section id="sec-module-exotic-objects-getprototypeof">
<h1><span class="secnum" id="sec-9.4.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-getprototypeof" title="link to this section">9.4.6.1</a></span> [[GetPrototypeOf]] ( )</h1>
<p>When the [[GetPrototypeOf]] internal method of a module exotic object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Return <b>null</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-setprototypeof-v">
<h1><span class="secnum" id="sec-9.4.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-setprototypeof-v" title="link to this section">9.4.6.2</a></span> [[SetPrototypeOf]] (V)</h1>
<p>When the [[SetPrototypeOf]] internal method of a module exotic object <var>O</var> is called with argument <i>V</i> the
following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: Either <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is Null.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-isextensible">
<h1><span class="secnum" id="sec-9.4.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-isextensible" title="link to this section">9.4.6.3</a></span> [[IsExtensible]] ( )</h1>
<p>When the [[IsExtensible]] internal method of a module exotic object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-preventextensions">
<h1><span class="secnum" id="sec-9.4.6.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-preventextensions" title="link to this section">9.4.6.4</a></span> [[PreventExtensions]] ( )</h1>
<p>When the [[PreventExtensions]] internal method of a module exotic object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-getownproperty-p">
<h1><span class="secnum" id="sec-9.4.6.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-getownproperty-p" title="link to this section">9.4.6.5</a></span> [[GetOwnProperty]] (P)</h1>
<p>When the [[GetOwnProperty]] internal method of a module exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-defineownproperty-p-desc">
<h1><span class="secnum" id="sec-9.4.6.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-defineownproperty-p-desc" title="link to this section">9.4.6.6</a></span> [[DefineOwnProperty]] (P, Desc)</h1>
<p>When the [[DefineOwnProperty]] internal method of a module exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property
Descriptor</a> <span class="nt">Desc</span>, the following steps are taken:</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-hasproperty-p">
<h1><span class="secnum" id="sec-9.4.6.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-hasproperty-p" title="link to this section">9.4.6.7</a></span> [[HasProperty]] (P)</h1>
<p>When the [[HasProperty]] internal method of a module exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>exports</i> be the value of <i>O</i>’s [[Exports]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>P</i> is an element of <i>exports</i>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-get-p-receiver">
<h1><span class="secnum" id="sec-9.4.6.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-get-p-receiver" title="link to this section">9.4.6.8</a></span> [[Get]] (P, Receiver)</h1>
<p>When the [[Get]] internal method of a module exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
value</a> <span class="nt">Receiver</span> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>exports</i> be the value of <i>O</i>’s [[Exports]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>P</i> is not an element of <i>exports</i>, then return <b>undefined</b>.</li>
<li>Let <i>env</i> be the value of <i>O</i>’s [[ModuleEnvironment]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return the result of calling the GetBindngValue concrete method of <i>env</i> with arguments (<i>P,</i>
<b>true</b>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Attempting to [[Get]] the value of a module export that has not yet been initialized
will throw a ReferenceError exception.</p>
</div>
</section>
<section id="sec-module-exotic-objects-set-p-v-receiver">
<h1><span class="secnum" id="sec-9.4.6.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-set-p-v-receiver" title="link to this section">9.4.6.9</a></span> [[Set]] ( P, V, Receiver)</h1>
<p>When the [[Set]] internal method of <span style="font-family: Times New Roman">a</span> module exotic object
<var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, value <var>V</var>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> <span class="nt">Receiver</span>, the following steps
are taken:</p>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-delete-p">
<h1><span class="secnum" id="sec-9.4.6.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-delete-p" title="link to this section">9.4.6.10</a></span> [[Delete]] (P)</h1>
<p>When the [[Delete]] internal method of a module exotic object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>exports</i> be the value of <i>O</i>’s [[Exports]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>P</i> is an element of <i>exports</i>, then return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-module-exotic-objects-enumerate">
<h1><span class="secnum" id="sec-9.4.6.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-enumerate" title="link to this section">9.4.6.11</a></span> [[Enumerate]] ()</h1>
<p>When the [[Enumerate]] internal method of a module exotic object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>exports</i> be the value of O’s [[Exports]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return CreateListIternator(<i>exports</i>).</li>
</ol>
</section>
<section id="sec-module-exotic-objects-ownpropertykeys">
<h1><span class="secnum" id="sec-9.4.6.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects-ownpropertykeys" title="link to this section">9.4.6.12</a></span> [[OwnPropertyKeys]] ( )</h1>
<p>When the [[OwnPropertyKeys]] internal method of an module exotic object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>exports</i> be the value of O’s [[Exports]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return CreateListIternator(<i>exports</i>).</li>
</ol>
</section>
<section id="sec-moduleobjectcreate">
<h1><span class="secnum" id="sec-9.4.6.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduleobjectcreate" title="link to this section">9.4.6.13</a></span> ModuleObjectCreate (environment, exports)</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>environment</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">Declarative Environment Record</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>exports</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of string values.</li>
<li>Let <i>M</i> be a newly created object.</li>
<li>Set <i>M</i>’s essential internal methods to the definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects">9.4.6</a>.</li>
<li>Set <i>M</i>’s [[ModuleEnviornment]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>environment</i>.</li>
<li>Set <i>M</i>’s [[Exports]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
<i>exports</i>.</li>
<li>Return <i>M</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots">
<div class="front">
<h1><span class="secnum" id="sec-9.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots" title="link to this section">9.5</a></span> Proxy Object Internal Methods and Internal Slots</h1>
<p>A proxy object is an exotic object whose essential internal methods are partially implemented using ECMAScript code.
Every proxy objects has an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> called
[[ProxyHandler]]. The value of [[ProxyHandler]] is always an object, called the proxy’s <i>handler object</i>.
Methods of a handler object may be used to augment the implementation for one or more of the proxy object’s internal
methods. Every proxy object also has an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> called
[[ProxyTarget]] whose value is either an object or the <b>null</b> value. This object is called the proxy’s <i>target
object</i>.</p>
<p>When a handler method is called to provide the implementation of a proxy object internal method, the handler method is
passed the proxy’s target object as a parameter. A proxy’s handler object does not necessarily have a method
corresponding to every essential internal method. Invoking an internal method on the proxy results in the invocation of the
corresponding internal method on the proxy’s target object if the handler object does not have a method corresponding
to the internal trap.</p>
<p>The [[ProxyHandler]] and [[ProxyTarget]] internal slots of a proxy object are always initialized when the object is
created and typically may not be modified. Some proxy objects are created in a manner that permits them to be subsequently
<i>revoked</i>. When a proxy is revoked, its [[ProxyHander]] and [[ProxyTarget]] internal slots are set to <b>null</b>
causing subsequent invocations of internal methods on that proxy obeject to throw a <span class="value">TypeError</span>
exception.</p>
<p>Because proxy permit arbitrary ECMAScript code to be used to in the implementation of internal methods, it is possible to
define a proxy object whose handler methods violates the invariants defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invariants-of-the-essential-internal-methods">6.1.7.3</a>. Some of the internal method invariants defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invariants-of-the-essential-internal-methods">6.1.7.3</a> are essential integrity invariants. These invariants
are explicitly enforced by the proxy internal methods specified in this section. An ECMAScript implementation must be robust
in the presence of all possible invariant violations.</p>
<p>In the following algorithm descriptions, assume <var>O</var> is an ECMAScript proxy object, <var>P</var> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key value</a>, <var>V</var> is any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript
language value</a>, <span style="font-family: Times New Roman">Desc</span> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> record, and <var>B</var> is a Boolean flag.</p>
</div>
<section id="sec-proxy-object-internal-methods-and-internal-slots-getprototypeof">
<h1><span class="secnum" id="sec-9.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof" title="link to this section">9.5.1</a></span> [[GetPrototypeOf]] ( )</h1>
<p>When the [[GetPrototypeOf]] internal method of an exotic Proxy object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>getPrototypeOf</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[GetPrototypeOf]] internal method of <i>target</i>.</li>
</ol>
</li>
<li>Let <i>handlerProto</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as
the <b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>handlerProto</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>handlerProto</i>) is neither Object nor Null, then
throw a <b>TypeError</b> exception.</li>
<li>Let <i>extensibleTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensibleTarget</i>).</li>
<li>If <i>extensibleTarget</i> is <b>true</b>, then return <i>handlerProto</i>.</li>
<li>Let <i>targetProto</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetProto</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>handlerProto</i>, <i>targetProto</i>) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>handlerProto</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[GetPrototypeOf]] for proxy objects enforces the following invariant:</p>
<ul>
<li>
<p>The result of [[GetPrototypeOf]] must be either an Object or <b>null</b>.</p>
</li>
<li>
<p>If the target object is not extensible, [[GetPrototypeOf]] applied to the proxy object must return the same value
as [[GetPrototypeOf] applied to the proxy object’s target object.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v">
<h1><span class="secnum" id="sec-9.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v" title="link to this section">9.5.2</a></span> [[SetPrototypeOf]] (V)</h1>
<p>When the [[SetPrototypeOf]] internal method of an exotic Proxy object <var>O</var> is called with argument <i>V</i> the
following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: Either <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>V</i>) is Null.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>setPrototypeOf</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[SetPrototypeOf]] internal method of <i>target</i> with argument <i>V</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i> and
<i>V</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>Let <i>extensibleTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensibleTarget</i>).</li>
<li>If <i>extensibleTarget</i> is <b>true</b>, then return <i>booleanTrapResult</i>.</li>
<li>Let <i>targetProto</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetProto</i>).</li>
<li>If <i>booleanTrapResult</i> is <b>true</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>V</i>, <i>targetProto</i>) is
<b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>booleanTrapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[SetPrototypeOf]] for proxy objects enforces the following invariant:</p>
<ul>
<li>
<p>If the target object is not extensible, the argument value must be the same as the result of [[GetPrototypeOf]]
applied to target object.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-isextensible">
<h1><span class="secnum" id="sec-9.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-isextensible" title="link to this section">9.5.3</a></span> [[IsExtensible]] ( )</h1>
<p>When the [[IsExtensible]] internal method of an exotic Proxy object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>isExtensible</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[IsExtensible]] internal method of <i>target</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>Let <i>targetResult</i> be the result of calling the [[IsExtensible]] internal method of <i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>booleanTrapResult</i>, <i>targetResult</i>) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>booleanTrapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[IsExtensible]] for proxy objects enforces the following invariant:</p>
<ul>
<li>
<p>[[IsExtensible]] applied to the proxy object must return the same value as [[IsExtensible]] applied to the proxy
object’s target object with the same argument.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-preventextensions">
<h1><span class="secnum" id="sec-9.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-preventextensions" title="link to this section">9.5.4</a></span> [[PreventExtensions]] ( )</h1>
<p>When the [[PreventExtensions]] internal method of an exotic Proxy object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>preventExtensions</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[PreventExtensions]] internal method of <i>target</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>If <i>booleanTrapResult</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>targetIsExtensible</i> be the result of calling the [[IsExtensible]] internal method of <i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetIsExtensible</i>).</li>
<li>If <i>targetIsExtensible</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Return <i>booleanTrapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[PreventExtensions]] for proxy objects enforces the following invariant:</p>
<ul>
<li>
<p>[[PreventExtensions]] applied to the proxy object only returns <b>true</b> if [[IsExtensible]] applied to the proxy
object’s target object is <b>false</b>.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p">
<h1><span class="secnum" id="sec-9.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p" title="link to this section">9.5.5</a></span> [[GetOwnProperty]] (P)</h1>
<p>When the [[GetOwnProperty]] internal method of an exotic Proxy object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>,
"<code>getOwnPropertyDescriptor</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with argument <i>P</i>.</li>
</ol>
</li>
<li>Let <i>trapResultObj</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as
the <b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>
and <i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trapResultObj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>trapResultObj</i>) is neither Object nor Undefined,
then throw a <b>TypeError</b> exception.</li>
<li>Let <i>targetDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetDesc</i>).</li>
<li>If <i>trapResultObj</i> is <b>undefined</b>, then
<ol class="block">
<li>If <i>targetDesc</i> is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>If <i>targetDesc</i>.[[Configurable]] is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>extensibleTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensibleTarget</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>extensibleTarget</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</li>
<li>Let <i>extensibleTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensibleTarget</i>).</li>
<li>Let <i>resultDesc</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor">ToPropertyDescriptor</a>(<i>trapResultObj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>resultDesc</i>).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completepropertydescriptor">CompletePropertyDescriptor</a>(<i>resultDesc</i>).</li>
<li>Let <i>valid</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscompatiblepropertydescriptor">IsCompatiblePropertyDescriptor</a>
(<i>extensibleTarget</i>, <i>resultDesc</i>, <i>targetDesc</i>).</li>
<li>If <i>valid</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>resultDesc</i>.[[Configurable]] is <b>false</b>, then
<ol class="block">
<li>If <i>targetDesc</i> is <b>undefined</b> or <i>targetDesc</i>.[[Configurable]] is <b>true</b><i>,</i> then
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
</ol>
</li>
<li>Return <i>resultDesc</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[GetOwnProperty]] for proxy objects enforces the following invariants:</p>
<ul>
<li>
<p>The result of [[GetOwnProperty]] must be either an Object or <b>undefined</b>.</p>
</li>
<li>
<p>A property cannot be reported as non-existent, if it exists as a non-configurable own property of the target
object.</p>
</li>
<li>
<p>A property cannot be reported as non-existent, if it exists as an own property of the target object and the target
object is not extensible.</p>
</li>
<li>
<p>A property cannot be reported as existent, if it does not exists as an own property of the target object and the
target object is not extensible.</p>
</li>
<li>
<p>A property cannot be reported as non-configurable, if it does not exists as an own property of the target object or
if it exists as a configurable own property of the target object.</p>
</li>
<li>
<p>The result of [[GetOwnProperty]] can be applied to the target object using [[DefineOwnProperty]] and will not throw
an exception.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc">
<h1><span class="secnum" id="sec-9.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc" title="link to this section">9.5.6</a></span> [[DefineOwnProperty]] (P, Desc)</h1>
<p>When the [[DefineOwnProperty]] internal method of an exotic Proxy object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property
Descriptor</a> <span class="nt">Desc</span>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>defineProperty</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[DefineOwnProperty]] internal method of <i>target</i> with arguments <i>P</i>
and <i>Desc</i>.</li>
</ol>
</li>
<li>Let <i>descObj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-frompropertydescriptor">FromPropertyDescriptor</a>(<i>Desc</i>).</li>
<li>NOTE If <span class="nt">Desc</span> was originally generated from an object using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor">ToPropertyDescriptor</a>, then <var>descObj</var> will be that original object.</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>,
<i>P</i>, and <i>descObj</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>If <i>booleanTrapResult</i> is <b>false</b>, then return <b>false</b>.</li>
<li>Let <i>targetDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetDesc</i>).</li>
<li>Let <i>extensibleTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensibleTarget</i>).</li>
<li>If <i>Desc</i> has a [[Configurable]] field and if <i>Desc</i>.[[Configurable]] is <b>false,</b> then
<ol class="block">
<li>Let <i>settingConfigFalse</i> be <b>true</b>.</li>
</ol>
</li>
<li>Else let <i>settingConfigFalse</i> be <b>false</b>.</li>
<li>If <i>targetDesc</i> is <b>undefined</b>, then
<ol class="block">
<li>If <i>extensibleTarget</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>settingConfigFalse</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Else <i>targetDesc</i> is not <b>undefined<i>,</i></b>
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscompatiblepropertydescriptor">IsCompatiblePropertyDescriptor</a>(<i>extensibleTarget</i>,
<i>Desc</i> , <i>targetDesc</i>) is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>settingConfigFalse</i> is <b>true</b> and <i>targetDesc</i>.[[Configurable]] is <b>true</b>, then throw a
<b>TypeError</b> exception.</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[DefineOwnProperty]] for proxy objects enforces the following invariants:</p>
<ul>
<li>
<p>A property cannot be added, if the target object is not extensible.</p>
</li>
<li>
<p>A property cannot be added as or modified to be non-configurable, if it does not exists as a non-configurable own
property of the target object.</p>
</li>
<li>
<p>A property may not be non-configurable, if is corresponding configurable property of the target object exists.</p>
</li>
<li>
<p>If a property has a corresponding target object property then apply the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a> of the property to the target object using
[[DefineOwnProperty]] will not throw an exception.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p">
<h1><span class="secnum" id="sec-9.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p" title="link to this section">9.5.7</a></span> [[HasProperty]] (P)</h1>
<p>When the [[HasProperty]] internal method of an exotic Proxy object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>has</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[HasProperty]] internal method of <i>target</i> with argument <i>P</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i> and
<i>P</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>If <i>booleanTrapResult</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>targetDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with
argument <i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetDesc</i>).</li>
<li>If <i>targetDesc</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <i>targetDesc</i>.[[Configurable]] is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>extensibleTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>extensibleTarget</i>).</li>
<li>If <i>extensibleTarget</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
</ol>
</li>
<li>Return <i>booleanTrapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[HasProperty]] for proxy objects enforces the following invariants:</p>
<ul>
<li>
<p>A property cannot be reported as non-existent, if it exists as a non-configurable own property of the target
object.</p>
</li>
<li>
<p>A property cannot be reported as non-existent, if it exists as an own property of the target object and the target
object is not extensible.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver">
<h1><span class="secnum" id="sec-9.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver" title="link to this section">9.5.8</a></span> [[Get]] (P, Receiver)</h1>
<p>When the [[Get]] internal method of an exotic Proxy object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language
value</a> <span class="nt">Receiver</span> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>get</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[Get]] internal method of <i>target</i> with arguments <i>P</i> and
<i>Receiver</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>,
<i>P</i>, and <i>Receiver</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trapResult</i>).</li>
<li>Let <i>targetDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetDesc</i>).</li>
<li>If <i>targetDesc</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>targetDesc</i>) and <i>targetDesc</i>.[[Configurable]]
is <b>false</b> and <i>targetDesc</i>.[[Writable]] is <b>false</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>trapResult</i>, <i>targetDesc</i>.[[Value]]) is <b>false</b>,
then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>targetDesc</i>) and
<i>targetDesc</i>.[[Configurable]] is <b>false</b> and <i>targetDesc</i>.[[Get]] is <b>undefined</b>, then
<ol class="block">
<li>If <i>trapResult</i> is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
</ol>
</li>
<li>Return <i>trapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[Get]] for proxy objects enforces the following invariants:</p>
<ul>
<li>
<p>The value reported for a property must be the same as the value of the corresponding target object property if the
target object property is a non-writable, non-configurable data property.</p>
</li>
<li>
<p>The value reported for a property must be <b>undefined</b> if the corresponding corresponding target object
property is non-configurable accessor property that has <b>undefined</b> as its [[Get]] attribute.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver">
<h1><span class="secnum" id="sec-9.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver" title="link to this section">9.5.9</a></span> [[Set]] ( P, V, Receiver)</h1>
<p>When the [[Set]] internal method of an exotic Proxy object <var>O</var> is called with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> <var>P</var>, value <var>V</var>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language value</a> <span class="nt">Receiver</span>, the following steps
are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>set</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[Set]] internal method of <i>target</i> with arguments <i>P</i>, <i>V</i>, and
<i>Receiver</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>,
<i>P</i>, <i>V</i>, and <i>Receiver</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>If <i>booleanTrapResult</i> is <b>false</b>, then return <b>false</b>.</li>
<li>Let <i>targetDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetDesc</i>).</li>
<li>If <i>targetDesc</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isdatadescriptor">IsDataDescriptor</a>(<i>targetDesc</i>) and <i>targetDesc</i>.[[Configurable]]
is <b>false</b> and <i>targetDesc</i>.[[Writable]] is <b>false</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>V</i>, <i>targetDesc</i>.[[Value]]) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isaccessordescriptor">IsAccessorDescriptor</a>(<i>targetDesc</i>) and
<i>targetDesc</i>.[[Configurable]] is <b>false</b>, then
<ol class="block">
<li>If <i>targetDesc</i>.[[Set]] is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[Set]] for proxy objects enforces the following invariants:</p>
<ul>
<li>
<p>Cannnot change the value of a property to be different from the value of the corresponding target object property
if the corresponding target object property is a non-writable, non-configurable data property.</p>
</li>
<li>
<p>Cannot set the value of a property if the corresponding corresponding target object property is a non-configurable
accessor property that has <b>undefined</b> as its [[Set]] attribute.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-delete-p">
<h1><span class="secnum" id="sec-9.5.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-delete-p" title="link to this section">9.5.10</a></span> [[Delete]] (P)</h1>
<p>When the [[Delete]] internal method of an exotic Proxy object <var>O</var> is called with property name <var>P</var> the
following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<i>P</i>) is
<b>true</b>.</li>
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>deleteProperty</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[Delete]] internal method of <i>target</i> with argument <i>P</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i> and
<i>P</i>.</li>
<li>Let <i>booleanTrapResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>trapResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>booleanTrapResult</i>).</li>
<li>If <i>booleanTrapResult</i> is <b>false</b>, then return <b>false</b>.</li>
<li>Let <i>targetDesc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>target</i> with argument
<i>P</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetDesc</i>).</li>
<li>If <i>targetDesc</i> is <b>undefined</b>, then return <b>true</b>.</li>
<li>If <i>targetDesc</i>.[[Configurable]] is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <b>true</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[Delete]] for proxy objects enforces the following invariant:</p>
<ul>
<li>
<p>A property cannot be deleted, if it exists as a non-configurable own property of the target object.</p>
</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-enumerate">
<h1><span class="secnum" id="sec-9.5.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-enumerate" title="link to this section">9.5.11</a></span> [[Enumerate]] ()</h1>
<p>When the [[Enumerate]] internal method of an exotic Proxy object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>enumerate</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[Enumerate]] internal method of <i>target</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trapResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>trapResult</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>trapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[Enumerate]] for proxy objects enforces the following invariants:</p>
<ul>
<li>The result of [[Enumerate]] must be an Object.</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys">
<h1><span class="secnum" id="sec-9.5.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys" title="link to this section">9.5.12</a></span> [[OwnPropertyKeys]] ( )</h1>
<p>When the [[OwnPropertyKeys]] internal method of an exotic Proxy object <var>O</var> is called the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>ownKeys</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[OwnPropertyKeys]] internal method of <i>target</i>.</li>
</ol>
</li>
<li>Let <i>trapResult</i> be the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the
<b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trapResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>trapResult</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>TODO: we may need to add a lot of additional invariant checking here according to the wiki spec. But maybe it really
isn’t necessary</li>
<li>Return <i>trapResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[OwnPropertyKeys]] for proxy objects enforces the following invariants:</p>
<ul>
<li>The result of [[OwnPropertyKeys]] must be an Object.</li>
</ul>
</div>
</section>
<section id="sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist">
<h1><span class="secnum" id="sec-9.5.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist" title="link to this section">9.5.13</a></span> [[Call]] (thisArgument, argumentsList)</h1>
<p>The [[Call]] internal method of an exotic Proxy object <var>O</var> is called with parameters <var>thisArgument</var> and
<var>argumentsList</var>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>apply</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[Call]] internal method of <i>target</i> with arguments <i>thisArgument</i> and
<i>argumentsList</i>.</li>
</ol>
</li>
<li>Let <i>argArray</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist">CreateArrayFromList</a>(<i>argumentsList</i>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>trap</i> with <i>handler</i> as the <b>this</b> value
and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i>, <i>thisArgument</i>,
and <i>argArray</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> A Proxy exotic object only has a [[Call]] internal method if the initial value of its
[[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is an object that has a
[[Call]] internal method.</p>
</div>
</section>
<section id="sec-construct-internal-method">
<h1><span class="secnum" id="sec-9.5.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-internal-method" title="link to this section">9.5.14</a></span> [[Construct]] Internal Method</h1>
<p>The [[Construct]] internal method of an exotic Proxy object <var>O</var> is called with a single parameter
<var>argumentsList</var> which is a possibly empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>handler</i> be the value of the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>handler</i> is <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>target</i> be the value of the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>trap</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>handler</i>, "<code>construct</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>trap</i>).</li>
<li>If <i>trap</i> is <b>undefined</b>, then
<ol class="block">
<li>If <i>target</i> does not have a [[Construct]] internal method, then throw a <b>TypeError</b> exception.</li>
<li>Return the result of calling the [[Construct]] internal method of <i>target</i> with argument
<i>argumentsList</i>.</li>
</ol>
</li>
<li>Let <i>argArray</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist">CreateArrayFromList</a>(<i>argumentsList</i>).</li>
<li>Let <i>newObj</i> be the result of calling <i>trap</i> with <i>handler</i> as the <b>this</b> value and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>target</i> and <i>argArray</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>newObj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>newObj</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>newObj</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> A Proxy exotic object only has a [[Construct]] internal method if the initial value of
its [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is an object that has a
[[Construct]] internal method.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> [[Construct]]] for proxy objects enforces the following invariants:</p>
<ul>
<li>The result of [[Construct]] must be an Object.</li>
</ul>
</div>
</section>
<section id="sec-proxycreate">
<h1><span class="secnum" id="sec-9.5.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxycreate" title="link to this section">9.5.15</a></span>
ProxyCreate(target, handler) Abstract Operation</h1>
<p>The abstract operation ProxyCreate with arguments <var>target</var> and <var>handler</var> is used to specify the
creation of new Proxy exotic objects. It performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>target</i>) is not Object, throw a <b>TypeError</b>
Exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>handler</i>) is not Object, throw a <b>TypeError</b>
Exception.</li>
<li>Let <i>P</i> be a newly created object.</li>
<li>Set <i>P</i>’s essential internal methods to the definitions specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-exotic-objects">9.4.6</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>target</i>) is <b>true</b>, then
<ol class="block">
<li>Set the [[Call]] internal method of <i>P</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist">9.5.13</a>.</li>
<li>If <i>target</i> has a [[Construct]] internal method, then
<ol class="block">
<li>Set the [[Construct]] internal method of <i>P</i> as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-internal-method">9.5.14</a>.</li>
</ol>
</li>
</ol>
</li>
<li>Set the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>P</i> to
<i>target</i>.</li>
<li>Set the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>P</i> to
<i>handler</i>.</li>
<li>Return <i>P</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-ecmascript-language-source-code">
<div class="front">
<h1><span class="secnum" id="sec-10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-source-code" title="link to this section">10</a></span>
ECMAScript Language: Source Code</h1>
</div>
<section id="sec-source-text">
<div class="front">
<h1><span class="secnum" id="sec-10.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-source-text" title="link to this section">10.1</a></span> Source
Text</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">SourceCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="gprose">any Unicode code point</span></div>
</div>
<p>The ECMAScript code is expressed using Unicode, version 5.1 or later. ECMAScript source text is a sequence of code
points. All Unicode code point values from U+0000 to U+10FFFF, including surrogate code points, may occur in source text
where permitted by the ECMAScript grammars. The actual encodings used to store and interchange ECMAScript source text is not
relevant to this specification. Regardless of the external source text encoding, a conforming ECMAScript implementation
processes the source text as if it was an equivalent sequence of <span class="nt">SourceCharacter</span> values. Each <span class="nt">SourceCharacter</span> being a Unicode code point. Conforming ECMAScript implementations are not required to
perform any normalisation of text, or behave as though they were performing normalisation of text.</p>
<p>The components of a combining character sequence are treated as individual Unicode code points even though a user might
think of the whole sequence as a single character.</p>
<div class="note">
<p><span class="nh">NOTE</span> In string literals, regular expression literals,template literals and identifiers, any
Unicode code point may also be expressed using Unicode escape sequences that explicitly express a code point’s
numeric value. Within a comment, such an escape sequence is effectively ignored as part of the comment.</p>
<p>ECMAScript differs from the Java programming language in the behaviour of Unicode escape sequences. In a Java program,
if the Unicode escape sequence <code>\u000A</code>, for example, occurs within a single-line comment, it is interpreted as
a line terminator (Unicode character <code>000A</code> is line feed) and therefore the next character is not part of the
comment. Similarly, if the Unicode escape sequence <code>\u000A</code> occurs within a string literal in a Java program,
it is likewise interpreted as a line terminator, which is not allowed within a string literal—one must write
<code>\n</code> instead of <code>\u000A</code> to cause a line feed to be part of the string value of a string literal. In
an ECMAScript program, a Unicode escape sequence occurring within a comment is never interpreted and therefore cannot
contribute to termination of the comment. Similarly, a Unicode escape sequence occurring within a string literal in an
ECMAScript program always contributes a Unicode code unit or code point (depending upon the first of the escape) to the
literal and is never interpreted as a line terminator or as a quote mark that might terminate the string literal.</p>
</div>
</div>
<section id="sec-static-semantics-utf-16-encoding">
<h1><span class="secnum" id="sec-10.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding" title="link to this section">10.1.1</a></span> Static Semantics: <i>UTF-16 Encoding</i></h1>
<p>The UTF-16 Encoding of a numeric code point value, <var>cp</var>, is determined as follows:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: 0 ≤ <i>cp</i> ≤ 0x10FFFF.</li>
<li>If <i>cp</i> ≤ 65535, then return <i>cp</i>.</li>
<li>Let <i>cu1</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>((<i>cp</i> – 65536) / 1024) + 55296. <span style="font-family: sans-serif">NOTE</span> 55296 is 0xD800.</li>
<li>Let <i>cu2</i> be ((<i>cp</i> – 65536) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 1024) + 56320. <span style="font-family: sans-serif">NOTE</span> 56320 is 0xDC00.</li>
<li>Return the code unit sequence consisting of <i>cu1</i> followed by <i>cu2</i>.</li>
</ol>
</section>
<section id="sec-utf16decode">
<h1><span class="secnum" id="sec-10.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-utf16decode" title="link to this section">10.1.2</a></span> Static
Semantics: UTF16Decode(lead, trail)</h1>
<p>Two code units, <var>lead</var> and <var>trail</var>, that form a UTF-16 surrogate pair are converted to a code point by
performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: 0xD800 ≤ <i>lead</i> ≤ 0xDBFF and 0xDC00 ≤ <i>trail</i> ≤
0xDFFF.</li>
<li>Let <i>cp</i> be (<i>lead</i>–55296)×1024+( <i>trail</i>–56320)+65536. <span style="font-family:
sans-serif">NOTE</span> 55296 is 0xD800 and 56320 is 0xDC00.</li>
<li>Return the code point <i>cp</i>.</li>
</ol>
</section>
</section>
<section id="sec-types-of-source-code">
<div class="front">
<h1><span class="secnum" id="sec-10.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-types-of-source-code" title="link to this section">10.2</a></span>
Types of Source Code</h1>
<p>There are four types of ECMAScript code:</p>
<ul>
<li>
<p><i>Global code</i> is source text that is treated as an ECMAScript <i>Script</i>. The global code of a particular
<i>Script</i> does not include any source text that is parsed as part of a <i>FunctionBody</i>, <i>GeneratorBody</i>,
<i>ConciseBody</i>, <i>ClassBody</i>, or <i>ModuleBody</i>.</p>
</li>
<li>
<p><i>Eval code</i> is the source text supplied to the built-in <code>eval</code> function. More precisely, if the
parameter to the built-in <code>eval</code> function is a String, it is treated as an ECMAScript <i>Script</i>. The eval
code for a particular invocation of <code>eval</code> is the global code portion of that <i>Script</i>.</p>
</li>
<li>
<p><i>Function code</i> is source text that is parsed to supply the value of the [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">see 9.1.14</a>) of function and generator objects. It includes the code that
defines and initializes the formal parameters of the function. The <i>function code</i> of a particular function or
generator does not include any source text that is parsed as the function code of a nested <i>FunctionBody</i>,
<i>GeneratorBody</i>, <i>ConciseBody</i>, or <i>ClassBody</i>.</p>
</li>
<li>
<p><i>Module code</i> is source text that is code that is provided as a <i>ModuleBody</i>. It is the code that is
directly evaluated when a module is initialized. The module code of a particular module does not include any source text
that is parsed as part of a nested <i>FunctionBody</i>, <i>GeneratorBody</i>, <i>ConciseBody</i>, <i>ClassBody</i>, or
<i>ModuleBody</i>.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> Function code is generally provided as the bodies of Function Definitions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions">14.1</a>), Arrow Function Definitions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions">14.2</a>), Method Definitions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions">14.3</a>) and
Generator Definitions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions">14.4</a>). Function code is also derived from the
last argument to the Function constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-p1-p2-pn-body">19.2.1.1</a>) and the GeneratorFunction
constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction">25.2.1.1</a>).</p>
</div>
</div>
<section id="sec-strict-mode-code">
<h1><span class="secnum" id="sec-10.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code" title="link to this section">10.2.1</a></span>
Strict Mode Code</h1>
<p>An ECMAScript <span class="nt">Script</span> syntactic unit may be processed using either unrestricted or strict mode
syntax and semantics. When processed using strict mode the four types of ECMAScript code are referred to as module code,
strict global code, strict eval code, and strict function code. Code is interpreted as strict mode code in the following
situations:</p>
<ul>
<li>
<p>Global code is strict global code if it begins with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Directive Prologue</a> that contains a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Use Strict Directive</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">see 14.1.1</a>).</p>
</li>
<li>
<p>Module code is always strict code.</p>
</li>
<li>
<p>All parts of a <span class="nt">ClassDeclaration</span> or a <span class="nt">ClassExpression</span> are strict
code.</p>
</li>
<li>
<p>Eval code is strict eval code if it begins with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Directive Prologue</a> that contains a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Use Strict Directive</a> or if the call to eval is a direct
call (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-direct-call-to-eval">see 18.2.1.1</a>) to the eval function that is contained in strict mode
code.</p>
</li>
<li>
<p>Function code that is part of a <span class="nt">FunctionDeclaration</span>, <span class="nt">FunctionExpression</span>, <span class="nt">GeneratorDeclaration</span>, <span class="nt">GeneratorExpression</span>, <span class="nt">MethodDefinition</span>, or <span class="nt">ArrowFunction</span> is strict function code if its <span class="nt">GeneratorDeclaration</span>, <span class="nt">GeneratorExpression</span>, <span class="nt">MethodDefinition</span>, or <span class="nt">ArrowFunction</span> is contained in strict mode code or if its <span class="nt">FunctionBody</span> begins
with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Directive Prologue</a> that contains a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Use Strict Directive</a>.</p>
</li>
<li>
<p>Function code that is supplied as the last argument to the built-in Function constructor is strict function code if
the last argument is a String that when processed as a <span class="nt">FunctionBody</span> begins with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Directive Prologue</a> that contains a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Use Strict Directive</a>.</p>
</li>
</ul>
</section>
<section id="sec-non-ecmascript-functions">
<h1><span class="secnum" id="sec-10.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-non-ecmascript-functions" title="link to this section">10.2.2</a></span> Non-ECMAScript Functions</h1>
<p>An ECMAScript implementation may support the evaluation of exotic function objects whose evaluative behaviour is
expressed in some implementation defined form of executable code other than via ECMAScript code. Whether a function object
is an ECMAScript code function or a non-ECMAScript function is not semantically observable from the perspective of an
ECMAScript code function that calls or is called by such a non-ECMAScript function.</p>
</section>
</section>
</section>
<section id="sec-ecmascript-language-lexical-grammar">
<div class="front">
<h1><span class="secnum" id="sec-11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-lexical-grammar" title="link to this section">11</a></span> ECMAScript Language: Lexical Grammar</h1>
<p>The source text of an ECMAScript script is first converted into a sequence of input elements, which are tokens, line
terminators, comments, or white space. The source text is scanned from left to right, repeatedly taking the longest possible
sequence of characters as the next input element.</p>
<p>There are several situations where the identification of lexical input elements is sensitive to the syntactic grammar
context that is consuming the input elements. This requires multiple goal symbols for the lexical grammar. The <span class="nt">InputElementDiv</span> goal symbol is the default goal symbol and is used in those syntactic grammar contexts where
a leading division (<code>/</code>) or division-assignment (<code>/=</code>) operator is permitted. The <span class="nt">InputElementRegExp</span> goal symbol is used in all syntactic grammar contexts where a <span class="nt">RegularExpressionLiteral</span> is permitted. The <span class="nt">InputElementTemplateTail</span> goal is used in
syntactic grammar contexts where a <span class="nt">TemplateLiteral</span> logically continues after a substitution
element.</p>
<div class="note">
<p><span class="nh">NOTE</span> There are no syntactic grammar contexts where both a leading division or
division-assignment, and a leading <i>RegularExpressionLiteral</i> are permitted. This is not affected by semicolon
insertion (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">see 11.9</a>); in examples such as the following:</p>
<pre>a = b<br>/hi/g.exec(c).map(d);</pre>
<p>where the first non-whitespace, non-comment character after a <i>LineTerminator</i> is slash (<code>/</code>) and the
syntactic context allows division or division-assignment, no semicolon is inserted at the <i>LineTerminator</i>. That is,
the above example is interpreted in the same way as:</p>
<pre>a = b / hi / g.exec(c).map(d);</pre>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">InputElementDiv</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
<div class="rhs"><span class="nt">Comment</span></div>
<div class="rhs"><span class="nt">Token</span></div>
<div class="rhs"><span class="nt">DivPunctuator</span></div>
<div class="rhs"><span class="nt">RightBracePunctuator</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">InputElementRegExp</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
<div class="rhs"><span class="nt">Comment</span></div>
<div class="rhs"><span class="nt">Token</span></div>
<div class="rhs"><span class="nt">RightBracePunctuator</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">InputElementTemplateTail</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
<div class="rhs"><span class="nt">Comment</span></div>
<div class="rhs"><span class="nt">Token</span></div>
<div class="rhs"><span class="nt">DivPunctuator</span></div>
<div class="rhs"><span class="nt">TemplateSubstitutionTail</span></div>
</div>
</div>
<section id="sec-unicode-format-control-characters">
<h1><span class="secnum" id="sec-11.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unicode-format-control-characters" title="link to this section">11.1</a></span> Unicode Format-Control Characters</h1>
<p>The Unicode format-control characters (i.e., the characters in category “Cf” in the Unicode Character Database
such as left-to-right mark or right-to-left mark) are control codes used to control the formatting of a range of text in the
absence of higher-level protocols for this (such as mark-up languages).</p>
<p>It is useful to allow format-control characters in source text to facilitate editing and display. All format control
characters may be used within comments, and within string literals, template literals, and regular expression literals.</p>
<p>U+200C <span style="font-family: Times New Roman">(</span>Zero width non-joiner<span style="font-family: Times New
Roman">)</span> and U+200D <span style="font-family: Times New Roman">(</span>Zero width joiner<span style="font-family: Times
New Roman">)</span> are format-control characters that are used to make necessary distinctions when forming words or phrases
in certain languages. In ECMAScript source text, <span style="font-family: Times New Roman">&lt;ZWNJ&gt;</span> and <span style="font-family: Times New Roman">&lt;ZWJ&gt;</span> may also be used in an identifier after the first character.</p>
<p>U+FEFF <span style="font-family: Times New Roman">(</span>Byte Order Mark<span style="font-family: Times New
Roman">)</span> is a format-control character used primarily at the start of a text to mark it as Unicode and to allow
detection of the text's encoding and byte order. <span style="font-family: Times New Roman">&lt;BOM&gt;</span> characters
intended for this purpose can sometimes also appear after the start of a text, for example as a result of concatenating files.
&lt;BOM&gt; characters are treated as white space characters (see 0).</p>
<p>The special treatment of certain format-control characters outside of comments, string literals, and regular expression
literals is summarised in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-29">Table 29</a>.</p>
<figure>
<figcaption><span id="table-29">Table 29</span> — Format-Control Character Usage</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Code Point</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Name</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Abbreviation</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Usage</th>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+200C</code></td>
<td>Zero width non-joiner</td>
<td>&lt;ZWNJ&gt;</td>
<td style="border-right: 1px solid #000000"><i>IdentifierPart</i></td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+200D</code></td>
<td>Zero width joiner</td>
<td>&lt;ZWJ&gt;</td>
<td style="border-right: 1px solid #000000"><i>IdentifierPart</i></td>
</tr>
<tr>
<td style="border-bottom: 2px solid #000000; border-left: 1px solid #000000"><code>U+FEFF</code></td>
<td style="border-bottom: 2px solid #000000">Byte Order Mark</td>
<td style="border-bottom: 2px solid #000000">&lt;BOM&gt;</td>
<td style="border-bottom: 2px solid #000000; border-right: 1px solid #000000"><i>Whitespace</i></td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-white-space">
<h1><span class="secnum" id="sec-11.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space" title="link to this section">11.2</a></span> White
Space</h1>
<p>White space characters are used to improve source text readability and to separate tokens (indivisible lexical units) from
each other, but are otherwise insignificant. White space characters may occur between any two tokens and at the start or end
of input. White space characters may occur within a <span class="nt">StringLiteral</span>, a <span class="nt">RegularExpressionLiteral</span>, a <span class="nt">Template</span>, or a <span class="nt">TemplateSubstitutionTail</span> where they are considered significant characters forming part of a literal value.
They may also occur within a <span class="nt">Comment</span>, but cannot appear within any other kind of token.</p>
<p>The ECMAScript white space characters are listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-30">Table 30</a>.</p>
<figure>
<figcaption><span id="table-30">Table 30</span> — Whitespace Characters</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Code Point</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Name</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Abbreviation</th>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+0009</code></td>
<td>Character Tabulation</td>
<td style="border-right: 1px solid #000000">&lt;TAB&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+000B</code></td>
<td>LINE TABULATION</td>
<td style="border-right: 1px solid #000000">&lt;VT&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+000C</code></td>
<td>Form Feed</td>
<td style="border-right: 1px solid #000000">&lt;FF&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+0020</code></td>
<td>Space</td>
<td style="border-right: 1px solid #000000">&lt;SP&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+00A0</code></td>
<td>No-break space</td>
<td style="border-right: 1px solid #000000">&lt;NBSP&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>U+FEFF</code></td>
<td>Byte Order Mark</td>
<td style="border-right: 1px solid #000000">&lt;BOM&gt;</td>
</tr>
<tr>
<td style="border-bottom: 2px solid #000000; border-left: 1px solid #000000">Other category “Zs”</td>
<td style="border-bottom: 2px solid #000000">Any other Unicode “Separator, Space” code point</td>
<td style="border-bottom: 2px solid #000000; border-right: 1px solid #000000">&lt;USP&gt;</td>
</tr>
</tbody></table>
</figure>
<p>ECMAScript implementations must recognize as <span class="nt">Whitespace</span> code points listed in the “Separator
Space” (Zs) category by Unicode 5.1.. ECMAScript implementations may also recognize as <span class="nt">Whitespace</span> additional category Zs code points from subsequent editions of the Unicode Standard.</p>
<div class="note">
<p><span class="nh">NOTE</span> Other than for the code points listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-30">Table 30</a>, ECMAScript
<i>Whitespace</i> intentionally excludes all code points that have the Unicode “White_Space” property but which
are not classified in category “Zs”.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">WhiteSpace</span> <span class="geq">::</span></div>
<div class="rhs">&lt;TAB&gt;</div>
<div class="rhs">&lt;VT&gt;</div>
<div class="rhs">&lt;FF&gt;</div>
<div class="rhs">&lt;SP&gt;</div>
<div class="rhs">&lt;NBSP&gt;</div>
<div class="rhs">&lt;BOM&gt;</div>
<div class="rhs">&lt;USP&gt;</div>
</div>
</section>
<section id="sec-line-terminators">
<h1><span class="secnum" id="sec-11.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-line-terminators" title="link to this section">11.3</a></span> Line
Terminators</h1>
<p>Like white space characters, line terminator characters are used to improve source text readability and to separate tokens
(indivisible lexical units) from each other. However, unlike white space characters, line terminators have some influence over
the behaviour of the syntactic grammar. In general, line terminators may occur between any two tokens, but there are a few
places where they are forbidden by the syntactic grammar. Line terminators also affect the process of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">11.9</a>). A line terminator cannot occur within any token except a <span class="nt">StringLiteral</span>, <span class="nt">Template</span>, or <span class="nt">TemplateSubstitutionTail</span>. Line
terminators may only occur within a <span class="nt">StringLiteral</span> token as part of a <span class="nt">LineContinuation</span>.</p>
<p>A line terminator can occur within a <span class="nt">MultiLineComment</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comments">11.4</a>) but cannot
occur within a <span class="nt">SingleLineComment</span>.</p>
<p>Line terminators are included in the set of white space characters that are matched by the <code>\s</code> class in regular
expressions.</p>
<p>The ECMAScript line terminator characters are listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-31">Table 31</a>.</p>
<figure>
<figcaption><span id="table-31">Table 31</span> — Line Terminator Characters</figcaption>
<table class="real-table">
<tbody><tr>
<th>Code Point</th>
<th>Name</th>
<th>Abbreviation</th>
</tr>
<tr>
<td><code>U+000A</code></td>
<td>Line Feed</td>
<td>&lt;LF&gt;</td>
</tr>
<tr>
<td><code>U+000D</code></td>
<td>Carriage Return</td>
<td>&lt;CR&gt;</td>
</tr>
<tr>
<td><code>U+2028</code></td>
<td>Line separator</td>
<td>&lt;LS&gt;</td>
</tr>
<tr>
<td><code>U+2029</code></td>
<td>Paragraph separator</td>
<td>&lt;PS&gt;</td>
</tr>
</tbody></table>
</figure>
<p>Only the Unicode code points in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-31">Table 31</a> are treated as line terminators. Other new line or line
breaking Unicode code points are treated as white space but not as line terminators. The sequence &lt;CR&gt;&lt;LF&gt; is
commonly used as a line terminator. It should be considered a single <span class="nt">SourceCharacter</span> for the purpose
of reporting line numbers.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">LineTerminator</span> <span class="geq">::</span></div>
<div class="rhs">&lt;LF&gt;</div>
<div class="rhs">&lt;CR&gt;</div>
<div class="rhs">&lt;LS&gt;</div>
<div class="rhs">&lt;PS&gt;</div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span></div>
<div class="rhs">&lt;LF&gt;</div>
<div class="rhs">&lt;CR&gt; <span class="grhsannot">[lookahead ∉ &lt;LF&gt; ]</span></div>
<div class="rhs">&lt;LS&gt;</div>
<div class="rhs">&lt;PS&gt;</div>
<div class="rhs">&lt;CR&gt; &lt;LF&gt;</div>
</div>
</section>
<section id="sec-comments">
<h1><span class="secnum" id="sec-11.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comments" title="link to this section">11.4</a></span> Comments</h1>
<p>Comments can be either single or multi-line. Multi-line comments cannot nest.</p>
<p>Because a single-line comment can contain any Unicode code point except a <span class="nt">LineTerminator</span> character,
and because of the general rule that a token is always as long as possible, a single-line comment always consists of all
characters from the <code>//</code> marker to the end of the line. However, the <span class="nt">LineTerminator</span> at the
end of the line is not considered to be part of the single-line comment; it is recognised separately by the lexical grammar
and becomes part of the stream of input elements for the syntactic grammar. This point is very important, because it implies
that the presence or absence of single-line comments does not affect the process of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">see
11.9</a>).</p>
<p>Comments behave like white space and are discarded except that, if a <span class="nt">MultiLineComment</span> contains a
line terminator character, then the entire comment is considered to be a <span class="nt">LineTerminator</span> for purposes
of parsing by the syntactic grammar.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Comment</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">MultiLineComment</span></div>
<div class="rhs"><span class="nt">SingleLineComment</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MultiLineComment</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">/*</code> <span class="nt">MultiLineCommentChars</span><sub>opt</sub> <code class="t">*/</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MultiLineCommentChars</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">MultiLineNotAsteriskChar</span> <span class="nt">MultiLineCommentChars</span><sub>opt</sub></div>
<div class="rhs"><code class="t">*</code> <span class="nt">PostAsteriskCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PostAsteriskCommentChars</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">MultiLineNotForwardSlashOrAsteriskChar</span> <span class="nt">MultiLineCommentChars</span><sub>opt</sub></div>
<div class="rhs"><code class="t">*</code> <span class="nt">PostAsteriskCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MultiLineNotAsteriskChar</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <code class="t">*</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MultiLineNotForwardSlashOrAsteriskChar</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">/</code> <span class="grhsmod">or</span> <code class="t">*</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleLineComment</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">//</code> <span class="nt">SingleLineCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleLineCommentChars</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SingleLineCommentChar</span> <span class="nt">SingleLineCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleLineCommentChar</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">LineTerminator</span></div>
</div>
</section>
<section id="sec-tokens">
<h1><span class="secnum" id="sec-11.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tokens" title="link to this section">11.5</a></span> Tokens</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Token</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">Punctuator</span></div>
<div class="rhs"><span class="nt">NumericLiteral</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
<div class="rhs"><span class="nt">Template</span></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The <i>DivPunctuator</i>, <i>RegularExpressionLiteral</i>, <i>RightBracePunctuator,</i> and
<i>TemplateSubstitutionTail</i> productions define tokens, but are not included in the <i>Token</i> production.</p>
</div>
</section>
<section id="sec-names-and-keywords">
<div class="front">
<h1><span class="secnum" id="sec-11.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-names-and-keywords" title="link to this section">11.6</a></span> Names
and Keywords</h1>
<p><span class="nt">IdentifierName</span> and <span class="nt">ReservedWord</span> are tokens that are interpreted according
to the Default Identifier Syntax given in Unicode Standard Annex #31, Identifier and Pattern Syntax, with some small
modifications. <span class="nt">ReservedWord</span> is is an enumerated subset of <span style="font-family: Times New
Roman"><i>IdentifierName</i>.</span> The syntactic grammer defines <span class="nt">Identifier</span> as an <span class="nt">IdentifierName</span> that is not a <span class="nt">ReservedWord</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words">see
11.6.2</a>). The Unicode identifier grammar is based on character properties specified by the Unicode Standard. The Unicode
code points in the specified categories in version 5.1.0 of the Unicode standard must be treated as in those categories by
all conforming ECMAScript implementations. ECMAScript implementations may recognise identifier characters defined in later
editions of the Unicode Standard.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> This standard specifies specific character additions: The dollar sign
(<code>U+0024</code>) and the underscore (<code>U+005f</code>) are permitted anywhere in an <i>IdentifierName</i><span style="font-family: sans-serif">, and the characters zero width non-joiner (U+200C) and zero width joiner (U+200D) are
permitted anywhere after the first character of an</span> <i>IdentifierName</i>.</p>
</div>
<p>Unicode escape sequences are permitted in an <span class="nt">IdentifierName</span>, where they contribute a single
Unicode code point to the <span class="nt">IdentifierName</span>. The code point is expressed by the <span class="nt">HexDigits</span> of the <span class="nt">UnicodeEscapeSequence</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals">see 11.8.4</a>). The <code>\</code> preceding the <span class="nt">UnicodeEscapeSequence</span> and the <code>u</code> and <code>{ }</code> characters, if they appear, do not
contribute code points to the <span class="nt">IdentifierName</span>. A <span class="nt">UnicodeEscapeSequence</span> cannot
be used to put a code point into an <span class="nt">IdentifierName</span> that would otherwise be illegal. In other words,
if a <code>\</code> <span class="nt">UnicodeEscapeSequence</span> sequence were replaced by the <span class="nt">SourceCharacter</span> it constributes, the result must still be a valid <span class="nt">IdentifierName</span>
that has the exact same sequence of <span class="nt">SourceCharacter</span> elements as the original <span class="nt">IdentifierName</span>. All interpretations of <span class="nt">IdentifierName</span> within this specification
are based upon their actual code points regardless of whether or not an escape sequence was used to contribute any
particular characters.</p>
<p>Two <span class="nt">IdentifierName</span> that are canonically equivalent according to the Unicode standard are
<i>not</i> equal unless they are represented by the exact same sequence of code points (in other words, conforming
ECMAScript implementations are only required to do bitwise comparison on IdentifierName values).</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">IdentifierName</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">IdentifierStart</span></div>
<div class="rhs"><span class="nt">IdentifierName</span> <span class="nt">IdentifierPart</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">IdentifierStart</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">UnicodeIDStart</span></div>
<div class="rhs"><code class="t">$</code></div>
<div class="rhs"><code class="t">_</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">UnicodeEscapeSequence</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">IdentifierPart</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">UnicodeIDContinue</span></div>
<div class="rhs"><code class="t">$</code></div>
<div class="rhs"><code class="t">_</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">UnicodeEscapeSequence</span></div>
<div class="rhs">&lt;ZWNJ&gt;</div>
<div class="rhs">&lt;ZWJ&gt;</div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">UnicodeIDStart</span> <span class="geq">::</span></div>
<div class="rhs"><span class="gprose">any Unicode code point with the Unicode property “ID_Start”.</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">UnicodeIDContinue</span> <span class="geq">::</span></div>
<div class="rhs"><span class="gprose">any Unicode code point with the Unicode property “ID_Continue”</span></div>
</div>
<p>The definitions of the nonterminal <span class="nt">UnicodeEscapeSequence</span> is given in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals">11.8.4</a>.</p>
</div>
<section id="sec-identifier-names">
<div class="front">
<h1><span class="secnum" id="sec-11.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-names" title="link to this section">11.6.1</a></span>
Identifier Names</h1>
</div>
<section id="sec-identifier-names-static-semantics-early-errors">
<h1><span class="secnum" id="sec-11.6.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-names-static-semantics-early-errors" title="link to this section">11.6.1.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">IdentifierStart</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">UnicodeEscapeSequence</span></div>
<ul>
<li>
<p>It is an Sytax Error if <span style="font-family: Times New Roman">SV(<i>UnicodeEscapeSequence</i>)</span> is
neither the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">UTF-16 encoding</a> of a single Unicode code point with
the Unicode property “ID_Start” nor <code>"$″</code> or <code>"_″</code>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">IdentifierPart</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">UnicodeEscapeSequence</span></div>
<ul>
<li>
<p>It is an Sytax Error if <span style="font-family: Times New Roman">SV(<i>UnicodeEscapeSequence</i>)</span> is
neither the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">UTF-16 encoding</a> of a single Unicode code point with
the Unicode property “ID_Continue” nor <code>"$″</code> or <code>"_″</code> nor the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">UTF-16 encoding</a> either &lt;ZWNJ&gt; or &lt;ZAJ&gt;.</p>
</li>
</ul>
</section>
<section id="sec-identifier-names-static-semantics-stringvalue">
<h1><span class="secnum" id="sec-11.6.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-names-static-semantics-stringvalue" title="link to this section">11.6.1.2</a></span> Static Semantics<span style="font-family: sans-serif">:</span>
<i>StringValue</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-literals-static-semantics-stringvalue">11.8.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-stringvalue">12.1.4</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">IdentifierName</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">IdentifierStart</span></div>
<div class="rhs"><span class="nt">IdentifierName</span> <span class="nt">IdentifierPart</span></div>
</div>
<ol class="proc">
<li>Return the String value consisting of the sequence of code units corresponding to <i>IdentifierName</i>. In
determining the sequence any occurrences of <code>\</code> <i>UnicodeEscapeSequence</i> are first replaced with the
code point represented by the <i>UnicodeEscapeSequence</i> and then the code points of the entire
<i>IdentifierName</i> are converted to code units by UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) each code point.</li>
</ol>
</section>
</section>
<section id="sec-reserved-words">
<div class="front">
<h1><span class="secnum" id="sec-11.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words" title="link to this section">11.6.2</a></span>
Reserved Words</h1>
<p>A reserved word is an <span class="nt">IdentifierName</span> that cannot be used as an <span class="nt">Identifier</span>.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ReservedWord</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Keyword</span></div>
<div class="rhs"><span class="nt">FutureReservedWord</span></div>
<div class="rhs"><span class="nt">NullLiteral</span></div>
<div class="rhs"><span class="nt">BooleanLiteral</span></div>
</div>
<p>The <span class="nt">ReservedWord</span> definitions are specified as literal sequences of specific <span class="nt">SourceCharacter</span> elements. Code point in a <span class="nt">ReservedWord</span> can not be expressed by
a <code>\</code> <span class="nt">UnicodeEscapeSequence</span>.</p>
</div>
<section id="sec-keywords">
<h1><span class="secnum" id="sec-11.6.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords" title="link to this section">11.6.2.1</a></span>
Keywords</h1>
<p>The following tokens are ECMAScript keywords and may not be used as <span class="nt">Identifiers</span> in ECMAScript
programs.</p>
<h2>Syntax</h2>
<div class="gp prod"><span class="nt">Keyword</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">break</span></td>
<td><span style="font-family: monospace">do</span></td>
<td><span style="font-family: monospace">in</span></td>
<td><span style="font-family: monospace">typeof</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">case</span></td>
<td><span style="font-family: monospace">else</span></td>
<td><span style="font-family: monospace">instanceof</span></td>
<td><span style="font-family: monospace">var</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">catch</span></td>
<td><span style="font-family: monospace">export</span></td>
<td><span style="font-family: monospace">new</span></td>
<td><span style="font-family: monospace">void</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">class</span></td>
<td><span style="font-family: monospace">extends</span></td>
<td><span style="font-family: monospace">return</span></td>
<td><span style="font-family: monospace">while</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">const</span></td>
<td><span style="font-family: monospace">finally</span></td>
<td><span style="font-family: monospace">super</span></td>
<td><span style="font-family: monospace">with</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">continue</span></td>
<td><span style="font-family: monospace">for</span></td>
<td><span style="font-family: monospace">switch</span></td>
<td><span style="font-family: monospace">yield</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">debugger</span></td>
<td><span style="font-family: monospace">function</span></td>
<td><span style="font-family: monospace">this</span></td>
<td></td>
</tr>
<tr>
<td><span style="font-family: monospace">default</span></td>
<td><span style="font-family: monospace">if</span></td>
<td><span style="font-family: monospace">throw</span></td>
<td></td>
</tr>
<tr>
<td><span style="font-family: monospace">delete</span></td>
<td><span style="font-family: monospace">import</span></td>
<td><span style="font-family: monospace">try</span></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="note">
<p><span class="nh">NOTE</span> In some contexts <code>yield</code> is given the semantics of an <i>Identifier</i>. See
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors">12.1.1</a>. In <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode
code</a>, <code>let</code> is treated as a keyword through static semantic restrictions (see <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors">12.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-static-semantics-early-errors">12.2.4.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-early-errors">13.2.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-early-errors">13.6.4.1</a>, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-early-errors">14.5.1</a>) rather than the lexical grammar.</p>
</div>
</section>
<section id="sec-future-reserved-words">
<h1><span class="secnum" id="sec-11.6.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words" title="link to this section">11.6.2.2</a></span> Future Reserved Words</h1>
<p>The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility
of future adoption of those extensions.</p>
<h2>Syntax</h2>
<div class="gp prod"><span class="nt">FutureReservedWord</span> <span class="geq">::</span></div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td></td>
<td><span style="font-family: monospace">enum</span></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="note">
<p><span class="nh">NOTE</span> Use of the following tokens within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see 10.2.1</a>) is also reserved. That usage is restricted using static semantic
restrictions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors">see 12.1.1</a>) rather than the lexical
grammar:</p>
</div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td></td>
<td>
<p class="Note">implements</p>
</td>
<td>
<p class="Note">package</p>
</td>
<td>
<p class="Note">protected</p>
</td>
<td>
<p class="Note">static</p>
</td>
</tr>
<tr>
<td></td>
<td>
<p class="Note">interface</p>
</td>
<td>
<p class="Note">private</p>
</td>
<td>
<p class="Note">public</p>
</td>
<td></td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-punctuators">
<h1><span class="secnum" id="sec-11.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-punctuators" title="link to this section">11.7</a></span>
Punctuators</h1>
<h2>Syntax</h2>
<div class="gp prod"><span class="nt">Punctuator</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">{</span></td>
<td><span style="font-family: monospace">(</span></td>
<td><span style="font-family: monospace">)</span></td>
<td><span style="font-family: monospace">[</span></td>
<td><span style="font-family: monospace">]</span></td>
<td><span style="font-family: monospace">.</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">...</span></td>
<td><span style="font-family: monospace">;</span></td>
<td><span style="font-family: monospace">,</span></td>
<td><span style="font-family: monospace">&lt;</span></td>
<td><span style="font-family: monospace">&gt;</span></td>
<td><span style="font-family: monospace">&lt;=</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">&gt;=</span></td>
<td><span style="font-family: monospace">==</span></td>
<td><span style="font-family: monospace">!=</span></td>
<td><span style="font-family: monospace">===</span></td>
<td><span style="font-family: monospace">!==</span></td>
<td></td>
</tr>
<tr>
<td><span style="font-family: monospace">+</span></td>
<td><span style="font-family: monospace">-</span></td>
<td><span style="font-family: monospace">*</span></td>
<td><span style="font-family: monospace">%</span></td>
<td><span style="font-family: monospace">++</span></td>
<td><span style="font-family: monospace">--</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">&lt;&lt;</span></td>
<td><span style="font-family: monospace">&gt;&gt;</span></td>
<td><span style="font-family: monospace">&gt;&gt;&gt;</span></td>
<td><span style="font-family: monospace">&amp;</span></td>
<td><span style="font-family: monospace">|</span></td>
<td><span style="font-family: monospace">^</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">!</span></td>
<td><span style="font-family: monospace">~</span></td>
<td><span style="font-family: monospace">&amp;&amp;</span></td>
<td><span style="font-family: monospace">||</span></td>
<td><span style="font-family: monospace">?</span></td>
<td><span style="font-family: monospace">:</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">=</span></td>
<td><span style="font-family: monospace">+=</span></td>
<td><span style="font-family: monospace">-=</span></td>
<td><span style="font-family: monospace">*=</span></td>
<td><span style="font-family: monospace">%=</span></td>
<td><span style="font-family: monospace">&lt;&lt;=</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&gt;&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&amp;=</span></td>
<td><span style="font-family: monospace">|=</span></td>
<td><span style="font-family: monospace">^=</span></td>
<td><span style="font-family: monospace">=&gt;</span></td>
</tr>
</tbody></table>
</figure>
<div class="gp prod"><span class="nt">DivPunctuator</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">/</span></td>
<td><span style="font-family: monospace">/=</span></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="gp prod"><span class="nt">RightBracePunctuator</span> <span class="geq">::</span></div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">}</span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-ecmascript-language-lexical-grammar-literals">
<div class="front">
<h1><span class="secnum" id="sec-11.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-lexical-grammar-literals" title="link to this section">11.8</a></span> Literals</h1>
</div>
<section id="sec-null-literals">
<h1><span class="secnum" id="sec-11.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-null-literals" title="link to this section">11.8.1</a></span> Null
Literals</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">NullLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">null</code></div>
</div>
</section>
<section id="sec-boolean-literals">
<h1><span class="secnum" id="sec-11.8.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-literals" title="link to this section">11.8.2</a></span>
Boolean Literals</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">BooleanLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">true</code></div>
<div class="rhs"><code class="t">false</code></div>
</div>
</section>
<section id="sec-literals-numeric-literals">
<div class="front">
<h1><span class="secnum" id="sec-11.8.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals" title="link to this section">11.8.3</a></span> Numeric Literals</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">NumericLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalLiteral</span></div>
<div class="rhs"><span class="nt">BinaryIntegerLiteral</span></div>
<div class="rhs"><span class="nt">OctalIntegerLiteral</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalIntegerLiteral</span> <code class="t">.</code> <span class="nt">DecimalDigits</span><sub>opt</sub> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">DecimalIntegerLiteral</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalIntegerLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">0</code></div>
<div class="rhs"><span class="nt">NonZeroDigit</span> <span class="nt">DecimalDigits</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalDigits</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NonZeroDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExponentPart</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ExponentIndicator</span> <span class="nt">SignedInteger</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExponentIndicator</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">e</code> <code class="t">E</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SignedInteger</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">DecimalDigits</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BinaryIntegerLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">0b</code> <span class="nt">BinaryDigits</span></div>
<div class="rhs"><code class="t">0B</code> <span class="nt">BinaryDigits</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BinaryDigits</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">BinaryDigit</span></div>
<div class="rhs"><span class="nt">BinaryDigits</span> <span class="nt">BinaryDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BinaryDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">OctalIntegerLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">0o</code> <span class="nt">OctalDigits</span></div>
<div class="rhs"><code class="t">0O</code> <span class="nt">OctalDigits</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">OctalDigits</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">OctalDigit</span></div>
<div class="rhs"><span class="nt">OctalDigits</span> <span class="nt">OctalDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">OctalDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">HexIntegerLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">0x</code> <span class="nt">HexDigits</span></div>
<div class="rhs"><code class="t">0X</code> <span class="nt">HexDigits</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">HexDigits</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">HexDigit</span></div>
<div class="rhs"><span class="nt">HexDigits</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">HexDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code> <code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code></div>
</div>
<p>The <span class="nt">SourceCharacter</span> immediately following a <span class="nt">NumericLiteral</span> must not be
an <span class="nt">IdentifierStart</span> or <span class="nt">DecimalDigit</span>.</p>
<div class="note">
<p><span class="nh">NOTE</span> For example:</p>
<pre>3in</pre>
<p>is an error and not the two input elements <code>3</code> and <code>in</code>.</p>
</div>
<p>A conforming implementation, when processing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see 10.2.1</a>), must not extend the syntax of <span class="nt">NumericLiteral</span> to
include <i>Legacy<span style="font-family: Times New Roman">OctalIntegerLiteral</span></i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-numeric-literals">B.1.1</a>.</p>
</div>
<section id="sec-static-semantics-mv-s">
<h1><span class="secnum" id="sec-11.8.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-mv-s" title="link to this section">11.8.3.1</a></span> Static Semantics: MV’s</h1>
<p>A numeric literal stands for a value of the Number type. This value is determined in two steps: first, a mathematical
value (MV) is derived from the literal; second, this mathematical value is rounded as described below.</p>
<ul>
<li>
<p>The MV of <span class="prod"><span class="nt">NumericLiteral</span> <span class="geq">::</span> <span class="nt">DecimalLiteral</span></span> is the MV of <i>DecimalLiteral</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">NumericLiteral</span> <span class="geq">::</span> <span class="nt">BinaryIntegerLiteral</span></span> is the MV of <i>BinaryIntegerLiteral</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">NumericLiteral</span> <span class="geq">::</span> <span class="nt">OctalIntegerLiteral</span></span> is the MV of <i>OctalIntegerLiteral</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">NumericLiteral</span> <span class="geq">::</span> <span class="nt">HexIntegerLiteral</span></span> is the MV of <i>HexIntegerLiteral</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span> <code class="t">.</code></span> is the MV of <i>DecimalIntegerLiteral</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span> <code class="t">.</code> <span class="nt">DecimalDigits</span></span> is the
MV of <i>DecimalIntegerLiteral</i> plus (the MV of <i>DecimalDigits</i> × 10<sup>–<i>n</i></sup>), where
<i>n</i> is the number of characters in <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span> <code class="t">.</code> <span class="nt">ExponentPart</span></span> is the MV
of <i>DecimalIntegerLiteral</i> × 10<sup><i>e</i></sup>, where <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span> <code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span></span> is (the MV of <i>DecimalIntegerLiteral</i> plus (the MV of <i>DecimalDigits</i>
× 10<sup>–<i>n</i></sup>)) × 10<sup><i>e</i></sup>, where <i>n</i> is the number of characters in
<i>DecimalDigits</i> and <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <code class="t">.</code> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i> ×
10<sup>–<i>n</i></sup>, where <i>n</i> is the number of characters in <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span></span> is the MV of
<i>DecimalDigits</i> × 10<sup><i>e</i>–<i>n</i></sup>, where <i>n</i> is the number of characters in
<i>DecimalDigits</i> and <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span></span> is the MV of <i>DecimalIntegerLiteral</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span> <span class="nt">ExponentPart</span></span> is the MV of
<i>DecimalIntegerLiteral</i> × 10<sup><i>e</i></sup>, where <i>e</i> is the MV of <i>ExponentPart</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalIntegerLiteral</span> <span class="geq">::</span> <code class="t">0</code></span> is 0.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalIntegerLiteral</span> <span class="geq">::</span> <span class="nt">NonZeroDigit</span></span> is the MV of <i>NonZeroDigit.</i></p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalIntegerLiteral</span> <span class="geq">::</span> <span class="nt">NonZeroDigit</span> <span class="nt">DecimalDigits</span></span> is (the MV of <i>NonZeroDigit</i> ×
10<sup><i>n</i></sup>) plus the MV of <i>DecimalDigits</i>, where <i>n</i> is the number of characters in
<i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigits</span> <span class="geq">::</span> <span class="nt">DecimalDigit</span></span> is the MV of <i>DecimalDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigits</span> <span class="geq">::</span> <span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></span> is (the MV of <i>DecimalDigits</i> ×
10) plus the MV of <i>DecimalDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">ExponentPart</span> <span class="geq">::</span> <span class="nt">ExponentIndicator</span> <span class="nt">SignedInteger</span></span> is the MV of
<i>SignedInteger</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">SignedInteger</span> <span class="geq">::</span> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">SignedInteger</span> <span class="geq">::</span> <code class="t">+</code> <span class="nt">DecimalDigits</span></span> is the MV of <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">SignedInteger</span> <span class="geq">::</span> <code class="t">-</code> <span class="nt">DecimalDigits</span></span> is the negative of the MV of <i>DecimalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">0</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">0</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span>
<code class="t">0</code></span> or of <span class="prod"><span class="nt">BinaryDigit</span> <span class="geq">::</span> <code class="t">0</code></span> is 0.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">1</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">1</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">1</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">1</code></span> or<br>of <span class="prod"><span class="nt">BinaryDigit</span>
<span class="geq">::</span> <code class="t">1</code></span> is 1.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">2</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">2</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">2</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">2</code></span> is 2.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">3</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">3</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">3</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">3</code></span> is 3.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">4</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">4</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">4</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">4</code></span> is 4.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">5</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">5</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">5</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">5</code></span> is 5.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">6</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">6</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">6</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">6</code></span> is 6.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">7</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">7</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">7</code></span> or of <span class="prod"><span class="nt">OctalDigit</span> <span class="geq">::</span> <code class="t">7</code></span> is 7.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">8</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">8</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">8</code></span> is 8.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <code class="t">9</code></span> or of <span class="prod"><span class="nt">NonZeroDigit</span> <span class="geq">::</span>
<code class="t">9</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span>
<code class="t">9</code></span> is 9.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">a</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">A</code></span> is 10.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">b</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">B</code></span> is 11.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">c</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">C</code></span> is 12.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">d</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">D</code></span> is 13.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">e</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">E</code></span> is 14.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">f</code></span> or of <span class="prod"><span class="nt">HexDigit</span> <span class="geq">::</span> <code class="t">F</code></span> is 15.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">BinaryIntegerLiteral</span> <span class="geq">::</span> <code class="t">0b</code> <span class="nt">BinaryDigits</span></span> is the MV of <i>BinaryDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">BinaryIntegerLiteral</span> <span class="geq">::</span> <code class="t">0B</code> <span class="nt">BinaryDigits</span></span> is the MV of <i>BinaryDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">BinaryDigits</span> <span class="geq">::</span> <span class="nt">BinaryDigit</span></span> is the MV of <i>BinaryDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">BinaryDigits</span> <span class="geq">::</span> <span class="nt">BinaryDigits</span> <span class="nt">BinaryDigit</span></span> is (the MV of <i>BinaryDigits</i> × 2)
plus the MV of <i>BinaryDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">OctalIntegerLiteral</span> <span class="geq">::</span> <code class="t">0o</code> <span class="nt">OctalDigits</span></span> is the MV of <i>OctalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">OctalIntegerLiteral</span> <span class="geq">::</span> <code class="t">0O</code> <span class="nt">OctalDigits</span></span> is the MV of <i>OctalDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">OctalDigits</span> <span class="geq">::</span> <span class="nt">OctalDigit</span></span> is the MV of <i>OctalDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">OctalDigits</span> <span class="geq">::</span> <span class="nt">OctalDigits</span> <span class="nt">OctalDigit</span></span> is (the MV of <i>OctalDigits</i> × 8)
plus the MV of <i>OctalDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexIntegerLiteral</span> <span class="geq">::</span> <code class="t">0x</code> <span class="nt">HexDigits</span></span> is the MV of <i>HexDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexIntegerLiteral</span> <span class="geq">::</span> <code class="t">0X</code> <span class="nt">HexDigits</span></span> is the MV of <i>HexDigits</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigits</span> <span class="geq">::</span> <span class="nt">HexDigit</span></span> is the MV of <i>HexDigit</i>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">HexDigits</span> <span class="geq">::</span> <span class="nt">HexDigits</span> <span class="nt">HexDigit</span></span> is (the MV of <i>HexDigits</i> × 16) plus
the MV of <i>HexDigit</i>.</p>
</li>
</ul>
<p>Once the exact MV for a numeric literal has been determined, it is then rounded to a value of the Number type. If the
MV is 0, then the rounded value is <span class="value">+0</span>; otherwise, the rounded value must be the Number value
for the MV (as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">6.1.6</a>), unless the literal is a <span class="nt">DecimalLiteral</span> and the literal has more than 20 significant digits, in which case the Number value may
be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a
<code>0</code> digit or the Number value for the MV of a literal produced by replacing each significant digit after the
20th with a <code>0</code> digit and then incrementing the literal at the 20th significant digit position. A digit is
<i>significant</i> if it is not part of an <span class="nt">ExponentPart</span> and</p>
<ul>
<li>it is not <code>0</code>; or</li>
<li>there is a nonzero digit to its left and there is a nonzero digit, not in the <i>ExponentPart</i>, to its
right.</li>
</ul>
</section>
</section>
<section id="sec-literals-string-literals">
<div class="front">
<h1><span class="secnum" id="sec-11.8.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals" title="link to this section">11.8.4</a></span> String Literals</h1>
<div class="note">
<p><span class="nh">NOTE</span> A string literal is zero or more Unicode code points enclosed in single or double
quotes. Unicode code points may also be represented by an escape sequence. All characters may appear literally in a
string literal except for the closing quote character, backslash, carriage return, line separator, paragraph separator,
and line feed. Any character may appear in the form of an escape sequence. String literals evaluate to ECAMScript String
values. When generating these string values Unicode code points are UTF-16 encoded as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>. Code points belonging to Basic Multilingual Plane are encoded
as a single code unit element of the string. All other code points are encoded as two code unit elements of the
string.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">StringLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">"</code> <span class="nt">DoubleStringCharacters</span><sub>opt</sub> <code class="t">"</code></div>
<div class="rhs"><code class="t">'</code> <span class="nt">SingleStringCharacters</span><sub>opt</sub> <code class="t">'</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DoubleStringCharacters</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DoubleStringCharacter</span> <span class="nt">DoubleStringCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleStringCharacters</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SingleStringCharacter</span> <span class="nt">SingleStringCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">"</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">EscapeSequence</span></div>
<div class="rhs"><span class="nt">LineContinuation</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleStringCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">'</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">EscapeSequence</span></div>
<div class="rhs"><span class="nt">LineContinuation</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LineContinuation</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">LineTerminatorSequence</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">EscapeSequence</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">CharacterEscapeSequence</span></div>
<div class="rhs"><code class="t">0</code> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
<div class="rhs"><span class="nt">HexEscapeSequence</span></div>
<div class="rhs"><span class="nt">UnicodeEscapeSequence</span></div>
</div>
<p>A conforming implementation, when processing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see 10.2.1</a>), must not extend the syntax of <span class="nt">EscapeSequence</span> to
include <i>Legacy<span style="font-family: Times New Roman">OctalEscapeSequence</span></i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-numeric-literals">B.1.1</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">CharacterEscapeSequence</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SingleEscapeCharacter</span></div>
<div class="rhs"><span class="nt">NonEscapeCharacter</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleEscapeCharacter</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">'</code> <code class="t">"</code> <code class="t">\</code> <code class="t">b</code> <code class="t">f</code> <code class="t">n</code> <code class="t">r</code> <code class="t">t</code> <code class="t">v</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NonEscapeCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <span class="nt">EscapeCharacter</span> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">EscapeCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SingleEscapeCharacter</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><code class="t">x</code></div>
<div class="rhs"><code class="t">u</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">HexEscapeSequence</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">x</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">u</code> <span class="nt">Hex4Digits</span></div>
<div class="rhs"><code class="t">u{</code> <span class="nt">HexDigits</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Hex4Digits</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></div>
</div>
<p>The definition of the nonterminal <span class="nt">HexDigit</span> is given in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a>. <span class="nt">SourceCharacter</span> is defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-source-text">10.1</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> A line terminator character cannot appear in a string literal, except as part of a
<i>LineContinuation</i> to produce the empty character sequence. The correct way to cause a line terminator character to
be part of the String value of a string literal is to use an escape sequence such as <code>\n</code> or
<code>\u000A</code>.</p>
</div>
</div>
<section id="sec-string-literals-static-semantics-early-errors">
<h1><span class="secnum" id="sec-11.8.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-literals-static-semantics-early-errors" title="link to this section">11.8.4.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u{</code> <span class="nt">HexDigits</span> <code class="t">}</code></div>
<ul>
<li>It is a Syntax Error if the MV of <span class="nt">HexDigits</span> &gt; <span style="font-family: Times New
Roman">1114111<i>.</i></span></li>
</ul>
</section>
<section id="sec-string-literals-static-semantics-stringvalue">
<h1><span class="secnum" id="sec-11.8.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-literals-static-semantics-stringvalue" title="link to this section">11.8.4.2</a></span> Static Semantics<span style="font-family: sans-serif">:</span>
<i>StringValue</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-names-static-semantics-stringvalue">11.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-stringvalue">12.1.4</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">StringLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">"</code> <span class="nt">DoubleStringCharacters</span><sub>opt</sub> <code class="t">"</code></div>
<div class="rhs"><code class="t">'</code> <span class="nt">SingleStringCharacters</span><sub>opt</sub> <code class="t">'</code></div>
</div>
<ol class="proc">
<li>Return the String value whose elements are the SV of this <i>StringLiteral</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-sv-s-and-cv-s">
<h1><span class="secnum" id="sec-11.8.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-sv-s-and-cv-s" title="link to this section">11.8.4.3</a></span> Static Semantics: <i>SV’s and CV’s</i></h1>
<p>A string literal stands for a value of the String type. The String value (SV) of the literal is described in terms of
code unit values (CV) contributed by the various parts of the string literal. As part of this process, some Unicode code
points within the string literal are interpreted as having a mathematical value (MV), as described below or in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a>.</p>
<ul>
<li>
<p>The SV of <span class="prod"><span class="nt">StringLiteral</span> <span class="geq">::</span> <code class="t">""</code></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">StringLiteral</span> <span class="geq">::</span> <code class="t">''</code></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">StringLiteral</span> <span class="geq">::</span> <code class="t">"</code> <span class="nt">DoubleStringCharacters</span> <code class="t">"</code></span> is the SV of
<i>DoubleStringCharacters</i>.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">StringLiteral</span> <span class="geq">::</span> <code class="t">'</code> <span class="nt">SingleStringCharacters</span> <code class="t">'</code></span> is the SV of
<i>SingleStringCharacters</i>.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">DoubleStringCharacters</span> <span class="geq">::</span> <span class="nt">DoubleStringCharacter</span></span> is a sequence of one or two code units that is the CV of
<i>DoubleStringCharacter</i>.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">DoubleStringCharacters</span> <span class="geq">::</span> <span class="nt">DoubleStringCharacter</span> <span class="nt">DoubleStringCharacters</span></span> is a sequence of one or
two code units that is the CV of <i>DoubleStringCharacter</i> followed by all the code units in the SV of
<i>DoubleStringCharacters</i> in order.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">SingleStringCharacters</span> <span class="geq">::</span> <span class="nt">SingleStringCharacter</span></span> is a sequence of one or two code units that is the CV of
<i>SingleStringCharacter</i>.</p>
</li>
<li>
<p>The SV of <span class="prod"><span class="nt">SingleStringCharacters</span> <span class="geq">::</span> <span class="nt">SingleStringCharacter</span> <span class="nt">SingleStringCharacters</span></span> is a sequence of one or
two code units that is the CV of <i>SingleStringCharacter</i> followed by all the code units in the SV of
<i>SingleStringCharacters</i> in order.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">"</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></span> is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the code point value of <i>SourceCharacter</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">EscapeSequence</span></span> is the CV of the <i>EscapeSequence</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span> <span class="nt">LineContinuation</span></span> is the empty character sequence.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">SingleStringCharacter</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">'</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></span> is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the code point value of <i>SourceCharacter</i> .</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">SingleStringCharacter</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">EscapeSequence</span></span> is the CV of the <i>EscapeSequence</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">SingleStringCharacter</span> <span class="geq">::</span> <span class="nt">LineContinuation</span></span> is the empty character sequence.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">CharacterEscapeSequence</span></span> is the CV of the <i>CharacterEscapeSequence</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <code class="t">0</code></span> is the code unit value 0.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">HexEscapeSequence</span></span> is the CV of the <i>HexEscapeSequence</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">UnicodeEscapeSequence</span></span> is the CV of the <i>UnicodeEscapeSequence</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">CharacterEscapeSequence</span> <span class="geq">::</span> <span class="nt">SingleEscapeCharacter</span></span> is the character whose code unit value is determined by the
<i>SingleEscapeCharacter</i> according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-32">Table 32</a>.</p>
</li>
</ul>
<figure>
<figcaption><span id="table-32">Table 32</span> — String Single Character Escape Sequences</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Escape Sequence</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Code Unit Value</th>
<th style="border-bottom: 1px solid #000000; border-top: 2px solid #000000">Name</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Symbol</th>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\b</code></td>
<td><code>0x0008</code></td>
<td>backspace</td>
<td style="border-right: 1px solid #000000">&lt;BS&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\t</code></td>
<td><code>0x0009</code></td>
<td>horizontal tab</td>
<td style="border-right: 1px solid #000000">&lt;HT&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\n</code></td>
<td><code>0x000A</code></td>
<td>line feed (new line)</td>
<td style="border-right: 1px solid #000000">&lt;LF&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\v</code></td>
<td><code>0x000B</code></td>
<td>vertical tab</td>
<td style="border-right: 1px solid #000000">&lt;VT&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\f</code></td>
<td><code>0x000C</code></td>
<td>form feed</td>
<td style="border-right: 1px solid #000000">&lt;FF&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\r</code></td>
<td><code>0x000D</code></td>
<td>carriage return</td>
<td style="border-right: 1px solid #000000">&lt;CR&gt;</td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\"</code></td>
<td><code>0x0022</code></td>
<td>double quote</td>
<td style="border-right: 1px solid #000000"><code>"</code></td>
</tr>
<tr>
<td style="border-left: 1px solid #000000"><code>\'</code></td>
<td><code>0x0027</code></td>
<td>single quote</td>
<td style="border-right: 1px solid #000000"><code>'</code></td>
</tr>
<tr>
<td style="border-bottom: 2px solid #000000; border-left: 1px solid #000000"><code>\\</code></td>
<td style="border-bottom: 2px solid #000000"><code>0x005C</code></td>
<td style="border-bottom: 2px solid #000000">backslash</td>
<td style="border-bottom: 2px solid #000000; border-right: 1px solid #000000"><code>\</code></td>
</tr>
</tbody></table>
</figure>
<ul>
<li>
<p>The CV of <span class="prod"><span class="nt">CharacterEscapeSequence</span> <span class="geq">::</span> <span class="nt">NonEscapeCharacter</span></span> is the CV of the <i>NonEscapeCharacter</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">NonEscapeCharacter</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <span class="nt">EscapeCharacter</span>
<span class="grhsmod">or</span> <span class="nt">LineTerminator</span></span> is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the code point value of <i>SourceCharacter</i> .</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">HexEscapeSequence</span> <span class="geq">::</span> <code class="t">x</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></span> is the code unit value
that is (16 times the MV of the first <i>HexDigit</i>) plus the MV of the second <i>HexDigit</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u</code> <span class="nt">Hex4Digits</span></span> is the CV of <span class="nt">Hex4Digits</span></p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">Hex4Digits</span> <span class="geq">::</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></span> is the code unit value that is (4096 times the MV of the first <i>HexDigit</i>) plus
(256 times the MV of the second <i>HexDigit</i>) plus (16 times the MV of the third <i>HexDigit</i>) plus the MV of
the fourth <i>HexDigit</i>.</p>
</li>
<li>
<p>The CV of <span class="prod"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u{</code> <span class="nt">HexDigits</span> <code class="t">}</code></span> is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the MV of <i>HexDigits</i>.</p>
</li>
</ul>
</section>
</section>
<section id="sec-literals-regular-expression-literals">
<div class="front">
<h1><span class="secnum" id="sec-11.8.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-regular-expression-literals" title="link to this section">11.8.5</a></span> Regular Expression Literals</h1>
<div class="note">
<p><span class="nh">NOTE</span> A regular expression literal is an input element that is converted to a RegExp object
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-iterator-objects">see 21.1.5</a>) each time the literal is evaluated. Two regular expression
literals in a program evaluate to regular expression objects that never compare as <code>===</code> to each other even
if the two literals' contents are identical. A RegExp object may also be created at runtime by <code>new RegExp</code>
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-regexp-argumentslist">see 21.2.3.2</a>) or calling the <code>RegExp</code> constructor as a function
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-pattern-flags">21.2.3.1</a>).</p>
</div>
<p>The productions below describe the syntax for a regular expression literal and are used by the input element scanner to
find the end of the regular expression literal. The source code comprising the <span class="nt">RegularExpressionBody</span> and the <span class="nt">RegularExpressionFlags</span> are subsequently parsed
using the more stringent ECMAScript Regular Expression grammar (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a>).</p>
<p>An implementation may extend the ECMAScript Regular Expression grammar defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a>,
but it must not extend the <span class="nt">RegularExpressionBody</span> and <span class="nt">RegularExpressionFlags</span> productions defined below or the productions used by these productions.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">/</code> <span class="nt">RegularExpressionBody</span> <code class="t">/</code> <span class="nt">RegularExpressionFlags</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionBody</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">RegularExpressionFirstChar</span> <span class="nt">RegularExpressionChars</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionChars</span> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">RegularExpressionChars</span> <span class="nt">RegularExpressionChar</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionFirstChar</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="grhsmod">but not one of</span> <code class="t">*</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">/</code> <span class="grhsmod">or</span> <code class="t">[</code></div>
<div class="rhs"><span class="nt">RegularExpressionBackslashSequence</span></div>
<div class="rhs"><span class="nt">RegularExpressionClass</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionChar</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">/</code> <span class="grhsmod">or</span> <code class="t">[</code></div>
<div class="rhs"><span class="nt">RegularExpressionBackslashSequence</span></div>
<div class="rhs"><span class="nt">RegularExpressionClass</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionBackslashSequence</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">RegularExpressionNonTerminator</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionClass</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">[</code> <span class="nt">RegularExpressionClassChars</span> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionClassChars</span> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">RegularExpressionClassChars</span> <span class="nt">RegularExpressionClassChar</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionClassChar</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="grhsmod">but not one of</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">\</code></div>
<div class="rhs"><span class="nt">RegularExpressionBackslashSequence</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegularExpressionFlags</span> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">RegularExpressionFlags</span> <span class="nt">IdentifierPart</span></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> Regular expression literals may not be empty; instead of representing an empty regular
expression literal, the characters <code>//</code> start a single-line comment. To specify an empty regular expression,
use: <code>/(?:)/</code>.</p>
</div>
</div>
<section id="sec-literals-regular-expression-literals-static-semantics-early-errors">
<h1><span class="secnum" id="sec-11.8.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-regular-expression-literals-static-semantics-early-errors" title="link to this section">11.8.5.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">RegularExpressionFlags</span> <span class="geq">::</span> <span class="nt">RegularExpressionFlags</span> <span class="nt">IdentifierPart</span></div>
<ul>
<li>It is a Syntax Error if <span class="nt">IdentifierPart</span> contains a Unicode escape sequence<var>.</var></li>
</ul>
</section>
<section id="sec-static-semantics-bodytext">
<h1><span class="secnum" id="sec-11.8.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-bodytext" title="link to this section">11.8.5.2</a></span> Static Semantics: <i>BodyText</i></h1>
<div class="gp prod"><span class="nt">RegularExpressionLiteral</span> <span class="geq">::</span> <code class="t">/</code> <span class="nt">RegularExpressionBody</span> <code class="t">/</code> <span class="nt">RegularExpressionFlags</span></div>
<ol class="proc">
<li>Return the source code that was recognised as <i>RegularExpressionBody</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-flagtext">
<h1><span class="secnum" id="sec-11.8.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-flagtext" title="link to this section">11.8.5.3</a></span> Static Semantics: <i>FlagText</i></h1>
<div class="gp prod"><span class="nt">RegularExpressionLiteral</span> <span class="geq">::</span> <code class="t">/</code> <span class="nt">RegularExpressionBody</span> <code class="t">/</code> <span class="nt">RegularExpressionFlags</span></div>
<ol class="proc">
<li>Return the source code that was recognised as <i>RegularExpressionFlags</i>.</li>
</ol>
</section>
</section>
<section id="sec-template-literal-lexical-components">
<div class="front">
<h1><span class="secnum" id="sec-11.8.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components" title="link to this section">11.8.6</a></span> Template Literal Lexical Components</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Template</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">NoSubstitutionTemplate</span></div>
<div class="rhs"><span class="nt">TemplateHead</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NoSubstitutionTemplate</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">`</code> <span class="nt">TemplateCharacters</span><sub>opt</sub> <code class="t">`</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateHead</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">`</code> <span class="nt">TemplateCharacters</span><sub>opt</sub> <code class="t">${</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateSubstitutionTail</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">TemplateMiddle</span></div>
<div class="rhs"><span class="nt">TemplateTail</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateMiddle</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">}</code> <span class="nt">TemplateCharacters</span><sub>opt</sub> <code class="t">${</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateTail</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">}</code> <span class="nt">TemplateCharacters</span><sub>opt</sub> <code class="t">`</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateCharacters</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">TemplateCharacter</span> <span class="nt">TemplateCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">`</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">$</code> <span class="grhsmod">or</span> <span class="nt">LineTerminatorSequence</span></div>
<div class="rhs"><code class="t">$</code> <span class="grhsannot">[lookahead ∉ { ]</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">EscapeSequence</span></div>
<div class="rhs"><span class="nt">LineContinuation</span></div>
<div class="rhs"><span class="nt">LineTerminatorSequence</span></div>
</div>
</div>
<section id="sec-static-semantics-tv-s-and-trv-s">
<h1><span class="secnum" id="sec-11.8.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-tv-s-and-trv-s" title="link to this section">11.8.6.1</a></span> Static Semantics: <i>TV’s and TRV’s</i></h1>
<p>A template literal component is interpreted as a sequence of Unicode code points. The Template Value (TV) of a literal
component is described in terms of code unit values (CV, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals">11.8.4</a>) contributed
by the various parts of the template literal component. As part of this process, some Unicode code points within the
template component are interpreted as having a mathematical value (MV, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a>). In determining a TV, escape sequences are replaced by the UTF-16 code
unit(s) of the Unicode code point represented by the escape sequence. The Template Raw Value (TRV) is similar to a
Template Value with the difference that in TRVs escape sequences are interpreted literally.</p>
<ul>
<li>
<p>The TV and TRV of <span class="prod"><span class="nt">NoSubstitutionTemplate</span> <span class="geq">::</span>
<code class="t">``</code></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The TV and TRV of <span class="prod"><span class="nt">TemplateHead</span> <span class="geq">::</span> <code class="t">`${</code></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The TV and TRV of <span class="prod"><span class="nt">TemplateMiddle</span> <span class="geq">::</span> <code class="t">}${</code></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The TV and TRV of <span class="prod"><span class="nt">TemplateTail</span> <span class="geq">::</span> <code class="t">}`</code></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">NoSubstitutionTemplate</span> <span class="geq">::</span> <code class="t">`</code> <span class="nt">TemplateCharacters</span> <code class="t">`</code></span> is the TV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateHead</span> <span class="geq">::</span> <code class="t">`</code> <span class="nt">TemplateCharacters</span> <code class="t">${</code></span> is the TV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateMiddle</span> <span class="geq">::</span> <code class="t">}</code> <span class="nt">TemplateCharacters</span> <code class="t">${</code></span> is the TV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateTail</span> <span class="geq">::</span> <code class="t">}</code> <span class="nt">TemplateCharacters</span> <code class="t">`</code></span> is the TV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacters</span> <span class="geq">::</span> <span class="nt">TemplateCharacter</span></span> is the TV of <i>TemplateCharacter</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacters</span> <span class="geq">::</span> <span class="nt">TemplateCharacter</span> <span class="nt">TemplateCharacters</span></span> is a sequence consisting of the
code units in the TV of <i>TemplateCharacter</i> followed by all the code units in the TV of <i>TemplateCharacters</i>
in order.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">`</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">$</code> <span class="grhsmod">or</span> <span class="nt">LineTerminatorSequence</span></span> is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the code point value of <i>SourceCharacter</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <code class="t">$</code></span> is the code unit value 0x0024.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">EscapeSequence</span></span> is the CV of <i>EscapeSequence</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <span class="nt">LineContinuation</span></span> is the TV of <i>LineContinuation</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <span class="nt">LineTerminatorSequence</span></span> is the TRV of <i>LineTerminatorSequence</i>.</p>
</li>
<li>
<p>The TV of <span class="prod"><span class="nt">LineContinuation</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">LineTerminatorSequence</span></span> is the empty code unit sequence.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">NoSubstitutionTemplate</span> <span class="geq">::</span> <code class="t">`</code> <span class="nt">TemplateCharacters</span> <code class="t">`</code></span> is the TRV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateHead</span> <span class="geq">::</span> <code class="t">`</code> <span class="nt">TemplateCharacters</span> <code class="t">${</code></span> is the TRV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateMiddle</span> <span class="geq">::</span> <code class="t">}</code> <span class="nt">TemplateCharacters</span> <code class="t">${</code></span> is the TRV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateTail</span> <span class="geq">::</span> <code class="t">}</code> <span class="nt">TemplateCharacters</span> <code class="t">`</code></span> is the TRV of
<i>TemplateCharacters</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacters</span> <span class="geq">::</span> <span class="nt">TemplateCharacter</span></span> is the TRV of <i>TemplateCharacter</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacters</span> <span class="geq">::</span> <span class="nt">TemplateCharacter</span> <span class="nt">TemplateCharacters</span></span> is a sequence consisting of the
code units in the TRV of <i>TemplateCharacter</i> followed by all the code units in the TRV of
<i>TemplateCharacters,</i> in order.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">`</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">$</code> <span class="grhsmod">or</span> <span class="nt">LineTerminatorSequence</span></span> is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the code point value of <i>SourceCharacter</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <code class="t">$</code></span> is the code unit value 0x0024.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">EscapeSequence</span></span> is the sequence consisting of the code unit value
0x005C followed by the code units of TRV of <i>EscapeSequence</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <span class="nt">LineContinuation</span></span> is the TRV of <i>LineContinuation</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">TemplateCharacter</span> <span class="geq">::</span> <span class="nt">LineTerminatorSequence</span></span> is the TRV of <i>LineTerminatorSequence</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">CharacterEscapeSequence</span></span> is the TRV of the <i>CharacterEscapeSequence</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <code class="t">0</code></span> is the code unit value 0x0030.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">HexEscapeSequence</span></span> is the TRV of the <i>HexEscapeSequence</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">UnicodeEscapeSequence</span></span> is the TRV of the <i>UnicodeEscapeSequence</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">CharacterEscapeSequence</span> <span class="geq">::</span> <span class="nt">SingleEscapeCharacter</span></span> is the TRV of the <i>SingleEscapeCharacter</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">CharacterEscapeSequence</span> <span class="geq">::</span> <span class="nt">NonEscapeCharacter</span></span> is the CV of the <i>NonEscapeCharacter</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">SingleEscapeCharacter</span> <span class="geq">::</span> <span class="grhsmod">one of</span> <code class="t">'</code> <code class="t">"</code> <code class="t">\</code> <code class="t">b</code> <code class="t">f</code> <code class="t">n</code> <code class="t">r</code> <code class="t">t</code>
<code class="t">v</code></span> is the CV of the <i>SourceCharacter</i> that is that single character.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">HexEscapeSequence</span> <span class="geq">::</span> <code class="t">x</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></span> is the sequence
consisting of code unit value 0x0078 followed by TRV of the first <i>HexDigit</i> followed by the TRV of the second
<i>HexDigit</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span>
<span class="nt">HexDigit</span></span> is the sequence consisting of code unit value 0x0075 followed by TRV of the
first <i>HexDigit</i> followed by the TRV of the second <i>HexDigit</i> followed by TRV of the third <i>HexDigit</i>
followed by the TRV of the fourth <i>HexDigit</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u{</code> <span class="nt">HexDigits</span> <code class="t">}</code></span> is the sequence consisting of
code unit value 0x0075 followed by code unit value 0x007B followed by TRV of <i>HexDigits</i> followed by code unit
value 0x007D.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">HexDigits</span> <span class="geq">::</span> <span class="nt">HexDigit</span></span> is the TRV of <i>HexDigit</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">HexDigits</span> <span class="geq">::</span> <span class="nt">HexDigits</span> <span class="nt">HexDigit</span></span> is the sequence consisting of TRV of
<i>HexDigits</i> followed by TRV of <i>HexDigit</i>.</p>
</li>
<li>
<p>The TRV of a <i>HexDigit</i> is the CV of the <i>SourceCharacter</i> that is that <i>HexDigit</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">LineContinuation</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">LineTerminatorSequence</span></span> is the sequence consisting of the code unit
value 0x005C followed by the code units of TRV of <i>LineTerminatorSequence</i>.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span></span>
&lt;LF&gt; is the code unit value 0x000A.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span></span>
&lt;CR&gt; is the code unit value 0x000A.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span></span>
&lt;LS&gt; is the code unit value 0x2028.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span></span>
&lt;PS&gt; is the code unit value 0x2029.</p>
</li>
<li>
<p>The TRV of <span class="prod"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span></span>
&lt;CR&gt;&lt;LF&gt; is the sequence consisting of the code unit value 0x000A.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> TV excludes the code units of <i>LineContinuation</i> while TRV includes them.
&lt;CR&gt;&lt;LF&gt; and &lt;CR&gt; <i>LineTerminatorSequences</i> are normalized to &lt;LF&gt; for both TV and TRV. An
explicit <i>EscapeSequence</i> is needed to include a &lt;CR&gt; or &lt;CR&gt;&lt;LF&gt; sequence.</p>
</div>
</section>
</section>
</section>
<section id="sec-automatic-semicolon-insertion">
<div class="front">
<h1><span class="secnum" id="sec-11.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion" title="link to this section">11.9</a></span> Automatic Semicolon Insertion</h1>
<p>Certain ECMAScript statements (empty statement, let and const declarations, variable statement, expression statement,
<code>debugger</code> statement, <code>continue</code> statement, <code>break</code> statement, <code>return</code>
statement, and <code>throw</code> statement) must be terminated with semicolons. Such semicolons may always appear
explicitly in the source text. For convenience, however, such semicolons may be omitted from the source text in certain
situations. These situations are described by saying that semicolons are automatically inserted into the source code token
stream in those situations.</p>
</div>
<section id="sec-rules-of-automatic-semicolon-insertion">
<h1><span class="secnum" id="sec-11.9.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-rules-of-automatic-semicolon-insertion" title="link to this section">11.9.1</a></span> Rules of Automatic Semicolon Insertion</h1>
<p>There are three basic rules of semicolon insertion:</p>
<ol class="proc">
<li>When, as the script is parsed from left to right, a token (called the <i>offending token</i>) is encountered that is
not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if
one or more of the following conditions is true:
<ul>
<li>The offending token is separated from the previous token by at least one <i>LineTerminator</i>.</li>
<li>The offending token is <code>}</code>.</li>
</ul>
</li>
<li>When, as the script is parsed from left to right, the end of the input stream of tokens is encountered and the parser
is unable to parse the input token stream as a single complete ECMAScript <var>script</var>, then a semicolon is
automatically inserted at the end of the input stream.</li>
<li>When, as the script is parsed from left to right, a token is encountered that is allowed by some production of the
grammar, but the production is a <i>restricted production</i> and the token would be the first token for a terminal or
nonterminal immediately following the annotation <span style="font-family: Times New Roman">“</span>[no <span style="font-family: Times New Roman"><i>LineTerminator</i></span> here]<span style="font-family: Times New
Roman">”</span> within the restricted production (and therefore such a token is called a restricted token), and
the restricted token is separated from the previous token by at least one <span class="nt">LineTerminator</span>, then
a semicolon is automatically inserted before the restricted token.</li>
</ol>
<p>However, there is an additional overriding condition on the preceding rules: a semicolon is never inserted automatically
if the semicolon would then be parsed as an empty statement or if that semicolon would become one of the two semicolons in
the header of a <code>for</code> statement (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement">see 13.6.3</a>).</p>
<div class="note">
<p><span class="nh">NOTE</span> The following are the only restricted productions in the grammar:</p>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PostfixExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">--</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ContinueStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">continue;</code></div>
<div class="rhs"><code class="t">continue</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">NonResolvedIdentifier</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BreakStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">break</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">break</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">NonResolvedIdentifier</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ReturnStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">return</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">return</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ThrowStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">throw</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">YieldExpression</span><sub>[In]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">yield</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">AssignmentExpression</span><sub>[?In, Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ModuleImport</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">module</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">ImportedBinding</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
</div>
<p>The practical effect of these restricted productions is as follows:</p>
<p>When a <code>++</code> or <code>--</code> token is encountered where the parser would treat it as a postfix operator, and
at least one <span class="nt">LineTerminator</span> occurred between the preceding token and the <code>++</code> or
<code>--</code> token, then a semicolon is automatically inserted before the <code>++</code> or <code>--</code> token.</p>
<p>When a <code>continue</code>, <code>break</code>, <code>return</code>, <code>throw</code>, or <code>yield</code> token is
encountered and a <span class="nt">LineTerminator</span> is encountered before the next token, a semicolon is automatically
inserted after the <code>continue</code>, <code>break</code>, <code>return</code>, <code>throw</code>, or <code>yield</code>
token.</p>
<p>The resulting practical advice to ECMAScript programmers is:</p>
<p>A postfix <code>++</code> or <code>--</code> operator should appear on the same line as its operand.</p>
<p>An <span class="nt">Expression</span> in a <code>return</code> or <code>throw</code> statement or an <span class="nt">AssignmentExpression</span> in a <code>yield</code> expression should start on the same line as the
<code>return</code>, <code>throw</code>, or <code>yield</code> token.</p>
<p>An <span class="nt">IdentifierReference</span> in a <code>break</code> or <code>continue</code> statement should be on
the same line as the <code>break</code> or <code>continue</code> token.</p>
</section>
<section id="sec-examples-of-automatic-semicolon-insertion">
<h1><span class="secnum" id="sec-11.9.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-examples-of-automatic-semicolon-insertion" title="link to this section">11.9.2</a></span> Examples of Automatic Semicolon Insertion</h1>
<p>The source</p>
<pre>{ 1 2 } 3</pre>
<p>is not a valid sentence in the ECMAScript grammar, even with the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic
semicolon insertion</a> rules. In contrast, the source</p>
<pre>{ 1<br>2 } 3</pre>
<p>is also not a valid ECMAScript sentence, but is transformed by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic
semicolon insertion</a> into the following:</p>
<pre>{ 1<br>;2 ;} 3;</pre>
<p>which is a valid ECMAScript sentence.</p>
<p>The source</p>
<pre>for (a; b<br>)</pre>
<p>is not a valid ECMAScript sentence and is not altered by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon
insertion</a> because the semicolon is needed for the header of a <code>for</code> statement. Automatic semicolon insertion
never inserts one of the two semicolons in the header of a <code>for</code> statement.</p>
<p>The source</p>
<pre>return<br>a + b</pre>
<p>is transformed by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a> into the following:</p>
<pre>return;<br>a + b;</pre>
<div class="note">
<p><span class="nh">NOTE</span> The expression <code>a + b</code> is not treated as a value to be returned by the
<code>return</code> statement, because a <i>LineTerminator</i> separates it from the token <code>return</code>.</p>
</div>
<p>The source</p>
<pre>a = b<br>++c</pre>
<p>is transformed by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a> into the following:</p>
<pre>a = b;<br>++c;</pre>
<div class="note">
<p><span class="nh">NOTE</span> The token <code>++</code> is not treated as a postfix operator applying to the variable
<code>b</code>, because a <i>LineTerminator</i> occurs between <code>b</code> and <code>++</code>.</p>
</div>
<p>The source</p>
<pre>if (a &gt; b)<br>else c = d</pre>
<p>is not a valid ECMAScript sentence and is not altered by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon
insertion</a> before the <code>else</code> token, even though no production of the grammar applies at that point, because an
automatically inserted semicolon would then be parsed as an empty statement.</p>
<p>The source</p>
<pre>a = b + c<br>(d + e).print()</pre>
<p>is <i>not</i> transformed by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a>, because the
parenthesised expression that begins the second line can be interpreted as an argument list for a function call:</p>
<pre>a = b + c(d + e).print()</pre>
<p>In the circumstance that an assignment statement must begin with a left parenthesis, it is a good idea for the programmer
to provide an explicit semicolon at the end of the preceding statement rather than to rely on <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon insertion</a>.</p>
</section>
</section>
</section>
<section id="sec-ecmascript-language-expressions">
<div class="front">
<h1><span class="secnum" id="sec-12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-expressions" title="link to this section">12</a></span>
ECMAScript Language: Expressions</h1>
</div>
<section id="sec-identifiers">
<div class="front">
<h1><span class="secnum" id="sec-12.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers" title="link to this section">12.1</a></span>
Identifiers</h1>
<p><b>Syntax</b></p>
<div class="gp">
<div class="lhs"><span class="nt">IdentifierReference</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Identifier</span></div>
<div class="rhs"><span class="grhsannot">[~Yield]</span> <code class="t">yield</code></div>
</div>
<p><i>BindingIdentifier</i><sub><span style="font-family: sans-serif">[</span>Default<span style="font-family:
sans-serif">,</span> Yield<span style="font-family: sans-serif">]</span></sub> <b>:</b></p>
<p>[+Default] <code>default</code><br>[~Yield] <code>yield</code><span style="font-family: Times New
Roman"><i><br>Identifier</i></span></p>
<div class="gp">
<div class="lhs"><span class="nt">LabelIdentifier</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Identifier</span></div>
<div class="rhs"><span class="grhsannot">[~Yield]</span> <code class="t">yield</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Identifier</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierName</span> <span class="grhsmod">but not</span> <span class="nt">ReservedWord</span></div>
</div>
</div>
<section id="sec-identifiers-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors" title="link to this section">12.1.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">IdentifierReference</span> <span class="geq">:</span> <span class="nt">Identifier</span></div>
<ul>
<li>
<p>It is a Syntax Error if StringValue of <var>Identifier does not statically resolve to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> binding.</var></p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> Unlike a <i>BindingIdentifier</i>, an <i>IdentifierReference</i> in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> may be the <i>Identifier</i> <code>eval</code> or <code>arguments</code>.</p>
</div>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <span class="nt">Identifier</span></div>
<ul>
<li>
<p>It is a Syntax Error if this production is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> and the
StringValue of <span class="nt">Identifier</span> is <code>"arguments"</code> or <code>"eval"</code>.</p>
</li>
</ul>
<p><span class="prod"><span class="nt">IdentifierReference</span> <span class="geq">:</span> <span class="nt">Identifier</span></span></p>
<p><span class="prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <span class="nt">Identifier</span></span></p>
<div class="gp prod"><span class="nt">LabelIdentifier</span> <span class="geq">:</span> <span class="nt">Identifier</span></div>
<ul>
<li>
<p>It is a Syntax Error if this production has a <sub>[Yield]</sub> parameter and the StringValue of <span class="nt">Identifier</span> is <code>"yield"</code><span style="font-family: Times New Roman">.</span></p>
</li>
</ul>
<p><span class="prod"><span class="nt">IdentifierReference</span> <span class="geq">:</span> <code class="t">yield</code></span></p>
<p><span class="prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">yield</code></span></p>
<div class="gp prod"><span class="nt">LabelIdentifier</span> <span class="geq">:</span> <code class="t">yield</code></div>
<ul>
<li>
<p>It is a Syntax Error if this production is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
code</a><var>.</var></p>
</li>
<li>
<p>It is a Syntax Error if this production is within the <span class="nt">FunctionBody</span> of a <i><span style="font-family: Times New Roman">GeneratorMethod</span>, <span style="font-family: Times New
Roman">GeneratorDeclaration</span>,</i> or <span class="nt">GeneratorExpression</span>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">Identifier</span> <span class="geq">::</span> <span class="nt">IdentifierName</span> <span class="grhsmod">but not</span> <span class="nt">ReservedWord</span></div>
<ul>
<li>
<p>It is a Syntax Error if <span class="nt">IdentifierName</span> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
code</a> and the StringValue of <span class="nt">IdentifierName</span> is: <code>"implements"</code>,
<code>"interface"</code>, <code>"let"</code>, <code>"package"</code>, <code>"private"</code>, <code>"protected"</code>,
<code>"public"</code>, or <code>"static"</code>.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">IdentifierName</span> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
code</a> and the StringValue of <span class="nt">IdentifierName</span> is <code>"yield"</code>.</p>
</li>
<li>
<p>It is a Syntax Error StringValue of <span class="nt">IdentifierName</span> is the same string value as the
StringValue of any <span class="nt">ReservedWord</span> except for <code>yield</code>.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> <span style="font-family: sans-serif">StringValue of</span> <i>IdentifierName</i>
normalizes any Unicode escape sequences in <i>IdentifierName</i> hence such escapes cannot be used to write an
<i>Identifier</i> whose code point sequence is the same as a <i>ReservedWord</i>.</p>
</div>
</section>
<section id="sec-identifiers-runtime-semantics-bindinginitialization">
<div class="front">
<h1><span class="secnum" id="sec-12.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization" title="link to this section">12.1.2</a></span> Runtime Semantics: BindingInitialization</h1>
<p>With arguments <var>value</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-bindinginitialization">12.2.4.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-bindinginitialization">13.2.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization">13.14.3</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> <b>undefined</b> is passed for <var>environment</var> to indicate that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
<code>var</code> statements formal parameter lists of non-strict functions. In those cases a lexical binding is hosted
and preinitialized prior to evaluation of its initializer.</p>
</div>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <span class="nt">Identifier</span></div>
<ol class="proc">
<li>Let <i>name</i> be StringValue of <i>Identifier</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializeboundname">InitializeBoundName</a>( <i>name</i>, <i>value</i>,
<i>environment</i>).</li>
</ol>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">default</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializeboundname">InitializeBoundName</a>(<code>"default"</code>, <i>value</i>,
<i>environment</i>).</li>
</ol>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">yield</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializeboundname">InitializeBoundName</a>(<code>"yield"</code>, <i>value</i>,
<i>environment</i>).</li>
</ol>
</div>
<section id="sec-initializeboundname">
<h1><span class="secnum" id="sec-12.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializeboundname" title="link to this section">12.1.2.1</a></span> Runtime Semantics: InitializeBoundName(name, value, environment)</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>name</i>) is String.</li>
<li>If <i>environment</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>env</i> be the environment record component of <i>environment</i>.</li>
<li>Call the InitializeBinding concrete method of <i>env</i> passing <i>name</i> and <i>value</i> as the
arguments.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>lhs</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvebinding">ResolveBinding</a>(<i>name</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lhs</i>, <i>value</i>).</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-identifiers-static-semantics-boundnames">
<h1><span class="secnum" id="sec-12.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-boundnames" title="link to this section">12.1.3</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <span class="nt">Identifier</span></div>
<ol class="proc">
<li>Return new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the StringValue of
<i>IdentifierName</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">yield</code></div>
<ol class="proc">
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <code>"yield"</code>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">default</code></div>
<ol class="proc">
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <code>"default"</code>.</li>
</ol>
</section>
<section id="sec-identifiers-static-semantics-stringvalue">
<h1><span class="secnum" id="sec-12.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-stringvalue" title="link to this section">12.1.4</a></span> Static Semantics<span style="font-family: sans-serif">:</span>
<i>StringValue</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-names-static-semantics-stringvalue">11.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-literals-static-semantics-stringvalue">11.8.4.2</a>.</p>
<p><span class="prod"><span class="nt">IdentifierReference</span> <span class="geq">:</span> <code class="t">yield</code></span></p>
<p><span class="prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">yield</code></span></p>
<div class="gp prod"><span class="nt">LabelIdentifier</span> <span class="geq">:</span> <code class="t">yield</code></div>
<ol class="proc">
<li>Return <code>"yield"</code>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingIdentifier</span> <span class="geq">:</span> <code class="t">default</code></div>
<ol class="proc">
<li>Return <code>"default"</code>.</li>
</ol>
<div class="gp prod"><span class="nt">Identifier</span> <span class="geq">:</span> <span class="nt">IdentifierName</span> <span class="grhsmod">but not</span> <span class="nt">ReservedWord</span></div>
<ol class="proc">
<li>Return the StringValue of <i>IdentifierName</i>.</li>
</ol>
</section>
</section>
<section id="sec-primary-expression">
<div class="front">
<h1><span class="secnum" id="sec-12.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression" title="link to this section">12.2</a></span>
Primary Expression</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">PrimaryExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">this</code></div>
<div class="rhs"><span class="nt">IdentifierReference</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">Literal</span></div>
<div class="rhs"><span class="nt">ArrayInitializer</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ObjectLiteral</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">FunctionExpression</span></div>
<div class="rhs"><span class="nt">ClassExpression</span></div>
<div class="rhs"><span class="nt">GeneratorExpression</span></div>
<div class="rhs"><span class="nt">GeneratorComprehension</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
<div class="rhs"><span class="nt">TemplateLiteral</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">...</code> <span class="nt">BindingIdentifier</span><sub>[?Yield]</sub> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">,</code> <code class="t">...</code> <span class="nt">BindingIdentifier</span><sub>[?Yield]</sub> <code class="t">)</code></div>
</div>
<h2>Supplemental Syntax</h2>
<p>When processing the production</p>
<p><span class="nt">PrimaryExpression</span><sub>[Yield]</sub> <b>:</b> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span><sub>[?Yield]</sub><span style="font-family: Times New
Roman"><i><br></i></span>the interpretation of <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span> is
refined using the following grammar:</p>
<p><span class="nt">ParenthesizedExpression</span><sub>[Yield]</sub> <b>:</b> <code>(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code>)</code></p>
</div>
<section id="sec-primary-expression-semantics">
<div class="front">
<h1><span class="secnum" id="sec-12.2.0"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-semantics" title="link to this section">12.2.0</a></span> Semantics</h1>
</div>
<section id="sec-static-semantics-coveredparenthesizedexpression">
<h1><span class="secnum" id="sec-12.2.0.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-coveredparenthesizedexpression" title="link to this section">12.2.0.1</a></span> Static Semantics: CoveredParenthesizedExpression</h1>
<div class="gp prod"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span><sub>[Yield]</sub> <span class="geq">:</span> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code></div>
<ol class="proc">
<li>Return the result of parsing the lexical token stream matched by
<i>CoverParenthesizedExpressionAndArrowParameterList</i><sub>[Yield]</sub> using
<i>ParenthesizedExpression</i><sub>[Yield]</sub> as the goal symbol.</li>
</ol>
</section>
<section id="sec-semantics-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.2.0.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition" title="link to this section">12.2.0.2</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">PrimaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">this</code></div>
<div class="rhs"><span class="nt">IdentifierReference</span></div>
<div class="rhs"><span class="nt">Literal</span></div>
<div class="rhs"><span class="nt">ArrayInitializer</span></div>
<div class="rhs"><span class="nt">ObjectLiteral</span></div>
<div class="rhs"><span class="nt">GeneratorComprehension</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
<div class="rhs"><span class="nt">TemplateLiteral</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>expr</i> be CoveredParenthesizedExpression of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return IsFunctionDefinition of <i>expr</i>.</li>
</ol>
</section>
<section id="sec-semantics-static-semantics-isidentifierref">
<h1><span class="secnum" id="sec-12.2.0.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref" title="link to this section">12.2.0.3</a></span> Static Semantics: IsIdentifierRef</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">PrimaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierReference</span></div>
</div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">PrimaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">this</code></div>
<div class="rhs"><span class="nt">Literal</span></div>
<div class="rhs"><span class="nt">ArrayInitializer</span></div>
<div class="rhs"><span class="nt">ObjectLiteral</span></div>
<div class="rhs"><span class="nt">FunctionExpression</span></div>
<div class="rhs"><span class="nt">ClassExpression</span></div>
<div class="rhs"><span class="nt">GeneratorExpression</span></div>
<div class="rhs"><span class="nt">GeneratorComprehension</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
<div class="rhs"><span class="nt">TemplateLiteral</span></div>
<div class="rhs"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-semantics-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.2.0.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.2.0.4</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">PrimaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">this</code></div>
<div class="rhs"><span class="nt">Literal</span></div>
<div class="rhs"><span class="nt">ArrayInitializer</span></div>
<div class="rhs"><span class="nt">ObjectLiteral</span></div>
<div class="rhs"><span class="nt">FunctionExpression</span></div>
<div class="rhs"><span class="nt">ClassExpression</span></div>
<div class="rhs"><span class="nt">GeneratorExpression</span></div>
<div class="rhs"><span class="nt">GeneratorComprehension</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
<div class="rhs"><span class="nt">TemplateLiteral</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>If this <i>PrimaryExpression</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> and StringValue of
<i>IdentifierReference</i> is <code>"eval"</code> or <code>"arguments"</code>, then return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>expr</i> be CoveredParenthesizedExpression of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return IsValidSimpleAssignmentTarget of <i>expr</i>.</li>
</ol>
</section>
</section>
<section id="sec-this-keyword">
<div class="front">
<h1><span class="secnum" id="sec-12.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-this-keyword" title="link to this section">12.2.1</a></span> The
<span style="font-family: monospace">this</span> Keyword</h1>
</div>
<section id="sec-this-keyword-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-this-keyword-runtime-semantics-evaluation" title="link to this section">12.2.1.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <code class="t">this</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvethisbinding">ResolveThisBinding</a>( ) .</li>
</ol>
</section>
</section>
<section id="sec-identifier-reference">
<div class="front">
<h1><span class="secnum" id="sec-12.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-reference" title="link to this section">12.2.2</a></span> Identifier Reference</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers">12.1</a> for <span class="prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></span> .</p>
</div>
<section id="sec-identifier-reference-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifier-reference-runtime-semantics-evaluation" title="link to this section">12.2.2.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<div class="note">
<p><span class="nh">NOTE 1:</span> The result of evaluating an <i>IdentifierReference</i> is always a value of type <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2:</span> In non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, the keyword
<code>yield</code> may be used as an identifier. Evaluating the <i>IdentifierReference</i> production resolves the
binding of <code>yield</code> as if it was an <i>Identifier</i>. Early Error restriction ensures that such an evaluation
only can occur for non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations">13.2.1</a> for the handling of <code>yield</code> in binding creation
contexts.</p>
</div>
</section>
</section>
<section id="sec-primary-expression-literals">
<div class="front">
<h1><span class="secnum" id="sec-12.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-literals" title="link to this section">12.2.3</a></span> Literals</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Literal</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">NullLiteral</span></div>
<div class="rhs"><span class="nt">ValueLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ValueLiteral</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BooleanLiteral</span></div>
<div class="rhs"><span class="nt">NumericLiteral</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
</div>
</div>
<section id="sec-literals-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-runtime-semantics-evaluation" title="link to this section">12.2.3.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">Literal</span> <span class="geq">:</span> <span class="nt">NullLiteral</span></div>
<ol class="proc">
<li>Return <b>null</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ValueLiteral</span> <span class="geq">:</span> <span class="nt">BooleanLiteral</span></div>
<ol class="proc">
<li>Return <b>false</b> if <i>BooleanLiteral</i> is the token <code>false</code>.</li>
<li>Return <b>true</b> if <i>BooleanLiteral</i> is the token <code>true</code>.</li>
</ol>
<div class="gp prod"><span class="nt">ValueLiteral</span> <span class="geq">:</span> <span class="nt">NumericLiteral</span></div>
<ol class="proc">
<li>Return the number whose value is MV of <i>NumericLiteral</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ValueLiteral</span> <span class="geq">:</span> <span class="nt">StringLiteral</span></div>
<ol class="proc">
<li>Return the StringValue of <i>StringLiteral</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-literals-static-semantics-stringvalue">11.8.4.2</a>.</li>
</ol>
</section>
</section>
<section id="sec-array-initializer">
<div class="front">
<h1><span class="secnum" id="sec-12.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-initializer" title="link to this section">12.2.4</a></span>
Array Initializer</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ArrayInitializer</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ArrayLiteral</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ArrayComprehension</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-array-literal">
<div class="front">
<h1><span class="secnum" id="sec-12.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-literal" title="link to this section">12.2.4.1</a></span>
Array Literal</h1>
<div class="note">
<p><span class="nh">NOTE</span> An <i>ArrayLiteral</i> is an expression describing the initialization of an Array
object, using a list, of zero or more expressions each of which represents an array element, enclosed in square
brackets. The elements need not be literals; they are evaluated each time the array initializer is evaluated.</p>
</div>
<p>Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element
list is not preceded by an <span class="nt">AssignmentExpression</span> (i.e., a comma at the beginning or after another
comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements.
Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute
to the length of the Array.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ArrayLiteral</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">ElementList</span><sub>[?Yield]</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">ElementList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ElementList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">Elision</span><sub>opt</sub> <span class="nt">SpreadElement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ElementList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">ElementList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">SpreadElement</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Elision</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">,</code></div>
<div class="rhs"><span class="nt">Elision</span> <code class="t">,</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SpreadElement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">...</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-static-semantics-elision-width">
<h1><span class="secnum" id="sec-12.2.4.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-elision-width" title="link to this section">12.2.4.1.1</a></span> Static Semantics: Elision Width</h1>
<div class="gp prod"><span class="nt">Elision</span> <span class="geq">:</span> <code class="t">,</code></div>
<ol class="proc">
<li>Return the numeric value 1.</li>
</ol>
<div class="gp prod"><span class="nt">Elision</span> <span class="geq">:</span> <span class="nt">Elision</span> <code class="t">,</code></div>
<ol class="proc">
<li>Let <i>preceding</i> be the Elision Width of <i>Elision</i>.</li>
<li>Return <i>preceding</i>+1.</li>
</ol>
</section>
<section id="sec-runtime-semantics-arrayaccumulation">
<h1><span class="secnum" id="sec-12.2.4.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-arrayaccumulation" title="link to this section">12.2.4.1.2</a></span> Runtime Semantics: ArrayAccumulation</h1>
<p>With parameters <var>array</var> and <var>nextIndex</var>.</p>
<div class="gp prod"><span class="nt">ElementList</span> <span class="geq">:</span> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>padding</i> be the Elision Width of <i>Elision</i>; if <i>Elision</i> is not present, use the numeric value
zero.</li>
<li>Let <i>initResult</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>initValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>initResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>initValue</i>).</li>
<li>Let <i>created</i> be the result of calling the [[DefineOwnProperty]] internal method of <i>array</i> with
arguments <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>nextIndex+padding</i>)) and
the PropertyDescriptor{ [[Value]]: <i>initValue</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>,
[[Configurable]]: <b>true</b>}.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>created</i> is <b>true</b><i>.</i></li>
<li>Return <i>nextIndex+padding+</i>1.</li>
</ol>
<div class="gp prod"><span class="nt">ElementList</span> <span class="geq">:</span> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">SpreadElement</span></div>
<ol class="proc">
<li>Let <i>padding</i> be the Elision Width of <i>Elision</i>; if <i>Elision</i> is not present, use the numeric value
zero.</li>
<li>Return the result of performing ArrayAccumulation for <i>SpreadElement</i> with arguments <i>array</i> and
<i>nextIndex</i>+<i>padding</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ElementList</span> <span class="geq">:</span> <span class="nt">ElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>postIndex</i> be the result of performing ArrayAccumulation for <i>ElementList</i> with arguments
<i>array</i> and <i>nextIndex</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>postIndex</i>).</li>
<li>Let <i>padding</i> be the Elision Width of <i>Elision</i>; if <i>Elision</i> is not present, use the numeric value
zero.</li>
<li>Let <i>initResult</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>initValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>initResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>initValue</i>).</li>
<li>Let <i>created</i> be the result of calling the [[DefineOwnProperty]] internal method of <i>array</i> with
arguments <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>postIndex</i>+<i>padding</i>)) and the PropertyDescriptor{ [[Value]]:
<i>initValue</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>created</i> is <b>true</b>.</li>
<li>Return <i>postIndex</i>+<i>padding+</i>1.</li>
</ol>
<div class="gp prod"><span class="nt">ElementList</span> <span class="geq">:</span> <span class="nt">ElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">SpreadElement</span></div>
<ol class="proc">
<li>Let <i>postIndex</i> be the result of performing ArrayAccumulation for <i>ElementList</i> with arguments
<i>array</i> and <i>nextIndex</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>postIndex</i>).</li>
<li>Let <i>padding</i> be the Elision Width of <i>Elision</i>; if <i>Elision</i> is not present, use the numeric value
zero.</li>
<li>Return the result of performing ArrayAccumulation for <i>SpreadElement</i> with arguments <i>array</i> and
<i>postIndex</i>+<i>padding</i>.</li>
</ol>
<div class="gp prod"><span class="nt">SpreadElement</span> <span class="geq">:</span> <code class="t">...</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>spreadRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>spreadObj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>spreadRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>spreadObj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>spreadObj</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>spreadObj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <i>nextIndex</i>.</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>nextIndex</i>)),
<i>nextValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Let nextIndex = nextIndex +1.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[DefineOwnProperty]] is used to ensure that own properties are defined for the array
even if the standard built-in Array prototype object has been modified in a manner that would preclude the creation of
new own properties using [[Set]].</p>
</div>
</section>
<section id="sec-array-literal-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.4.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-literal-runtime-semantics-evaluation" title="link to this section">12.2.4.1.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ArrayLiteral</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>pad</i> be the Elision Width of <i>Elision</i>; if <i>Elision</i> is not present, use the numeric value
zero.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>array</i>, <code>"length"</code>, <i>pad</i>,
<b>false</b>).</li>
<li>Return <i>array</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayLiteral</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">ElementList</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>len</i> be the result of performing ArrayAccumulation for <i>ElementList</i> with arguments <i>array</i>
and 0.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>array</i>, <code>"length"</code>, <i>len</i>,
<b>false</b>).</li>
<li>Return <i>array</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayLiteral</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">ElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>len</i> be the result of performing ArrayAccumulation for <i>ElementList</i> with arguments <i>array</i>
and 0.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>padding</i> be the Elision Width of <i>Elision</i>; if <i>Elision</i> is not present, use the numeric value
zero.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>array</i>, <code>"length"</code>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>padding</i>+<i>len</i>), <b>false</b>).</li>
<li>Return <i>array</i>.</li>
</ol>
</section>
</section>
<section id="sec-array-comprehension">
<div class="front">
<h1><span class="secnum" id="sec-12.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension" title="link to this section">12.2.4.2</a></span> Array Comprehension</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ArrayComprehension</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">[</code> <span class="nt">Comprehension</span><sub>[?Yield]</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Comprehension</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ComprehensionFor</span><sub>[?Yield]</sub> <span class="nt">ComprehensionTail</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ComprehensionTail</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">ComprehensionFor</span><sub>[?Yield]</sub> <span class="nt">ComprehensionTail</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ComprehensionIf</span><sub>[?Yield]</sub> <span class="nt">ComprehensionTail</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ComprehensionFor</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForBinding</span><sub>[?Yield]</sub> <code class="t">of</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ComprehensionIf</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">if</code> <code class="t">(</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ForBinding</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">BindingPattern</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-array-comprehension-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.2.4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-static-semantics-early-errors" title="link to this section">12.2.4.2.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">ComprehensionFor</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">ForBinding</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code></div>
<ul>
<li>It is a Syntax Error if the BoundNames of <span class="nt">ForBinding</span> contains <code>"let"</code>.</li>
<li>It is a Syntax Error if the BoundNames of <span class="nt">ForBinding</span> contains any duplicate entries.</li>
</ul>
</section>
<section id="sec-array-comprehension-runtime-semantics-bindinginitialization">
<h1><span class="secnum" id="sec-12.2.4.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-bindinginitialization" title="link to this section">12.2.4.2.2</a></span> Runtime Semantics: BindingInitialization</h1>
<p>With arguments <var>value</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-bindinginitialization">13.2.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization">13.14.3</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> <b>undefined</b> is passed for <i>environment</i> to indicate that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
<code>var</code> statements formal parameter lists of non-strict functions. In those cases a lexical binding is hosted
and preinitialized prior to evaluation of its initializer.</p>
</div>
<div class="gp prod"><span class="nt">ForBinding</span> <span class="geq">:</span> <span class="nt">BindingPattern</span></div>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return the result of performing BindingInitialization for <i>BindingPattern</i> passing <i>value</i> and
<i>environment</i> as the arguments.</li>
</ol>
</section>
<section id="sec-runtime-semantics-comprehensionevaluation">
<h1><span class="secnum" id="sec-12.2.4.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-comprehensionevaluation" title="link to this section">12.2.4.2.3</a></span> Runtime Semantics: ComprehensionEvaluation</h1>
<p>With argument <var>accumulator</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> <b>undefined</b> is passed for <i>accumulator</i> to indicate that a comprehension
component is being evaluated as part of a generator comprehension. Otherwise, the value of <i>accumulator</i> is the
array object into which the elements of an array comprehension are to be accumulated.</p>
</div>
<div class="gp prod"><span class="nt">Comprehension</span> <span class="geq">:</span> <span class="nt">ComprehensionFor</span> <span class="nt">ComprehensionTail</span></div>
<ol class="proc">
<li>Return the result of performing ComprehensionComponentEvaluation for <i>ComprehensionFor</i> with arguments
<i>ComprehensionTail</i> and <i>accumulator</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ComprehensionTail</span> <span class="geq">:</span> <span class="nt">ComprehensionFor</span> <span class="nt">ComprehensionTail</span></span></p>
<ol class="proc">
<li>Return the result of performing ComprehensionComponentEvaluation for <i>ComprehensionFor</i> with arguments
<i>ComprehensionTail</i> and <i>accumulator</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ComprehensionTail</span> <span class="geq">:</span> <span class="nt">ComprehensionIf</span> <span class="nt">ComprehensionTail</span></span></p>
<ol class="proc">
<li>Return the result of performing ComprehensionComponentEvaluation for <i>ComprehensionIf</i> with arguments
<i>ComprehensionTail</i> and <i>accumulator</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ComprehensionTail</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></span></p>
<ol class="proc">
<li>Let <i>valueRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>valueRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <i>accumulator</i> is not <b>undefined</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: this is part of an array comprehension.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>accumulator</i> is an exotic array object so access to its
<code>length</code> property should never fail.</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>accumulator</i>, <code>"length"</code>).</li>
<li>If <i>len</i>≥2<sup>32</sup>-1, then throw a <b>RangeError</b> exception.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>accumulator</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>len</i>), <i>value</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>len</i> by 1.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>accumulator</i>, <code>"length"</code>,
<i>len</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>accumulator</i> is <b>undefined</b>, so this is part of a
generator comprehension.</li>
<li>Let <i>yieldStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatoryield">GeneratorYield</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>value</i>, <b>false</b>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>yieldStatus</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</section>
<section id="sec-runtime-semantics-comprehensioncomponentevaluation">
<h1><span class="secnum" id="sec-12.2.4.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-comprehensioncomponentevaluation" title="link to this section">12.2.4.2.4</a></span> Runtime Semantics: ComprehensionComponentEvaluation</h1>
<p>With arguments <var>tail</var> and <var>accumulator</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> <b>undefined</b> is passed for <i>accumulator</i> to indicate that a comprehension
component is being evaluated as part of a generator comprehension. Otherwise, the value of <i>accumulator</i> is the
array object into which the elements of an array comprehension are to be accumulated.</p>
</div>
<div class="gp prod"><span class="nt">ComprehensionFor</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">ForBinding</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>exprValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>keys</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).</li>
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Repeat
<ol class="block">
<li>Let <i>nextResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>keys</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextResult</i>).</li>
<li>If <i>nextResult</i> is <b>false</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>nextResult</i>);</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Let <i>forEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>oldEnv</i>).</li>
<li>For each element <i>name</i> of the BoundNames of <i>ForBinding</i> do
<ol class="block">
<li>Call <i>forEnv</i>’s CreateMutableBinding concrete method with argument <i>name</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call to CreateMutableBinding will never return
an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
<li>Let <i>status</i> be the result of performing BindingInitialization for <i>ForBinding</i> passing
<i>nextValue</i> and <i>forEnv</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>forEnv</i>.</li>
<li>Let <i>continue</i> be the result of performing ComprehensionEvaluation for <i>tail</i> with argument
<i>accumulator</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>continue</i>).</li>
</ol>
</li>
</ol>
<div class="gp prod"><span class="nt">ComprehensionIf</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code></div>
<ol class="proc">
<li>Let <i>valueRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>valueRef</i>).</li>
<li>Let <i>boolValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>boolValue</i>).</li>
<li>If <i>boolValue</i> is <b>true</b>, then
<ol class="block">
<li>Return the result of performing ComprehensionEvaluation for <i>tail</i> with argument <i>accumulator</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-array-comprehension-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.4.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-evaluation" title="link to this section">12.2.4.2.5</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ArrayComprehension</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Comprehension</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>status</i> be the result of performing ComprehensionEvaluation for <i>Comprehension</i> with argument
<i>array</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>array</i>.</li>
</ol>
<div class="gp prod"><span class="nt">Comprehension</span> <span class="geq">:</span> <span class="nt">ComprehensionFor</span> <span class="nt">ComprehensionTail</span></div>
<ol class="proc">
<li>Return the result of performing ComprehensionEvaluation for this <i>Comprehension</i> with argument
<b>undefined</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This action is only invoked for a <i>Comprehension</i> that is part of a
<i>GeneratorComprehension</i>.</p>
</div>
</section>
</section>
</section>
<section id="sec-object-initializer">
<div class="front">
<h1><span class="secnum" id="sec-12.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer" title="link to this section">12.2.5</a></span>
Object Initializer</h1>
<div class="note">
<p><span class="nh">NOTE 1</span> An object initializer is an expression describing the initialization of an Object,
written in a form resembling a literal. It is a list of zero or more pairs of property names and associated values,
enclosed in curly braces. The values need not be literals; they are evaluated each time the object initializer is
evaluated.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ObjectLiteral</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">PropertyDefinitionList</span><sub>[?Yield]</sub> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">PropertyDefinitionList</span><sub>[?Yield]</sub> <code class="t">,</code> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PropertyDefinitionList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">PropertyDefinition</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">PropertyDefinitionList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">PropertyDefinition</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PropertyDefinition</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierReference</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">CoverInitializedName</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">PropertyName</span><sub>[?Yield]</sub> <code class="t">:</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">MethodDefinition</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PropertyName</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LiteralPropertyName</span></div>
<div class="rhs"><span class="grhsannot">[+GeneratorParameter]</span> <span class="nt">ComputedPropertyName</span></div>
<div class="rhs"><span class="grhsannot">[~GeneratorParameter]</span> <span class="nt">ComputedPropertyName</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
<div class="rhs"><span class="nt">NumericLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ComputedPropertyName</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">[</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CoverInitializedName</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierReference</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Initializer</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">=</code> <span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> <i>MethodDefinition</i> is defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions">14.3</a>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> In certain contexts, <i>ObjectLiteral</i> is used as a cover grammar for a more
restricted secondary grammar. The <i>CoverInitializedName</i> production is necessary to fully cover these secondary
grammars. However, use of this production results in an early Syntax Error in normal contexts where an actual
<i>ObjectLiteral</i> is expected.</p>
</div>
</div>
<section id="sec-object-initializer-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-early-errors" title="link to this section">12.2.5.1</a></span> Static Semantics: Early Errors</h1>
<p>In addition to describing an actual object initializer the <span class="nt">ObjectLiteral</span> productions are also
used as a cover grammar for <span class="nt">ObjectAssignmentPattern</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-assignment">12.14.5</a>). and may be recognized as part of a <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span>. When <span class="nt">ObjectLiteral</span> appears in
a context where <span class="nt">ObjectAssignmentPattern</span> is required the following Early Error rules are <b>not</b>
applied. In addition, they are not applied when initially parsing a
<var>CoverParenthesizedExpressionAndArrowParameterList.</var></p>
<div class="gp prod"><span class="nt">ObjectLiteral</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">PropertyDefinitionList</span> <code class="t">}</code></div>
<p>and</p>
<div class="gp prod"><span class="nt">ObjectLiteral</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <code class="t">}</code></div>
<ul>
<li>
<p>It is a Syntax Error if <span style="font-family: Times New Roman">PropertyNameList</span> of <span class="nt">PropertyDefinitionList</span> contains any duplicate entries, unless one of the following conditions are
true for each duplicate entry: </p>
<ol class="proc">
<li>The source code corresponding to <span class="nt">PropertyDefinitionList</span> is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> and all occurrences in the list of the duplicated entry were
obtained from productions of the form <span class="prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></span> .</li>
<li>The duplicated entry occurs exactly twice in the list and one occurrence was obtained from a <code>get</code>
accessor <span class="nt">MethodDefinition</span> and the other occurrence was obtained from a <code>set</code>
accessor <span class="nt">MethodDefinition</span>.</li>
</ol>
</li>
</ul>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">CoverInitializedName</span></div>
<ul>
<li>Always throw a Syntax Error if <span style="font-family: Times New Roman">this production is present</span></li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> This production exists so that <i>ObjectLiteral</i> can serve as a cover grammar for
<i>ObjectAssignmentPattern</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-assignment">12.14.5</a>). It cannot occur in an actual
object initializer.</p>
</div>
</section>
<section id="sec-object-initializer-static-semantics-computedpropertycontains">
<h1><span class="secnum" id="sec-12.2.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains" title="link to this section">12.2.5.2</a></span> Static Semantics: ComputedPropertyContains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains">14.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a>.</p>
<div class="gp prod"><span class="nt">PropertyName</span> <span class="geq">:</span> <span class="nt">LiteralPropertyName</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyName</span> <span class="geq">:</span> <span class="nt">ComputedPropertyName</span></div>
<ol class="proc">
<li>Return result of Contains for <i>ComputedPropertyName</i> with argument <i>symbol</i>.</li>
</ol>
</section>
<section id="sec-object-initializer-static-semantics-contains">
<h1><span class="secnum" id="sec-12.2.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-contains" title="link to this section">12.2.5.3</a></span> Static Semantics: Contains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-contains">12.3.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains">14.1.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains">14.2.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains">14.5.4</a></p>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">MethodDefinition</span></div>
<ol class="proc">
<li>If <i>symbol</i> is <i>MethodDefinition</i>, return <b>true</b>.</li>
<li>Return the result of ComputedPropertyContains for <i>MethodDefinition</i> with argument <i>symbol</i>..</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Static semantic rules that depend upon substructure generally do not look into function
definitions.</p>
</div>
<div class="gp prod"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>If <i>symbol</i> is a <i>ReservedWord</i>, return <b>false</b>.</li>
<li>If <i>symbol</i> is an <i>Identifier</i> and StringValue of <i>symbol</i> is the same value as the StringValue of
<i>IdentifierName</i>, return <b>true</b>;</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-object-initializer-static-semantics-hascomputedpropertykey">
<h1><span class="secnum" id="sec-12.2.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-hascomputedpropertykey" title="link to this section">12.2.5.4</a></span> Static Semantics: HasComputedPropertyKey</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-hascomputedpropertykey">14.3.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey">14.4.5</a></p>
<div class="gp prod"><span class="nt">PropertyDefinitionList</span> <span class="geq">:</span> <span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <span class="nt">PropertyDefinition</span></div>
<ol class="proc">
<li>If HasComputedPropertyKey of <i>PropertyDefinitionList</i> is <b>true</b>, then return <b>true</b>.</li>
<li>Return HasComputedPropertyKey of <i>PropertyDefinition</i>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return IsComputedPropertyKey of <i>PropertyName</i>.</li>
</ol>
<p class="Note"><i>NOTE An alternative semantics for this production is given in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-__proto___-property-names-in-object-initializers">B.3.1</a>.</i></p>
</section>
<section id="sec-static-semantics-iscomputedpropertykey">
<h1><span class="secnum" id="sec-12.2.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-iscomputedpropertykey" title="link to this section">12.2.5.5</a></span> Static Semantics: IsComputedPropertyKey</h1>
<div class="gp prod"><span class="nt">PropertyName</span> <span class="geq">:</span> <span class="nt">LiteralPropertyName</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyName</span> <span class="geq">:</span> <span class="nt">ComputedPropertyName</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-object-initializer-static-semantics-propname">
<h1><span class="secnum" id="sec-12.2.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-propname" title="link to this section">12.2.5.6</a></span> Static Semantics: <i>PropName</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-propname">14.3.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-propname">14.4.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-propname">14.5.13</a></p>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>Return StringValue of <i>IdentifierReference</i>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return PropName of <i>PropertyName</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span> <span class="nt">StringLiteral</span></div>
<ol class="proc">
<li>Return a String value whose characters are the SV of the <i>StringLiteral</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span> <span class="nt">NumericLiteral</span></div>
<ol class="proc">
<li>Let <i>nbr</i> be the result of forming the value of the <i>NumericLiteral</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nbr</i>).</li>
</ol>
<div class="gp prod"><span class="nt">ComputedPropertyName</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">AssignmentExpression</span> <code class="t">]</code></div>
<ol class="proc">
<li>Return <span style="font-family: sans-serif">empty</span>.</li>
</ol>
</section>
<section id="sec-static-semantics-propertynamelist">
<h1><span class="secnum" id="sec-12.2.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-propertynamelist" title="link to this section">12.2.5.7</a></span> Static Semantics: PropertyNameList</h1>
<div class="gp prod"><span class="nt">PropertyDefinitionList</span> <span class="geq">:</span> <span class="nt">PropertyDefinition</span></div>
<ol class="proc">
<li>If PropName of <i>PropertyDefinition</i> is <span style="font-family: sans-serif">empty</span>, return a new empty
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing PropName of
<i>PropertyDefinition</i>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinitionList</span> <span class="geq">:</span> <span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <span class="nt">PropertyDefinition</span></div>
<ol class="proc">
<li>Let <i>list</i> be PropertyNameList of <i>PropertyDefinitionList.</i></li>
<li>If PropName of <i>PropertyDefinition</i> is <span style="font-family: sans-serif">empty</span>, return
<i>list</i>.</li>
<li>Append PropName of <i>PropertyDefinition</i> to the end of <i>list</i>.</li>
<li>Return <i>list</i>.</li>
</ol>
</section>
<section id="sec-object-initializer-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-runtime-semantics-evaluation" title="link to this section">12.2.5.8</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ObjectLiteral</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%ObjectPrototype%</span>).</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ObjectLiteral</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <span class="nt">PropertyDefinitionList</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <code class="t">}</code></div>
</div>
<ol class="proc">
<li>Let <i>obj</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a> with the
intrinsic object <span style="font-family: sans-serif">%ObjectPrototype%</span> as its argument.</li>
<li>Let <i>status</i> be the result of performing PropertyDefinitionEvaluation of <i>PropertyDefinitionList</i> with
argument <i>obj</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>Return StringValue of <i>IdentifierReference</i>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return the result of evaluating <i>PropertyName</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Return StringValue of <i>IdentifierName</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span> <span class="nt">StringLiteral</span></div>
<ol class="proc">
<li>Return a String value whose characters are the SV of the <i>StringLiteral</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LiteralPropertyName</span> <span class="geq">:</span> <span class="nt">NumericLiteral</span></div>
<ol class="proc">
<li>Let <i>nbr</i> be the result of forming the value of the <i>NumericLiteral</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nbr</i>).</li>
</ol>
<div class="gp prod"><span class="nt">ComputedPropertyName</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">AssignmentExpression</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>exprValue</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>propName</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propName</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propName</i>).</li>
</ol>
</section>
<section id="sec-object-initializer-runtime-semantics-propertydefinitionevaluation">
<h1><span class="secnum" id="sec-12.2.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-runtime-semantics-propertydefinitionevaluation" title="link to this section">12.2.5.9</a></span> Runtime Semantics: PropertyDefinitionEvaluation</h1>
<p>With parameter <span style="font-family: Times New Roman"><i>object</i>.</span></p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-runtime-semantics-propertydefinitionevaluation">14.3.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation">14.4.15</a>, B.3.1</p>
<div class="gp prod"><span class="nt">PropertyDefinitionList</span> <span class="geq">:</span> <span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <span class="nt">PropertyDefinition</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing PropertyDefinitionEvaluation of <i>PropertyDefinitionList</i> with
argument <i>object</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>propDef</i> be the result of performing PropertyDefinitionEvaluation of <i>PropertyDefinition</i> with
argument <i>object</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propDef</i>).</li>
<li>If <i>propDef</i> is <span style="font-family: sans-serif">empty</span>, then return <i>propDef.</i></li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>,
<i>propDef.</i>[[key]], <i>propDef</i>.[[descriptor]]).</li>
<li>Return <i>status</i>.</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>Let <i>propName</i> be StringValue of <i>IdentifierReference</i>.</li>
<li>Let <i>exprValue</i> be the result of evaluating <i>IdentifierReference</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exprValue</i>).</li>
<li>Let <i>propValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propValue</i>).</li>
<li>Let <i>desc</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>{[[Value]]:
<i>propValue</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>propName</i>,
<i>desc</i>).</li>
</ol>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>propKey</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propKey</i>).</li>
<li>Let <i>exprValue</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>propValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propValue</i>).</li>
<li>If IsFunctionDefinition of <i>AssignmentExpression</i> is <b>true</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>propValue</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>.</li>
<li>Let <i>referencesSuper</i> be the value of <i>propValue</i>’s [[NeedsSuper]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>thisMode</i> be the value of <i>propValue</i>’s [[ThisMode]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>thisMode</i> is not <span style="font-family: sans-serif">lexical</span> and <i>referencesSuper</i> is
<b>true</b>, then
<ol class="block">
<li>If <i>propValue</i>’s [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>AssignmentExpression</i> is not a class definition
whose constructor references <code>super</code>.</li>
<li>Set <i>propValue</i>’s [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>object</i>.</li>
<li>Set <i>propValue</i>’s [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>propKey</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>AssignmentExpression)</i>
is <b>true</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>propValue</i>, <i>propKey</i>).</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>desc</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>{[[Value]]:
<i>propValue</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>propKey</i>,
<i>desc</i>).</li>
</ol>
<p class="Note"><i>NOTE An alternative semantics for this production is given in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-__proto___-property-names-in-object-initializers">B.3.1</a>.</i></p>
</section>
</section>
<section id="sec-function-defining-expressions">
<h1><span class="secnum" id="sec-12.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-defining-expressions" title="link to this section">12.2.6</a></span> Function Defining Expressions</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions">14.1</a> for <span class="prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">FunctionExpression</span></span> .</p>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions">14.4</a> for <span class="prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">GeneratorExpression</span></span> .</p>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions">14.5</a> for <span class="prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">ClassExpression</span></span> .</p>
</section>
<section id="sec-generator-comprehensions">
<div class="front">
<h1><span class="secnum" id="sec-12.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-comprehensions" title="link to this section">12.2.7</a></span> Generator Comprehensions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">GeneratorComprehension</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Comprehension</span><sub>[?Yield]</sub> <code class="t">)</code></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The keyword <code>yield</code> may be used in <i>IdentifierReference</i> contexts within
a <i>GeneratorComprehension</i> contained in non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>. The following early
error rule ensures that a <i>GeneratorComprehension</i> never contains a <i>YieldExpression</i>.</p>
</div>
</div>
<section id="sec-generator-comprehensions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.2.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-comprehensions-static-semantics-early-errors" title="link to this section">12.2.7.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">GeneratorComprehension</span> <span class="geq">:</span> <code class="t">(</code> <span class="nt">Comprehension</span> <code class="t">)</code></div>
<ul>
<li>It is a Syntax Error if <span style="font-family: Times New Roman"><i>Comprehension</i> Contains
<i>YieldExpression</i> is <b>true</b></span>.</li>
</ul>
</section>
<section id="sec-generator-comprehensions-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.7.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-comprehensions-runtime-semantics-evaluation" title="link to this section">12.2.7.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">GeneratorComprehension</span> <span class="geq">:</span> <code class="t">(</code> <span class="nt">Comprehension</span> <code class="t">)</code></div>
<ol class="proc">
<li>If <i>GeneratorComprehension</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, then let
<i>strict</i> be <b>true</b>; otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>scope</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>parameters</i> be the production: <span class="prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></span> .</li>
<li>Using <i>Comprehension</i> from the production that is being evaluated, let <i>body</i> be the supplemental
syntactic grammar production: <span class="prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span>
<span class="nt">Comprehension</span></span> .</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate">GeneratorFunctionCreate</a>(<span style="font-family:
sans-serif">Arrow</span>, <i>parameters</i>, <i>body, scope</i>, <i>strict</i>).</li>
<li>Let <i>prototype</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%GeneratorPrototype%</span>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>closure</i>, <b>true</b>, and <i>prototype</i>).</li>
<li>Let <i>iterator</i> be the result of calling the [[Call]] internal method of <i>closure</i> with <b>undefined</b> as
<i>thisArgument</i> and an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as
<i>argumentsList</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The GeneratorFunction object created in step 5 is not observable from ECMAScript code so
an implementation may choose to avoid its allocation and initialization. In that case use other semantically equivalent
means must be used to allocate and initialize the <i>iterator</i> object in step 8. In either case, the <i>prototype</i>
object created in step 6 must be created because it is potentially observable as the value of the <i>iterator</i>
object’s [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
</section>
</section>
<section id="sec-primary-expression-regular-expression-literals">
<div class="front">
<h1><span class="secnum" id="sec-12.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-regular-expression-literals" title="link to this section">12.2.8</a></span> Regular Expression Literals</h1>
<h2>Syntax</h2>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals">11.8.4</a>.</p>
</div>
<section id="sec-primary-expression-regular-expression-literals-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.2.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-regular-expression-literals-static-semantics-early-errors" title="link to this section">12.2.8.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">RegularExpressionLiteral</span></div>
<ul>
<li>
<p>It is a Syntax Error if <span style="font-family: Times New Roman">BodyText</span> of <span class="nt">RegularExpressionLiteral</span> cannot be recognized using the goal symbol <span class="nt">Pattern</span>
of the ECMAScript RegExp grammar specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a><var>.</var></p>
</li>
<li>
<p>It is a Syntax Error if <span style="font-family: Times New Roman">FlagText</span> of <span class="nt">RegularExpressionLiteral</span> contains any character other than <code>"g"</code>, <code>"i"</code>,
<code>"m"</code>, <code>"u"</code>, or <code>"y"</code>, or if it contains the same character more than once.</p>
</li>
</ul>
</section>
<section id="sec-regular-expression-literals-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.8.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regular-expression-literals-runtime-semantics-evaluation" title="link to this section">12.2.8.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">RegularExpressionLiteral</span></div>
<ol class="proc">
<li>Let <i>pattern</i> be the string value consisting of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">UTF-16
encoding</a> of each code point of BodyText of <i>RegularExpressionLiteral</i>.</li>
<li>Let <i>flags</i> be the string value consisting of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">UTF-16
encoding</a> of each code point of FlagText of <i>RegularExpressionLiteral</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpcreate">RegExpCreate</a>(<i>pattern</i>, <i>flags</i>).</li>
</ol>
</section>
</section>
<section id="sec-template-literals">
<div class="front">
<h1><span class="secnum" id="sec-12.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literals" title="link to this section">12.2.9</a></span>
Template Literals</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">TemplateLiteral</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">NoSubstitutionTemplate</span></div>
<div class="rhs"><span class="nt">TemplateHead</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <span class="grhsannot">[Lexical goal <span class="nt">InputElementTemplateTail</span>]</span> <span class="nt">TemplateSpans</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateSpans</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">TemplateTail</span></div>
<div class="rhs"><span class="nt">TemplateMiddleList</span><sub>[?Yield]</sub> <span class="grhsannot">[Lexical goal <span class="nt">InputElementTemplateTail</span>]</span> <span class="nt">TemplateTail</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TemplateMiddleList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">TemplateMiddle</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">TemplateMiddleList</span><sub>[?Yield]</sub> <span class="grhsannot">[Lexical goal <span class="nt">InputElementTemplateTail</span>]</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-template-literals-static-semantics">
<div class="front">
<h1><span class="secnum" id="sec-12.2.9.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literals-static-semantics" title="link to this section">12.2.9.1</a></span> Static Semantics</h1>
</div>
<section id="sec-static-semantics-templatestrings">
<h1><span class="secnum" id="sec-12.2.9.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-templatestrings" title="link to this section">12.2.9.1.1</a></span> Static Semantics: TemplateStrings</h1>
<p>With parameter <var>raw</var>.</p>
<div class="gp prod"><span class="nt">TemplateLiteral</span> <span class="geq">:</span> <span class="nt">NoSubstitutionTemplate</span></div>
<ol class="proc">
<li>If <i>raw</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>string</i> be the TV of <i>NoSubstitutionTemplate</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>string</i> be the TRV of <i>NoSubstitutionTemplate</i>.</li>
</ol>
</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the single element,
<i>string</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateLiteral</span> <span class="geq">:</span> <span class="nt">TemplateHead</span> <span class="nt">Expression</span> <span class="nt">TemplateSpans</span></div>
<ol class="proc">
<li>If <i>raw</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>head</i> be the TV of <i>TemplateHead</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>head</i> be the TRV of <i>TemplateHead</i>.</li>
</ol>
</li>
<li>Let <i>tail</i> be TemplateStrings of <i>TemplateSpans</i> with argument <i>raw</i>.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>head</i> followed by the
element, in order of <i>tail</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateSpans</span> <span class="geq">:</span> <span class="nt">TemplateTail</span></div>
<ol class="proc">
<li>If <i>raw</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>tail</i> be the TV of <i>TemplateTail</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>tail</i> be the TRV of <i>TemplateTail</i>.</li>
</ol>
</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the single element,
<i>tail</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateSpans</span> <span class="geq">:</span> <span class="nt">TemplateMiddleList</span> <span class="nt">TemplateTail</span></div>
<ol class="proc">
<li>Let <i>middle</i> be TemplateStrings of <i>TemplateMiddleList</i> with argument <i>raw</i>.</li>
<li>If <i>raw</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>tail</i> be the TV of <i>TemplateTail</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>tail</i> be the TRV of <i>TemplateTail</i>.</li>
</ol>
</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the elements, in order, of
<i>middle</i> followed by <i>tail</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateMiddleList</span> <span class="geq">:</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span></div>
<ol class="proc">
<li>If <i>raw</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>string</i> be the TV of <i>TemplateMiddle</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>string</i> be the TRV of <i>TemplateMiddle</i>.</li>
</ol>
</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the single element,
<i>string</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateMiddleList</span> <span class="geq">:</span> <span class="nt">TemplateMiddleList</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span></div>
<ol class="proc">
<li>Let <i>front</i> be TemplateStrings of <i>TemplateMiddleList</i> with argument <i>raw</i>.</li>
<li>If <i>raw</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>last</i> be the TV of <i>TemplateMiddle</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>last</i> be the TRV of <i>TemplateMiddle</i>.</li>
</ol>
</li>
<li>Append <i>last</i> as the last element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>front</i>.</li>
<li>Return <i>front</i>.</li>
</ol>
</section>
</section>
<section id="sec-runtime-semantics">
<div class="front">
<h1><span class="secnum" id="sec-12.2.9.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics" title="link to this section">12.2.9.2</a></span> Runtime Semantics</h1>
</div>
<section id="sec-runtime-semantics-runtime-semantics-argumentlistevaluation">
<h1><span class="secnum" id="sec-12.2.9.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-runtime-semantics-argumentlistevaluation" title="link to this section">12.2.9.2.1</a></span> <span style="font-family: sans-serif">Runtime Semantics:</span>
ArgumentListEvaluation</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists-runtime-semantics-argumentlistevaluation">12.3.6.1</a></p>
<div class="gp prod"><span class="nt">TemplateLiteral</span> <span class="geq">:</span> <span class="nt">NoSubstitutionTemplate</span></div>
<ol class="proc">
<li>Let <i>siteObj</i> be the result of the abstract operation GetTemplateCallSite passing this <i>TemplateLiteral</i>
production as the argument.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the one element which is
<i>siteObj</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateLiteral</span> <span class="geq">:</span> <span class="nt">TemplateHead</span> <span class="nt">Expression</span> <span class="nt">TemplateSpans</span></div>
<ol class="proc">
<li>Let <i>siteObj</i> be the result of the abstract operation GetTemplateCallSite passing this <i>TemplateLiteral</i>
production as the argument.</li>
<li>Let <i>firstSub</i> be the result of evaluating <i>Expression</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>firstSub</i>).</li>
<li>Let <i>restSub</i> be SubstitutionEvaluation of <i>TemplateSpans</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>restSub</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>restSub</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose first element is <i>siteObj</i>, whose
second elements is <i>firstSub</i>, and whose subsequent elements are the elements of <i>restSub</i>, in order.
<i>restSub</i> may contain no elements.</li>
</ol>
</section>
<section id="sec-runtime-semantics-gettemplatecallsite">
<h1><span class="secnum" id="sec-12.2.9.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-gettemplatecallsite" title="link to this section">12.2.9.2.2</a></span> Runtime Semantics: GetTemplateCallSite</h1>
<p>The abstract operation <span style="font-family: Times New Roman">GetTemplateCallSite</span> is called with a grammar
production, <var>templateLiteral</var>, as an argument. It performs the following steps:</p>
<ol class="proc">
<li>If a call site object for the source code corresponding to <i>templateLiteral</i> has already been created by a
previous call to this abstract operation, then
<ol class="block">
<li>Return that call site object.</li>
</ol>
</li>
<li>Let <i>cookedStrings</i> be TemplateStrings of <i>templateLiteral</i> with argument <b>false</b>.</li>
<li>Let <i>rawStrings</i> be TemplateStrings of <i>templateLiteral</i> with argument <b>true</b>.</li>
<li>Let <i>count</i> be the number of elements in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>cookedStrings</i>.</li>
<li>Let <i>siteObj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>count</i>).</li>
<li>Let <i>rawObj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>count</i>).</li>
<li>Let <i>index</i> be 0.</li>
<li>Repeat while <i>index</i> &lt; <i>count</i>
<ol class="block">
<li>Let <i>prop</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>).</li>
<li>Let <i>cookedValue</i> be the string value at 0-based position <i>index</i> of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>cookedStrings</i>.</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>siteObj</i> with arguments <i>prop</i> and
PropertyDescriptor{[[Value]]: <i>cookedValue</i>, [[Enumerable]]: <b>true</b>, [[Writable]]: <b>false</b>,
[[Configurable]]: <b>false</b>}<i>.</i></li>
<li>Let <i>rawValue</i> be the string value at 0-based position <i>index</i> of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>rawStrings</i>.</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>rawObj</i> with arguments <i>prop</i> and
PropertyDescriptor{[[Value]]: <i>rawValue</i>, [[Enumerable]]: <b>true</b>, [[Writable]]: <b>false</b>,
[[Configurable]]: <b>false</b>}<i>.</i></li>
<li>Let <i>index</i> be <i>index</i>+1.</li>
</ol>
</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setintegritylevel">SetIntegrityLevel</a>(<i>rawObj</i>, "<code>frozen</code>").</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>siteObj</i> with arguments <b>"<span style="font-family:
monospace">raw</span>"</b> and PropertyDescriptor{[[Value]]: <i>rawObj</i>, [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b>}<i>.</i></li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setintegritylevel">SetIntegrityLevel</a>(<i>siteObj</i>, "<code>frozen</code>").</li>
<li>Remember an association between the source code corresponding to <i>templateLiteral</i> and <i>siteObj</i> such
that <i>siteObj</i> can be retrieve in subsequent calls to this abstract operation.</li>
<li>Return <i>siteObj</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> The creation of a call site object cannot result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Each <i>TemplateLiteral</i> in the program code is associated with a unique Template
call site object that is used in the evaluation of tagged Templates (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-runtime-semantics-evaluation">12.2.9.2.4</a>). The same call site object is used each
time a specific tagged Template is evaluated. Whether call site objects are created lazily upon first evaluation of
the <i>TemplateLiteral</i> or eagerly prior to first evaluation is an implementation choice that is not observable to
ECMAScript code.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> Future editions of this specification may define additional non-enumerable
properties of call site objects.</p>
</div>
</section>
<section id="sec-runtime-semantics-substitutionevaluation">
<h1><span class="secnum" id="sec-12.2.9.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-substitutionevaluation" title="link to this section">12.2.9.2.3</a></span> Runtime Semantics: SubstitutionEvaluation</h1>
<div class="gp prod"><span class="nt">TemplateSpans</span> <span class="geq">:</span> <span class="nt">TemplateTail</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateSpans</span> <span class="geq">:</span> <span class="nt">TemplateMiddleList</span> <span class="nt">TemplateTail</span></div>
<ol class="proc">
<li>Return the result of SubstitutionEvaluation of <i>TemplateMiddleList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateMiddleList</span> <span class="geq">:</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span></div>
<ol class="proc">
<li>Let <i>sub</i> be the result of evaluating <i>Expression</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>sub</i>).</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing only <i>sub</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateMiddleList</span> <span class="geq">:</span> <span class="nt">TemplateMiddleList</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span></div>
<ol class="proc">
<li>Let <i>preceeding</i> be the result of SubstitutionEvaluation of <i>TemplateMiddleList</i> .</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>preceeding</i>).</li>
<li>Let <i>next</i> be the result of evaluating <i>Expression</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Append <i>next</i> as the last element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>preceeding</i>.</li>
<li>Return <i>preceeding</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.9.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-runtime-semantics-evaluation" title="link to this section">12.2.9.2.4</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">TemplateLiteral</span> <span class="geq">:</span> <span class="nt">NoSubstitutionTemplate</span></div>
<ol class="proc">
<li>Return the string value whose elements are the TV of <i>NoSubstitutionTemplate</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateLiteral</span> <span class="geq">:</span> <span class="nt">TemplateHead</span> <span class="nt">Expression</span> <span class="nt">TemplateSpans</span></div>
<ol class="proc">
<li>Let <i>head</i> be the TV of <i>TemplateHead</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>.</li>
<li>Let <i>sub</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>middle</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>sub</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>middle</i>).</li>
<li>Let <i>tail</i> be the result of evaluating <i>TemplateSpans</i> .</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>tail</i>).</li>
<li>Return the string value whose elements are the code units of <i>head</i> followed by the code units of
<i>tail</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Tthe string conversion semantics applied to the <i>Expression</i> value are like
<code>Stirng.prototype.concat</code> rather than the <code>+</code> operator.</p>
</div>
<div class="gp prod"><span class="nt">TemplateSpans</span> <span class="geq">:</span> <span class="nt">TemplateTail</span></div>
<ol class="proc">
<li>Let <i>tail</i> be the TV of <i>TemplateTail</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>.</li>
<li>Return the string whose elements are the code units of <i>tail</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateSpans</span> <span class="geq">:</span> <span class="nt">TemplateMiddleList</span> <span class="nt">TemplateTail</span></div>
<ol class="proc">
<li>Let <i>head</i> be the result of evaluating <i>TemplateMiddleList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>head</i>).</li>
<li>Let <i>tail</i> be the TV of <i>TemplateTail</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>.</li>
<li>Return the string whose elements are the elements of <i>head</i> followed by the elements of <i>tail</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TemplateMiddleList</span> <span class="geq">:</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span></div>
<ol class="proc">
<li>Let <i>head</i> be the TV of <i>TemplateMiddle</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>.</li>
<li>Let <i>sub</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>middle</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>sub</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>middle</i>).</li>
<li>Return the sequence of characters consisting of the code units of <i>head</i> followed by the elements of
<i>middle</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Tthe string conversion semantics applied to the <i>Expression</i> value are like
<code>Stirng.prototype.concat</code> rather than the <code>+</code> operator.</p>
</div>
<div class="gp prod"><span class="nt">TemplateMiddleList</span> <span class="geq">:</span> <span class="nt">TemplateMiddleList</span> <span class="nt">TemplateMiddle</span> <span class="nt">Expression</span></div>
<ol class="proc">
<li>Let <i>rest</i> be the result of evaluating <i>TemplateMiddleList</i> .</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rest</i>).</li>
<li>Let <i>middle</i> be the TV of <i>TemplateMiddle</i> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>.</li>
<li>Let <i>sub</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>last</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>sub</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>last</i>).</li>
<li>Return the sequence of characters consisting of the elements of <i>rest</i> followed by the code units of
<i>middle</i> followed by the elements of <i>last</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The string conversion semantics applied to the <i>Expression</i> value are like
<code>Stirng.prototype.concat</code> rather than the <code>+</code> operator.</p>
</div>
</section>
</section>
</section>
<section id="sec-grouping-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator" title="link to this section">12.2.10</a></span>
The Grouping Operator</h1>
</div>
<section id="sec-grouping-operator-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.2.10.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-early-errors" title="link to this section">12.2.10.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ul>
<li>
<p>It is a Syntax Error if the lexical token sequence matched by <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span> cannot be parsed with no tokens left over using
<span class="nt">ParenthesizedExpression</span> as the goal symbol.</p>
</li>
<li>
<p>All Early Errors rules for <span class="nt">ParenthesizedExpression</span> and its derived productions also apply
to the <span style="font-family: Times New Roman">CoveredParenthesizedExpression</span> of <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span>.</p>
</li>
</ul>
</section>
<section id="sec-grouping-operator-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.2.10.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition" title="link to this section">12.2.10.2</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp prod"><span class="nt">ParenthesizedExpression</span> <span class="geq">:</span> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></div>
<ol class="proc">
<li>Return IsFunctionDefinition of <i>Expression</i>.</li>
</ol>
</section>
<section id="sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.2.10.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.2.10.3</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp prod"><span class="nt">ParenthesizedExpression</span> <span class="geq">:</span> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></div>
<ol class="proc">
<li>Return IsValidSimpleAssignmentTarget of <i>Expression</i>.</li>
</ol>
</section>
<section id="sec-grouping-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.2.10.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-runtime-semantics-evaluation" title="link to this section">12.2.10.4</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>expr</i> be CoveredParenthesizedExpression of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the result of evaluating <i>expr</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ParenthesizedExpression</span> <span class="geq">:</span> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></div>
<ol class="proc">
<li>Return the result of evaluating <i>Expression</i>. This may be of type <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This algorithm does not apply <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a> to the result of
evaluating <i>Expression</i>. The principal motivation for this is so that operators such as <code>delete</code> and
<code>typeof</code> may be applied to parenthesized expressions.</p>
</div>
</section>
</section>
</section>
<section id="sec-left-hand-side-expressions">
<div class="front">
<h1><span class="secnum" id="sec-12.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-hand-side-expressions" title="link to this section">12.3</a></span> Left-Hand-Side Expressions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[Lexical goal <span class="nt">InputElementRegExp</span>]</span> <span class="nt">PrimaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">MemberExpression</span><sub>[?Yield]</sub> <code class="t">[</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">]</code></div>
<div class="rhs"><span class="nt">MemberExpression</span><sub>[?Yield]</sub> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">MemberExpression</span><sub>[?Yield]</sub> <span class="nt">TemplateLiteral</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>[?Yield]</sub><sub>opt</sub></div>
<div class="rhs"><code class="t">new</code> <span class="grhsannot">[lookahead ∉ {<code class="t">super</code>}]</span> <span class="nt">MemberExpression</span><sub>[?Yield]</sub> <span class="nt">Arguments</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NewExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">new</code> <span class="nt">NewExpression</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CallExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span><sub>[?Yield]</sub> <span class="nt">Arguments</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">super</code> <span class="nt">Arguments</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">CallExpression</span><sub>[?Yield]</sub> <span class="nt">Arguments</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">CallExpression</span><sub>[?Yield]</sub> <code class="t">[</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">]</code></div>
<div class="rhs"><span class="nt">CallExpression</span><sub>[?Yield]</sub> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">CallExpression</span><sub>[?Yield]</sub> <span class="nt">TemplateLiteral</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Arguments</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">(</code> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <span class="nt">ArgumentList</span><sub>[?Yield]</sub> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ArgumentList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><code class="t">...</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">ArgumentList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">ArgumentList</span><sub>[?Yield]</sub> <code class="t">,</code> <code class="t">...</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LeftHandSideExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">NewExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">CallExpression</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-left-hand-side-expressions-static-semantics">
<div class="front">
<h1><span class="secnum" id="sec-12.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-hand-side-expressions-static-semantics" title="link to this section">12.3.1</a></span> Static Semantics</h1>
</div>
<section id="sec-static-semantics-static-semantics-contains">
<h1><span class="secnum" id="sec-12.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-contains" title="link to this section">12.3.1.1</a></span> Static Semantics: Contains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains">14.1.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains">14.2.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains">14.5.4</a></p>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <span class="nt">MemberExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>If <i>MemberExpression</i> Contains <i>symbol</i> is <b>true</b>, return <b>true</b>.</li>
<li>If <i>symbol</i> is a <i>ReservedWord</i>, return <b>false</b>.</li>
<li>If <i>symbol</i> is an <i>Identifier</i> and StringValue of <i>symbol</i> is the same value as the StringValue of
<i>IdentifierName</i>, return <b>true</b>;</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>If <i>symbol</i> is the <i>ReservedWord</i> <code>super</code>, return <b>true</b>.</li>
<li>If <i>symbol</i> is a <i>ReservedWord</i>, return <b>false</b>.</li>
<li>If <i>symbol</i> is an <i>Identifier</i> and StringValue of <i>symbol</i> is the same value as the StringValue of
<i>IdentifierName</i>, return <b>true</b>;</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">CallExpression</span> <span class="geq">:</span> <span class="nt">CallExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>If <i>CallExpression</i> Contains <i>symbol</i> is <b>true</b>, return <b>true</b>.</li>
<li>If <i>symbol</i> is a <i>ReservedWord</i>, return <b>false</b>.</li>
<li>If <i>symbol</i> is an <i>Identifier</i> and StringValue of <i>symbol</i> is the same value as the StringValue of
<i>IdentifierName</i>, return <b>true</b>;</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">new</code> <code class="t">super</code></div>
<ol class="proc">
<li>If <i>symbol</i> is the <i>ReservedWord</i> <code>super</code>, return <b>true</b>.</li>
<li>If <i>symbol</i> is the <i>ReservedWord</i> <code>new</code>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span></div>
<ol class="proc">
<li>If <i>symbol</i> is the <i>ReservedWord</i> <code>super</code>, return <b>true</b>.</li>
<li>If <i>symbol</i> is the <i>ReservedWord</i> <code>new</code>, return <b>true</b>.</li>
<li>Return the result of <i>Arguments</i> Contains <i>symbol</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.3.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition" title="link to this section">12.3.1.2</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">TemplateLiteral</span></div>
<div class="rhs"><code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>opt</sub></div>
<div class="rhs"><code class="t">new</code> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NewExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">new</code> <span class="nt">NewExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CallExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><code class="t">super</code> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">TemplateLiteral</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-static-semantics-static-semantics-isidentifierref">
<h1><span class="secnum" id="sec-12.3.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref" title="link to this section">12.3.1.3</a></span> Static Semantics: IsIdentifierRef</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">LeftHandSideExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">CallExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">TemplateLiteral</span></div>
<div class="rhs"><code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>opt</sub></div>
<div class="rhs"><code class="t">new</code> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NewExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">new</code> <span class="nt">NewExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-static-semantics-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.3.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.3.1.4</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">CallExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
</div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">CallExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><code class="t">super</code> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">TemplateLiteral</span></div>
<div class="rhs"><span class="nt">NewExpression</span> <code class="t">:</code> <code class="t">new</code> <span class="nt">NewExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">TemplateLiteral</span></div>
<div class="rhs"><code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>opt</sub></div>
<div class="rhs"><code class="t">new</code> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
</section>
<section id="sec-property-accessors">
<div class="front">
<h1><span class="secnum" id="sec-12.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-accessors" title="link to this section">12.3.2</a></span>
Property Accessors</h1>
<div class="note">
<p><span class="nh">NOTE</span> Properties are accessed by name, using either the dot notation:</p>
</div>
<div class="lhs">MemberExpression <code>.</code> IdentifierName<br>CallExpression <code>.</code> IdentifierName</div>
<p>or the bracket notation:</p>
<div class="lhs">MemberExpression <code>[</code> Expression <code>]</code><br>CallExpression <code>[</code> Expression <code>]</code></div>
<p>The dot notation is explained by the following syntactic conversion:</p>
<div class="lhs">MemberExpression <code>.</code> IdentifierName</div>
<p>is identical in its behaviour to</p>
<div class="lhs">MemberExpression <code>[</code> &lt;identifier-name-string&gt; <code>]</code></div>
<p>and similarly</p>
<div class="lhs">CallExpression <code>.</code> IdentifierName</div>
<p>is identical in its behaviour to</p>
<div class="lhs">CallExpression <code>[</code> &lt;identifier-name-string&gt; <code>]</code></div>
<p>where <var>&lt;identifier-name-string&gt;</var> is a string literal containing the same sequence of characters after
processing of Unicode escape sequences as the <span class="nt">IdentifierName</span>.</p>
</div>
<section id="sec-property-accessors-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-accessors-runtime-semantics-evaluation" title="link to this section">12.3.2.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>baseReference</i> be the result of evaluating <i>MemberExpression</i>.</li>
<li>Let <i>baseValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>baseReference</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>baseValue</i>).</li>
<li>Let <i>propertyNameReference</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>propertyNameValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>propertyNameReference</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propertyNameValue</i>).</li>
<li>Let <i>bv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<i>baseValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>bv</i>).</li>
<li>Let <i>propertyNameString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>propertyNameValue</i>).</li>
<li>If the code matched by the syntactic production that is being evaluated is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a>, let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Return a value of type <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> whose base value is <i>bv</i> and
whose referenced name is <i>propertyNameString</i>, and whose strict reference flag is <i>strict</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CallExpression</span> <span class="geq">:</span> <span class="nt">CallExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<p>Is evaluated in exactly the same manner as <span class="prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span>
<code class="t">]</code></span> except that the contained <span class="nt">CallExpression</span> is evaluated in step
1.</p>
</section>
</section>
<section id="sec-new-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-operator" title="link to this section">12.3.3</a></span> The
<span style="font-family: monospace">new</span> Operator</h1>
</div>
<section id="sec-new-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-operator-runtime-semantics-evaluation" title="link to this section">12.3.3.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">NewExpression</span> <span class="geq">:</span> <code class="t">new</code> <span class="nt">NewExpression</span></div>
<ol class="proc">
<li>Let <i>ref</i> be the result of evaluating <i>NewExpression</i>.</li>
<li>Let <i>constructor</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>ref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>constructor</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>constructor</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>Return the result of calling the [[Construct]] internal method on <i>constructor</i> with an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as the argument.</li>
</ol>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">new</code> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
<ol class="proc">
<li>Let <i>ref</i> be the result of evaluating <i>MemberExpression</i>.</li>
<li>Let <i>constructor</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>ref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>constructor</i>).</li>
<li>Let <i>argList</i> be the result of evaluating <i>Arguments</i>, producing a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of argument values (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists">12.3.6</a>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argList</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a> (<i>constructor</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>thisCall</i> be this <i>MemberExpression</i>.</li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>If <i>tailCall</i> is <b>true</b>, then perform the PrepareForTailCall abstract operation.</li>
<li>Let <i>result</i> be the result of calling the [[Construct]] internal method on <i>constructor</i>, passing
<i>argList</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>tailCall</i> is <b>true</b>, the above call of [[Construct]]
will not return here, but instead evaluation will continue as if the following return has already occurred.</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
</section>
<section id="sec-function-calls">
<div class="front">
<h1><span class="secnum" id="sec-12.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-calls" title="link to this section">12.3.4</a></span>
Function Calls</h1>
</div>
<section id="sec-function-calls-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.3.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-calls-runtime-semantics-evaluation" title="link to this section">12.3.4.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">CallExpression</span> <span class="geq">:</span> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
<ol class="proc">
<li>Let <i>ref</i> be the result of evaluating <i>MemberExpression</i>.</li>
<li>If <i>MemberExpression</i> consists solely of the <i>IdentifierName</i> <code>eval</code>, then
<ol class="block">
<li>check if direct eval</li>
<li>Return EvaluateCall(<i>ref</i>, <i>Arguments</i>, <b>false</b>).</li>
</ol>
</li>
<li>Let <i>thisCall</i> be this <i>CallExpression</i>.</li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>Return EvaluateCall(<i>ref</i>, <i>Arguments</i>, <i>tailCall</i>).</li>
</ol>
<div class="gp prod"><span class="nt">CallExpression</span> <span class="geq">:</span> <span class="nt">CallExpression</span> <span class="nt">Arguments</span></div>
<ol class="proc">
<li>Let <i>ref</i> be the result of evaluating <i>CallExpression</i>.</li>
<li>Let <i>thisCall</i> be this <i>CallExpressio</i></li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>Return EvaluateCall(<i>ref</i>, <i>Arguments</i>, <i>tailCall</i>).</li>
</ol>
</section>
<section id="sec-runtime-semantics-evaluatecall">
<h1><span class="secnum" id="sec-12.3.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-evaluatecall" title="link to this section">12.3.4.2</a></span> Runtime Semantics: EvaluateCall</h1>
<p>The abstract operation EvaluateCall takes as arguments a value <i>ref</i>, and a syntactic grammar production
<i>arguments</i>, and a Boolean argument <i>tailPosition</i>. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>func</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>ref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>func</i>).</li>
<li>Let <i>argList</i> be ArgumentListEvaluation(<i>arguments</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argList</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>func</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>func</i>) is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>ref</i>) is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsPropertyReference</a>(<i>ref</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>thisValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisvalue">GetThisValue</a>(<i>ref</i>).</li>
</ol>
</li>
<li>Else, the base of <i>ref</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a></li>
<li>Let <i>thisValue</i> be the result of calling the WithBaseObject concrete method of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetBase</a>(<i>ref</i>).</li>
</ol>
</li>
<li>Else <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>ref</i>) is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>,
<ol class="block">
<li>Let <i>thisValue</i> be <b>undefined</b>.</li>
</ol>
</li>
<li>If <i>tailPosition</i> is <b>true</b>, then perform the PrepareForTailCall abstract operation.</li>
<li>Let <i>result</i> be the result of calling the [[Call]] internal method on <i>func</i>, passing <i>thisValue</i> as
the <i>thisArgument</i> and <i>argList</i> as the <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>tailPosition</i> is <b>true</b>, the above call will not
return here, but instead evaluation will continue as if the following return has already occurred.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>result</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> then <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>result</i>) is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language type</a></li>
<li>Return <i>result</i>.</li>
</ol>
</section>
</section>
<section id="sec-super-keyword">
<div class="front">
<h1><span class="secnum" id="sec-12.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-super-keyword" title="link to this section">12.3.5</a></span> The
<span style="font-family: monospace">super</span> Keyword</h1>
</div>
<section id="sec-super-keyword-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.3.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-super-keyword-static-semantics-early-errors" title="link to this section">12.3.5.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">:</code> <code class="t">super</code> <span class="nt">Arguments</span></div>
</div>
<ul>
<li>
<p>It is a Syntax Error if the source code parsed with this production is global code that is not eval code.</p>
</li>
<li>
<p>It is a Syntax Error if the source code parsed with this production is eval code and the source code is not being
processed by a direct call to eval that is contained in function code.</p>
</li>
</ul>
</section>
<section id="sec-super-keyword-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.3.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-super-keyword-runtime-semantics-evaluation" title="link to this section">12.3.5.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>propertyNameReference</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>propertyNameValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>propertyNameReference</i>).</li>
<li>Let <i>propertyKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyNameValue</i>).</li>
<li>If the code matched by the syntactic production that is being evaluated is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a>, let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makesuperreference">MakeSuperReference</a>(<i>propertyKey</i>, <i>strict</i>).</li>
</ol>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Let propertyKey be StringValue of <i>IdentifierName</i>.</li>
<li>If the code matched by the syntactic production that is being evaluated is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a>, let strict be <b>true</b>, else let strict be <b>false</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makesuperreference">MakeSuperReference</a>(propertyKey, strict).</li>
</ol>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>opt</sub></div>
<ol class="proc">
<li>If the code matched by the syntactic production that is being evaluated is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a>, let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>ref</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makesuperreference">MakeSuperReference</a>(<b>undefined</b>, <i>strict</i>).</li>
<li>Let <i>constructor</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>ref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>constructor</i>).</li>
<li>If <i>Arguments</i> is present, then
<ol class="block">
<li>Let <i>argList</i> be the result of evaluating <i>Arguments</i>, producing a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of argument values (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists">12.3.6</a>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argList</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>argList</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a> (<i>constructor</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>thisCall</i> be this <i>MemberExpression</i>.</li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>If <i>tailCall</i> is <b>true</b>, then perform the PrepareForTailCall abstract operation.</li>
<li>Let <i>result</i> be the result of calling the [[Construct]] internal method on <i>constructor</i>, passing
<i>argList</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>tailCall</i> is <b>true</b>, the above call of [[Construct]]
will not return here, but instead evaluation will continue as if the following return has already occurred.</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CallExpression</span> <span class="geq">:</span> <code class="t">super</code> <span class="nt">Arguments</span></div>
<ol class="proc">
<li>If the code matched by the syntactic production that is being evaluated is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a>, let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>ref</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makesuperreference">MakeSuperReference</a>(<b>undefined</b>, <i>strict</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>ref</i>).</li>
<li>Let <i>thisCall</i> be this <i>CallExpression</i>.</li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>Return EvaluateCall(<i>ref</i>, <i>Arguments</i>, <i>tailCall</i>).</li>
</ol>
</section>
<section id="sec-makesuperreference">
<h1><span class="secnum" id="sec-12.3.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makesuperreference" title="link to this section">12.3.5.3</a></span> Runtime Semantics: MakeSuperReference(propertyKey, strict)</h1>
<ol class="proc">
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisenvironment">GetThisEnvironment</a>( ).</li>
<li>If the result of calling the HasSuperBinding concrete method of <i>env</i> is <b>false</b>, then throw a
<b>ReferenceError</b> exception.</li>
<li>Let <i>actualThis</i> be the result of calling the GetThisBinding concrete method of <i>env</i>.</li>
<li>Let <i>baseValue</i> be the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getsuperbase">GetSuperBase</a> concrete method of
<i>env</i>.</li>
<li>Let <i>bv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<i>baseValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>bv</i>).</li>
<li>If <i>propertyKey</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>propertyKey</i> be the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethodname">GetMethodName</a> concrete
method of <i>env</i>.</li>
<li>If <i>propertyKey</i> is <b>undefined</b>, then then throw a <b>ReferenceError</b> exception.</li>
</ol>
</li>
<li>Return a value of type <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> that is a Super <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> whose base value is <i>bv</i>, whose referenced name is
<i>propertyKey</i>, whose thisValue is <i>actualThis</i>, and whose strict reference flag is <i>strict</i>.</li>
</ol>
</section>
</section>
<section id="sec-argument-lists">
<div class="front">
<h1><span class="secnum" id="sec-12.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists" title="link to this section">12.3.6</a></span>
Argument Lists</h1>
<div class="note">
<p><span class="nh">NOTE</span> The evaluation of an argument list produces a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of values (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">see
6.2.1</a>).</p>
</div>
</div>
<section id="sec-argument-lists-runtime-semantics-argumentlistevaluation">
<h1><span class="secnum" id="sec-12.3.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-argument-lists-runtime-semantics-argumentlistevaluation" title="link to this section">12.3.6.1</a></span> <span style="font-family: sans-serif">Runtime Semantics:</span>
ArgumentListEvaluation</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-runtime-semantics-argumentlistevaluation">12.2.9.2.1</a></p>
<div class="gp prod"><span class="nt">Arguments</span> <span class="geq">:</span> <code class="t">(</code> <code class="t">)</code></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ArgumentList</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>ref</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>arg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>ref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>arg</i>).</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose sole item is <i>arg</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ArgumentList</span> <span class="geq">:</span> <code class="t">...</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>list</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>spreadRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>spreadObj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>spreadRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>spreadObj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>spreadObj</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>spreadObj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <i>list</i>.</li>
<li>Let <i>nextArg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextArg</i>).</li>
<li>Append <i>nextArg</i> as the last element of <i>list</i>.</li>
</ol>
</li>
</ol>
<div class="gp prod"><span class="nt">ArgumentList</span> <span class="geq">:</span> <span class="nt">ArgumentList</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>precedingArgs</i> be the result of evaluating <i>ArgumentList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>precedingArgs</i>).</li>
<li>Let <i>ref</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>arg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>ref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>arg</i>).</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose length is one greater than the length of
<i>precedingArgs</i> and whose items are the items of <i>precedingArgs</i>, in order, followed at the end by
<i>arg</i> which is the last item of the new list.</li>
</ol>
<div class="gp prod"><span class="nt">ArgumentList</span> <span class="geq">:</span> <span class="nt">ArgumentList</span> <code class="t">,</code> <code class="t">...</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>precedingArgs</i> be be the result of evaluating <i>ArgumentList</i>.</li>
<li>Let <i>spreadRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>spreadObj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>spreadRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>spreadObj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>spreadObj</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>spreadObj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <i>precedingArgs</i>.</li>
<li>Let <i>nextArg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextArg</i>).</li>
<li>Append <i>nextArg</i> as the last element of <i>precedingArgs</i>.</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-tagged-templates">
<div class="front">
<h1><span class="secnum" id="sec-12.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tagged-templates" title="link to this section">12.3.7</a></span>
Tagged Templates</h1>
</div>
<section id="sec-tagged-templates-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.3.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tagged-templates-runtime-semantics-evaluation" title="link to this section">12.3.7.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">MemberExpression</span> <span class="geq">:</span> <span class="nt">MemberExpression</span> <span class="nt">TemplateLiteral</span></div>
<ol class="proc">
<li>Let <i>tagRef</i> be evaluating <i>MemberExpression</i>.</li>
<li>Let <i>thisCall</i> be this <i>MemberExpression</i>.</li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>Return EvaluateCall(<i>tagRef</i>, <i>TemplateLiteral</i>, <i>tailCall</i>).</li>
</ol>
<div class="gp prod"><span class="nt">CallExpression</span> <span class="geq">:</span> <span class="nt">CallExpression</span> <span class="nt">TemplateLiteral</span></div>
<ol class="proc">
<li>Let <i>tagRef</i> be the result of evaluating <i>CallExpression</i>.</li>
<li>Let <i>thisCall</i> be this <i>CallExpression</i>.</li>
<li>Let <i>tailCall</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">InTailPosition</a>(<i>thisCall</i>). (See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition">14.6.1</a>)</li>
<li>Return EvaluateCall(<i>tagRef</i>, <i>TemplateLiteral</i>, <i>tailCall</i>).</li>
</ol>
</section>
</section>
</section>
<section id="sec-postfix-expressions">
<div class="front">
<h1><span class="secnum" id="sec-12.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions" title="link to this section">12.4</a></span>
Postfix Expressions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">PostfixExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">--</code></div>
</div>
</div>
<section id="sec-postfix-expressions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-early-errors" title="link to this section">12.4.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp">
<div class="lhs"><span class="nt">PostfixExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">--</code></div>
</div>
<ul>
<li>
<p>It is an early <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error if <span style="font-family: Times New
Roman">IsValidSimpleAssignmentTarget</span> of <span class="nt">LeftHandSideExpression</span> is <span class="value">false</span>.</p>
</li>
</ul>
</section>
<section id="sec-postfix-expressions-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition" title="link to this section">12.4.2</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a></p>
<div class="gp">
<div class="lhs"><span class="nt">PostfixExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">--</code></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.4.3</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">PostfixExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">--</code></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-postfix-increment-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-increment-operator" title="link to this section">12.4.4</a></span> Postfix Increment Operator</h1>
</div>
<section id="sec-postfix-increment-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.4.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-increment-operator-runtime-semantics-evaluation" title="link to this section">12.4.4.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">PostfixExpression</span> <span class="geq">:</span> <span class="nt">LeftHandSideExpression</span> <code class="t">++</code></div>
<ol class="proc">
<li>Let <i>lhs</i> be the result of evaluating <i>LeftHandSideExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lhs</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>oldValue</i>).</li>
<li>Let <i>newValue</i> be the result of adding the value <code>1</code> to <i>oldValue</i>, using the same rules as for
the <code>+</code> operator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">see 12.7.5</a>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lhs</i>, <i>newValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>oldValue</i>.</li>
</ol>
</section>
</section>
<section id="sec-postfix-decrement-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-decrement-operator" title="link to this section">12.4.5</a></span> Postfix Decrement Operator</h1>
</div>
<section id="sec-postfix-decrement-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.4.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-decrement-operator-runtime-semantics-evaluation" title="link to this section">12.4.5.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">PostfixExpression</span> <span class="geq">:</span> <span class="nt">LeftHandSideExpression</span> <code class="t">--</code></div>
<ol class="proc">
<li>Let <i>lhs</i> be the result of evaluating <i>LeftHandSideExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lhs</i>)).</li>
<li>Let <i>newValue</i> be the result of subtracting the value <code>1</code> from <i>oldValue</i>, using the same rules
as for the <code>-</code> operator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">12.7.5</a>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lhs</i>, <i>newValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>oldValue</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-unary-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators" title="link to this section">12.5</a></span> Unary
Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">UnaryExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">PostfixExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">delete</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">void</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">typeof</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">++</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">--</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">+</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">-</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">~</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">!</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-unary-operators-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-early-errors" title="link to this section">12.5.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp">
<div class="lhs"><span class="nt">UnaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">++</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">--</code> <span class="nt">UnaryExpression</span></div>
</div>
<ul>
<li>
<p>It is an early <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error if <span style="font-family: Times New
Roman">IsValidSimpleAssignmentTarget</span> of <span class="nt">UnaryExpression</span> is <span class="value">false</span>.</p>
</li>
</ul>
</section>
<section id="sec-unary-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition" title="link to this section">12.5.2</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">UnaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">delete</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">void</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">typeof</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">++</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">--</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">~</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">!</code> <span class="nt">UnaryExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.5.3</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">UnaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">delete</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">void</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">typeof</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">++</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">--</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">~</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">!</code> <span class="nt">UnaryExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-delete-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-delete-operator" title="link to this section">12.5.4</a></span> The
<span style="font-family: monospace">delete</span> Operator</h1>
</div>
<section id="sec-delete-operator-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.5.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-delete-operator-static-semantics-early-errors" title="link to this section">12.5.4.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">delete</code> <span class="nt">UnaryExpression</span></div>
<ul>
<li>
<p>It is a Syntax Error if the <span class="nt">UnaryExpression</span> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> and the derived <span class="nt">UnaryExpression</span> is <span class="prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span></span>
<var>IdentifierReference.</var></p>
</li>
<li>
<p>It is a Syntax Error if the derived <span class="nt">UnaryExpression</span> is<br> <span style="font-family:
Times New Roman"><i>PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList<br></i></span>and derives a
production that, if used in place of <var>UnaryExpression,</var> would produce a Syntax Error according to these
rules. This rule is recursively applied.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The last rule means that expressions such as<br> <code>delete
(((foo)))</code><br>produce early errors because of recursive application of the first rule.</p>
</div>
</section>
<section id="sec-delete-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-delete-operator-runtime-semantics-evaluation" title="link to this section">12.5.4.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">delete</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>ref</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>ref</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>ref</i>) is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>, return <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsUnresolvableReference</a>(<i>ref</i>) is <b>true</b>, then,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsStrictReference</a>(<i>ref</i>) is <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsPropertyReference</a>(<i>ref</i>) is <b>true</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsSuperReference</a>(<i>ref</i>), then throw a
<b>ReferenceError</b> exception.</li>
<li>Let <i>deleteStatus</i> be the result of calling the [[Delete]] internal method on <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetBase</a>(<i>ref)</i>),
providing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>ref</i>) as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
<li>If <i>deleteStatus</i> is <b>false</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsStrictReference</a>(<i>ref</i>) is <b>true</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>deleteStatus</i>.</li>
</ol>
</li>
<li>Else <i>ref</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> to an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-environment-records">Environment Record</a> binding,
<ol class="block">
<li>Let <i>bindings</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetBase</a>(<i>ref</i>).</li>
<li>Return the result of calling the DeleteBinding concrete method of <i>bindings</i>, providing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">GetReferencedName</a>(<i>ref</i>) as the argument.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> When a <code>delete</code> operator occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
mode code</a>, a <b>SyntaxError</b> exception is thrown if its <i>UnaryExpression</i> is a direct reference to a
variable, function argument, or function name. In addition, if a <code>delete</code> operator occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> and the property to be deleted has the attribute { [[Configurable]]:
<b>false</b> }, a <b>TypeError</b> exception is thrown.</p>
</div>
</section>
</section>
<section id="sec-void-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-void-operator" title="link to this section">12.5.5</a></span> The
<span style="font-family: monospace">void</span> Operator</h1>
</div>
<section id="sec-void-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-void-operator-runtime-semantics-evaluation" title="link to this section">12.5.5.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">void</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <b>undefined</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a> must be called even though its value is not used
because it may have observable side-effects.</p>
</div>
</section>
</section>
<section id="sec-typeof-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typeof-operator" title="link to this section">12.5.6</a></span> The
<span style="font-family: monospace">typeof</span> Operator</h1>
</div>
<section id="sec-typeof-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typeof-operator-runtime-semantics-evaluation" title="link to this section">12.5.6.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">typeof</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>val</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>val</i>) is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">IsUnresolvableReference</a>(<i>val</i>) is <b>true</b>, return
<code>"undefined"</code>.</li>
<li>Let <i>val</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>val</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>val</i>).</li>
<li>Return a String according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-33">Table 33</a>.</li>
</ol>
<figure>
<figcaption><span id="table-33">Table 33</span> — typeof Operator Results</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000"><b>Type of</b> <span style="font-family: Times New Roman">val</span></th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Result</th>
</tr>
<tr>
<td>Undefined</td>
<td><code>"undefined"</code></td>
</tr>
<tr>
<td>Null</td>
<td><code>"object"</code></td>
</tr>
<tr>
<td>Boolean</td>
<td><code>"boolean"</code></td>
</tr>
<tr>
<td>Number</td>
<td><code>"number"</code></td>
</tr>
<tr>
<td>String</td>
<td><code>"string"</code></td>
</tr>
<tr>
<td>Symbol</td>
<td><code>"symbol"</code></td>
</tr>
<tr>
<td>Object (ordinary and does not implement [[Call]])</td>
<td><code>"object"</code></td>
</tr>
<tr>
<td>Object (standard exotic and does not implement [[Call]])</td>
<td><code>"object"</code></td>
</tr>
<tr>
<td>Object (implements [[Call]])</td>
<td><code>"function"</code></td>
</tr>
<tr>
<td>Object (non-standard exotic and does not implement [[Call]])</td>
<td>Implementation-defined. Must not be <code>"undefined"</code>, <code>"boolean"</code>, <code>"number</code>", <code>"symbol"</code>, or <code>"string".</code></td>
</tr>
</tbody></table>
</figure>
<div class="note">
<p><span class="nh">NOTE</span> Implementations are discouraged from defining new <code>typeof</code> result values for
non-standard exotic objects. If possible <code>"object"</code>should be used for such objects.</p>
</div>
</section>
</section>
<section id="sec-prefix-increment-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-increment-operator" title="link to this section">12.5.7</a></span> Prefix Increment Operator</h1>
</div>
<section id="sec-prefix-increment-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-increment-operator-runtime-semantics-evaluation" title="link to this section">12.5.7.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">++</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>oldValue</i>).</li>
<li>Let <i>newValue</i> be the result of adding the value <code>1</code> to <i>oldValue</i>, using the same rules as for
the <code>+</code> operator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">see 12.7.5</a>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>expr</i>, <i>newValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>newValue</i>.</li>
</ol>
</section>
</section>
<section id="sec-prefix-decrement-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-decrement-operator" title="link to this section">12.5.8</a></span> Prefix Decrement Operator</h1>
</div>
<section id="sec-prefix-decrement-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-decrement-operator-runtime-semantics-evaluation" title="link to this section">12.5.8.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">--</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>oldValue</i>).</li>
<li>Let <i>newValue</i> be the result of subtracting the value <code>1</code> from <i>oldValue</i>, using the same
rules as for the <code>-</code> operator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">see
12.7.5</a>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>expr</i>, <i>newValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>newValue</i>.</li>
</ol>
</section>
</section>
<section id="sec-unary-plus-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-plus-operator" title="link to this section">12.5.9</a></span>
Unary <span style="font-family: monospace">+</span> Operator</h1>
<div class="note">
<p><span class="nh">NOTE</span> The unary + operator converts its operand to Number type.</p>
</div>
</div>
<section id="sec-unary-plus-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.9.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-plus-operator-runtime-semantics-evaluation" title="link to this section">12.5.9.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">+</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>)).</li>
</ol>
</section>
</section>
<section id="sec-unary-minus-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-minus-operator" title="link to this section">12.5.10</a></span> Unary <span style="font-family: monospace">-</span> Operator</h1>
<div class="note">
<p><span class="nh">NOTE</span> The unary <code>-</code> operator converts its operand to Number type and then negates
it. Negating <b>+0</b> produces <b>−0</b>, and negating <b>−0</b> produces <b>+0</b>.</p>
</div>
</div>
<section id="sec-unary-minus-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.10.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-minus-operator-runtime-semantics-evaluation" title="link to this section">12.5.10.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">-</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>oldValue</i>).</li>
<li>If <i>oldValue</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return the result of negating <i>oldValue</i>; that is, compute a Number with the same magnitude but opposite
sign.</li>
</ol>
</section>
</section>
<section id="sec-bitwise-not-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-not-operator" title="link to this section">12.5.11</a></span> Bitwise NOT Operator ( <span style="font-family: monospace">~</span>
)</h1>
</div>
<section id="sec-bitwise-not-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.11.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-not-operator-runtime-semantics-evaluation" title="link to this section">12.5.11.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">~</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>oldValue</i>).</li>
<li>Return the result of applying bitwise complement to <i>oldValue</i>. The result is a signed 32-bit integer.</li>
</ol>
</section>
</section>
<section id="sec-logical-not-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.5.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-logical-not-operator" title="link to this section">12.5.12</a></span> Logical NOT Operator ( <span style="font-family: monospace">!</span>
)</h1>
</div>
<section id="sec-logical-not-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.5.12.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-logical-not-operator-runtime-semantics-evaluation" title="link to this section">12.5.12.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">UnaryExpression</span> <span class="geq">:</span> <code class="t">!</code> <span class="nt">UnaryExpression</span></div>
<ol class="proc">
<li>Let <i>expr</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>oldValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>expr</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>oldValue</i>).</li>
<li>If <i>oldValue</i> is <b>true</b>, return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-multiplicative-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators" title="link to this section">12.6</a></span>
Multiplicative Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">MultiplicativeExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span><sub>[?Yield]</sub> <code class="t">*</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span><sub>[?Yield]</sub> <code class="t">/</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span><sub>[?Yield]</sub> <code class="t">%</code> <span class="nt">UnaryExpression</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-multiplicative-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition" title="link to this section">12.6.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">MultiplicativeExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">*</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">/</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">%</code> <span class="nt">UnaryExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.6.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">MultiplicativeExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">*</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">/</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">%</code> <span class="nt">UnaryExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-multiplicative-operators-runtime-semantics-evaluation">
<div class="front">
<h1><span class="secnum" id="sec-12.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-runtime-semantics-evaluation" title="link to this section">12.6.3</a></span> Runtime Semantics: Evaluation</h1>
<p>The production <span class="prod"><span class="nt">MultiplicativeExpression</span> <span class="geq">:</span> <span class="nt">MultiplicativeExpression</span> <code class="t">@</code> <span class="nt">UnaryExpression</span></span> , where
@ stands for one of the operators in the above definitions, is evaluated as follows:</p>
<ol class="proc">
<li>Let <i>left</i> be the result of evaluating <i>MultiplicativeExpression</i>.</li>
<li>Let <i>leftValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>left</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>leftValue</i>).</li>
<li>Let <i>right</i> be the result of evaluating <i>UnaryExpression</i>.</li>
<li>Let <i>rightValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>right</i>).</li>
<li>Let <i>lnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>leftValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lnum</i>).</li>
<li>Let <i>rnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>rightValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rnum</i>).</li>
<li>Return the result of applying the specified operation (*, /, or %) to <i>lnum</i> and <i>rnum</i>. See the Notes
below <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-mul-operator">12.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-div-operator">12.6.3.2</a>,
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-mod-operator">12.6.3.3</a>.</li>
</ol>
</div>
<section id="sec-applying-the-mul-operator">
<h1><span class="secnum" id="sec-12.6.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-mul-operator" title="link to this section">12.6.3.1</a></span> Applying the <span style="font-family: monospace">*</span>
Operator</h1>
<p>The <code>*</code> operator performs multiplication, producing the product of its operands. Multiplication is
commutative. Multiplication is not always associative in ECMAScript, because of finite precision.</p>
<p>The result of a floating-point multiplication is governed by the rules of IEEE 754 binary double-precision
arithmetic:</p>
<ul>
<li>
<p>If either operand is <b>NaN</b>, the result is <b>NaN</b>.</p>
</li>
<li>
<p>The sign of the result is positive if both operands have the same sign, negative if the operands have different
signs.</p>
</li>
<li>
<p>Multiplication of an infinity by a zero results in <b>NaN</b>.</p>
</li>
<li>
<p>Multiplication of an infinity by an infinity results in an infinity. The sign is determined by the rule already
stated above.</p>
</li>
<li>
<p>Multiplication of an infinity by a finite nonzero value results in a signed infinity. The sign is determined by the
rule already stated above.</p>
</li>
<li>
<p>In the remaining cases, where neither an infinity nor NaN is involved, the product is computed and rounded to the
nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, the
result is then an infinity of appropriate sign. If the magnitude is too small to represent, the result is then a zero
of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754.</p>
</li>
</ul>
</section>
<section id="sec-applying-the-div-operator">
<h1><span class="secnum" id="sec-12.6.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-div-operator" title="link to this section">12.6.3.2</a></span> Applying the <span style="font-family: monospace">/</span>
Operator</h1>
<p>The <code>/</code> operator performs division, producing the quotient of its operands. The left operand is the dividend
and the right operand is the divisor. ECMAScript does not perform integer division. The operands and result of all
division operations are double-precision floating-point numbers. The result of division is determined by the specification
of IEEE 754 arithmetic:</p>
<ul>
<li>
<p>If either operand is <b>NaN</b>, the result is <b>NaN</b>.</p>
</li>
<li>
<p>The sign of the result is positive if both operands have the same sign, negative if the operands have different
signs.</p>
</li>
<li>
<p>Division of an infinity by an infinity results in <b>NaN</b>.</p>
</li>
<li>
<p>Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated
above.</p>
</li>
<li>
<p>Division of an infinity by a nonzero finite value results in a signed infinity. The sign is determined by the rule
already stated above.</p>
</li>
<li>
<p>Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated
above.</p>
</li>
<li>
<p>Division of a zero by a zero results in <b>NaN</b>; division of zero by any other finite value results in zero,
with the sign determined by the rule already stated above.</p>
</li>
<li>
<p>Division of a nonzero finite value by a zero results in a signed infinity. The sign is determined by the rule
already stated above.</p>
</li>
<li>
<p>In the remaining cases, where neither an infinity, nor a zero, nor <b>NaN</b> is involved, the quotient is computed
and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to
represent, the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small
to represent, the operation underflows and the result is a zero of the appropriate sign. The ECMAScript language
requires support of gradual underflow as defined by IEEE 754.</p>
</li>
</ul>
</section>
<section id="sec-applying-the-mod-operator">
<h1><span class="secnum" id="sec-12.6.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-mod-operator" title="link to this section">12.6.3.3</a></span> Applying the <span style="font-family: monospace">%</span>
Operator</h1>
<p>The <code>%</code> operator yields the remainder of its operands from an implied division; the left operand is the
dividend and the right operand is the divisor.</p>
<div class="note">
<p><span class="nh">NOTE</span> In C and C++, the remainder operator accepts only integral operands; in ECMAScript, it
also accepts floating-point operands.</p>
</div>
<p>The result of a floating-point remainder operation as computed by the <code>%</code> operator is not the same as the
“remainder” operation defined by IEEE 754. The IEEE 754 “remainder” operation computes the
remainder from a rounding division, not a truncating division, and so its behaviour is not analogous to that of the usual
integer remainder operator. Instead the ECMAScript language defines <code>%</code> on floating-point operations to behave
in a manner analogous to that of the Java integer remainder operator; this may be compared with the C library function
fmod.</p>
<p>The result of an ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic:</p>
<ul>
<li>
<p>If either operand is <b>NaN</b>, the result is <b>NaN</b>.</p>
</li>
<li>
<p>The sign of the result equals the sign of the dividend.</p>
</li>
<li>
<p>If the dividend is an infinity, or the divisor is a zero, or both, the result is <b>NaN</b>.</p>
</li>
<li>
<p>If the dividend is finite and the divisor is an infinity, the result equals the dividend.</p>
</li>
<li>
<p>If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend.</p>
</li>
<li>
<p>In the remaining cases, where neither an infinity, nor a zero, nor <b>NaN</b> is involved, the floating-point
remainder r from a dividend n and a divisor d is defined by the mathematical relation r = n − (d × q)
where q is an integer that is negative only if n/d is negative and positive only if n/d is positive, and whose
magnitude is as large as possible without exceeding the magnitude of the true mathematical quotient of n and d. r is
computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode.</p>
</li>
</ul>
</section>
</section>
</section>
<section id="sec-additive-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators" title="link to this section">12.7</a></span>
Additive Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">AdditiveExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">AdditiveExpression</span><sub>[?Yield]</sub> <code class="t">+</code> <span class="nt">MultiplicativeExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">AdditiveExpression</span><sub>[?Yield]</sub> <code class="t">-</code> <span class="nt">MultiplicativeExpression</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-additive-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition" title="link to this section">12.7.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">AdditiveExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">+</code> <span class="nt">MultiplicativeExpression</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">-</code> <span class="nt">MultiplicativeExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.7.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.7.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">AdditiveExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">+</code> <span class="nt">MultiplicativeExpression</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">-</code> <span class="nt">MultiplicativeExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-addition-operator-plus">
<div class="front">
<h1><span class="secnum" id="sec-12.7.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addition-operator-plus" title="link to this section">12.7.3</a></span> The Addition operator ( <span style="font-family: monospace">+</span>
)</h1>
<div class="note">
<p><span class="nh">NOTE</span> The addition operator either performs string concatenation or numeric addition.</p>
</div>
</div>
<section id="sec-addition-operator-plus-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.7.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addition-operator-plus-runtime-semantics-evaluation" title="link to this section">12.7.3.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">AdditiveExpression</span> <span class="geq">:</span> <span class="nt">AdditiveExpression</span> <code class="t">+</code> <span class="nt">MultiplicativeExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>AdditiveExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>MultiplicativeExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>lprim</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lprim</i>).</li>
<li>Let <i>rprim</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>rval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rprim</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>lprim</i>) is String or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rprim</i>) is String, then
<ol class="block">
<li>Return the String that is the result of concatenating <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lprim</i>)
followed by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>rprim</i>)</li>
</ol>
</li>
<li>Return the result of applying the addition operation to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>lprim</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>rprim</i>). See the Note below <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">12.7.5</a>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> No hint is provided in the calls to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a> in
steps 7 and 9. All standard objects except Date objects handle the absence of a hint as if the hint Number were given;
Date objects handle the absence of a hint as if the hint String were given. Exotic objects may handle the absence of a
hint in some other manner.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Step 11 differs from step 5 of the Abstract Relational Comparison algorithm (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">7.2.8</a>), by using the logical-or operation instead of the logical-and operation.</p>
</div>
</section>
</section>
<section id="sec-subtraction-operator-minus">
<div class="front">
<h1><span class="secnum" id="sec-12.7.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-subtraction-operator-minus" title="link to this section">12.7.4</a></span> The Subtraction Operator ( <span style="font-family:
monospace">-</span> )</h1>
</div>
<section id="sec-subtraction-operator-minus-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.7.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-subtraction-operator-minus-runtime-semantics-evaluation" title="link to this section">12.7.4.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">AdditiveExpression</span> <span class="geq">:</span> <span class="nt">AdditiveExpression</span> <code class="t">-</code> <span class="nt">MultiplicativeExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>AdditiveExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>MultiplicativeExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>lnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lnum</i>).</li>
<li>Let <i>rnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>rval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rnum</i>).</li>
<li>Return the result of applying the subtraction operation to <i>lnum</i> and <i>rnum</i>. See the note below <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers">12.7.5</a>.</li>
</ol>
</section>
</section>
<section id="sec-applying-the-additive-operators-to-numbers">
<h1><span class="secnum" id="sec-12.7.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-applying-the-additive-operators-to-numbers" title="link to this section">12.7.5</a></span> Applying the Additive Operators to Numbers</h1>
<p>The <code>+</code> operator performs addition when applied to two operands of numeric type, producing the sum of the
operands. The <code>-</code> operator performs subtraction, producing the difference of two numeric operands.</p>
<p>Addition is a commutative operation, but not always associative.</p>
<p>The result of an addition is determined using the rules of IEEE 754 binary double-precision arithmetic:</p>
<ul>
<li>
<p>If either operand is <b>NaN</b>, the result is <b>NaN</b>.</p>
</li>
<li>
<p>The sum of two infinities of opposite sign is <b>NaN</b>.</p>
</li>
<li>
<p>The sum of two infinities of the same sign is the infinity of that sign.</p>
</li>
<li>
<p>The sum of an infinity and a finite value is equal to the infinite operand.</p>
</li>
<li>
<p>The sum of two negative zeroes is <b>−0</b>. The sum of two positive zeroes, or of two zeroes of opposite sign,
is <b>+0</b>.</p>
</li>
<li>
<p>The sum of a zero and a nonzero finite value is equal to the nonzero operand.</p>
</li>
<li>
<p>The sum of two nonzero finite values of the same magnitude and opposite sign is <b>+0</b>.</p>
</li>
<li>
<p>In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, and the operands have the same
sign or have different magnitudes, the sum is computed and rounded to the nearest representable value using IEEE 754
round-to-nearest mode. If the magnitude is too large to represent, the operation overflows and the result is then an
infinity of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The <code>-</code> operator performs subtraction when applied to two operands of numeric
type, producing the difference of its operands; the left operand is the minuend and the right operand is the subtrahend.
Given numeric operands <i>a</i> and <i>b</i>, it is always the case that <i>a<span style="font-family:
monospace">–</span>b</i> produces the same result as <i>a <span style="font-family:
monospace">+(–</span>b<span style="font-family: monospace">)</span></i>.</p>
</div>
</section>
</section>
<section id="sec-bitwise-shift-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators" title="link to this section">12.8</a></span>
Bitwise Shift Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ShiftExpression</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ShiftExpression</span><sub>[?Yield]</sub> <code class="t">&lt;&lt;</code> <span class="nt">AdditiveExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ShiftExpression</span><sub>[?Yield]</sub> <code class="t">&gt;&gt;</code> <span class="nt">AdditiveExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ShiftExpression</span><sub>[?Yield]</sub> <code class="t">&gt;&gt;&gt;</code> <span class="nt">AdditiveExpression</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition" title="link to this section">12.8.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">ShiftExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&lt;&lt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.8.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.8.2</a></span> Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">ShiftExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&lt;&lt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-left-shift-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.8.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-shift-operator" title="link to this section">12.8.3</a></span>
The Left Shift Operator ( <span style="font-family: monospace">&lt;&lt;</span> )</h1>
<div class="note">
<p><span class="nh">NOTE</span> Performs a bitwise left shift operation on the left operand by the amount specified by
the right operand.</p>
</div>
</div>
<section id="sec-left-shift-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.8.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-shift-operator-runtime-semantics-evaluation" title="link to this section">12.8.3.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ShiftExpression</span> <span class="geq">:</span> <span class="nt">ShiftExpression</span> <code class="t">&lt;&lt;</code> <span class="nt">AdditiveExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>AdditiveExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>lnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lnum</i>).</li>
<li>Let <i>rnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>rval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rnum</i>).</li>
<li>Let <i>shiftCount</i> be the result of masking out all but the least significant 5 bits of <i>rnum</i>, that is,
compute <i>rnum</i> &amp; 0x1F.</li>
<li>Return the result of left shifting <i>lnum</i> by <i>shiftCount</i> bits. The result is a signed 32-bit
integer.</li>
</ol>
</section>
</section>
<section id="sec-signed-right-shift-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.8.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-signed-right-shift-operator" title="link to this section">12.8.4</a></span> The Signed Right Shift Operator ( <span style="font-family:
monospace">&gt;&gt;</span> )</h1>
<div class="note">
<p><span class="nh">NOTE</span> Performs a sign-filling bitwise right shift operation on the left operand by the amount
specified by the right operand.</p>
</div>
</div>
<section id="sec-signed-right-shift-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.8.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-signed-right-shift-operator-runtime-semantics-evaluation" title="link to this section">12.8.4.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ShiftExpression</span> <span class="geq">:</span> <span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>AdditiveExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>lnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lnum</i>).</li>
<li>Let <i>rnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>rval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rnum</i>).</li>
<li>Let <i>shiftCount</i> be the result of masking out all but the least significant 5 bits of <i>rnum</i>, that is,
compute <i>rnum</i> &amp; 0x1F.</li>
<li>Return the result of performing a sign-extending right shift of <i>lnum</i> by <i>shiftCount</i> bits. The most
significant bit is propagated. The result is a signed 32-bit integer.</li>
</ol>
</section>
</section>
<section id="sec-unsigned-right-shift-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.8.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unsigned-right-shift-operator" title="link to this section">12.8.5</a></span> The Unsigned Right Shift Operator ( <span style="font-family:
monospace">&gt;&gt;&gt;</span> )</h1>
<div class="note">
<p><span class="nh">NOTE</span> Performs a zero-filling bitwise right shift operation on the left operand by the amount
specified by the right operand.</p>
</div>
</div>
<section id="sec-unsigned-right-shift-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.8.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unsigned-right-shift-operator-runtime-semantics-evaluation" title="link to this section">12.8.5.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ShiftExpression</span> <span class="geq">:</span> <span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>AdditiveExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>lnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lnum</i>).</li>
<li>Let <i>rnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>rval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rnum</i>).</li>
<li>Let <i>shiftCount</i> be the result of masking out all but the least significant 5 bits of <i>rnum</i>, that is,
compute <i>rnum</i> &amp; 0x1F.</li>
<li>Return the result of performing a zero-filling right shift of <i>lnum</i> by <i>shiftCount</i> bits. Vacated bits
are filled with zero. The result is an unsigned 32-bit integer.</li>
</ol>
</section>
</section>
</section>
<section id="sec-relational-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators" title="link to this section">12.9</a></span>
Relational Operators</h1>
<div class="note">
<p><span class="nh">NOTE</span> The result of evaluating a relational operator is always of type Boolean, reflecting
whether the relationship named by the operator holds between its two operands.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">RelationalExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub> <code class="t">&lt;</code> <span class="nt">ShiftExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub> <code class="t">&gt;</code> <span class="nt">ShiftExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub> <code class="t">&lt;=</code> <span class="nt">ShiftExpression</span><sub>[? Yield]</sub></div>
<div class="rhs"><span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub> <code class="t">&gt;=</code> <span class="nt">ShiftExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub> <code class="t">instanceof</code> <span class="nt">ShiftExpression</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="grhsannot">[+In]</span> <span class="nt">RelationalExpression</span><sub>[In, ?Yield]</sub> <code class="t">in</code> <span class="nt">ShiftExpression</span><sub>[?Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The [in] grammar parameter is needed to avoid confusing the <span style="font-family:
monospace">in</span> operator in a relational expression with the <span style="font-family: monospace">in</span> operator
in a <span style="font-family: monospace">for</span> statement.</p>
</div>
</div>
<section id="sec-relational-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.9.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition" title="link to this section">12.9.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">RelationalExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">instanceof</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">in</code> <span class="nt">ShiftExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.9.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.9.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">RelationalExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">instanceof</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">in</code> <span class="nt">ShiftExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-relational-operators-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.9.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-runtime-semantics-evaluation" title="link to this section">12.9.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">RelationalExpression</span> <span class="geq">:</span> <span class="nt">RelationalExpression</span> <code class="t">&lt;</code> <span class="nt">ShiftExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li>Let <i>r</i> be the result of performing Abstract Relational Comparison <i>lval</i> &lt; <i>rval</i>. (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">see 7.2.8</a>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>r</i>).</li>
<li>If <i>r</i> is <b>undefined</b>, return <b>false</b>. Otherwise, return <i>r</i>.</li>
</ol>
<div class="gp prod"><span class="nt">RelationalExpression</span> <span class="geq">:</span> <span class="nt">RelationalExpression</span> <code class="t">&gt;</code> <span class="nt">ShiftExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li>Let <i>r</i> be the result of performing Abstract Relational Comparison <i>rval</i> &lt; <i>lval</i> with
<i>LeftFirst</i> equal to <b>false</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>r</i>).</li>
<li>If <i>r</i> is <b>undefined</b>, return <b>false</b>. Otherwise, return <i>r</i>.</li>
</ol>
<div class="gp prod"><span class="nt">RelationalExpression</span> <span class="geq">:</span> <span class="nt">RelationalExpression</span> <code class="t">&lt;=</code> <span class="nt">ShiftExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li>Let <i>r</i> be the result of performing Abstract Relational Comparison <i>rval</i> &lt; <i>lval</i> with
<i>LeftFirst</i> equal to <b>false</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>r</i>).</li>
<li>If <i>r</i> is <b>true</b> or <b>undefined</b>, return <b>false</b>. Otherwise, return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">RelationalExpression</span> <span class="geq">:</span> <span class="nt">RelationalExpression</span> <code class="t">&gt;=</code> <span class="nt">ShiftExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li>Let <i>r</i> be the result of performing Abstract Relational Comparison <i>lval</i> &lt; <i>rval</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>r</i>).</li>
<li>If <i>r</i> is <b>true</b> or <b>undefined</b>, return <b>false</b>. Otherwise, return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">RelationalExpression</span> <span class="geq">:</span> <span class="nt">RelationalExpression</span> <code class="t">instanceof</code> <span class="nt">ShiftExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instanceofoperator">InstanceofOperator</a>(<i>lval</i>, <i>rval</i>).</li>
</ol>
<div class="gp prod"><span class="nt">RelationalExpression</span> <span class="geq">:</span> <span class="nt">RelationalExpression</span> <code class="t">in</code> <span class="nt">ShiftExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>ShiftExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rval</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>rval</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>lval</i>)).</li>
</ol>
</section>
<section id="sec-instanceofoperator">
<h1><span class="secnum" id="sec-12.9.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instanceofoperator" title="link to this section">12.9.4</a></span>
Runtime Semantics: InstanceofOperator(O, C)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">InstanceofOperator(<i>O</i>, <i>C</i>)</span>
implements the generic algorithm for determining if an object <var>O</var> inherits from the inheritance path defined by
constructor <var>C</var>. This abstract operation performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>C</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>instOfHandler</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getmethod">GetMethod</a>(<i>C</i>,@@hasInstance).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>instOfHandler</i>).</li>
<li>If <i>instOfHandler</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>result</i> be the result of calling the [[Call]] internal method of <i>instOfHandler</i> passing <i>C</i>
as <i>thisArgument</i> and a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>O</i> as
<i>argumentsList</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>result</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>C</i>) is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinaryhasinstance">OrdinaryHasInstance</a>(<i>C</i>, <i>O</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Steps 5 and 6 provide compatibility with previous editions of ECMAScript that did not use
a @@hasInstance method to define the <code>instanceof</code> operator semantics. If a function object does not define or
inherit @@hasInstance it uses the default <code>instanceof</code> semantics.</p>
</div>
</section>
</section>
<section id="sec-equality-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators" title="link to this section">12.10</a></span>
Equality Operators</h1>
<div class="note">
<p><span class="nh">NOTE</span> The result of evaluating an equality operator is always of type Boolean, reflecting
whether the relationship named by the operator holds between its two operands.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">EqualityExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">EqualityExpression</span><sub>[?In, ?Yield]</sub> <code class="t">==</code> <span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">EqualityExpression</span><sub>[?In, ?Yield]</sub> <code class="t">!=</code> <span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">EqualityExpression</span><sub>[?In, ?Yield]</sub> <code class="t">===</code> <span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">EqualityExpression</span><sub>[?In, ?Yield]</sub> <code class="t">!==</code> <span class="nt">RelationalExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-equality-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.10.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition" title="link to this section">12.10.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">EqualityExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">==</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!=</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">===</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!==</code> <span class="nt">RelationalExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.10.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.10.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">EqualityExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">==</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!=</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">===</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!==</code> <span class="nt">RelationalExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-equality-operators-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.10.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-runtime-semantics-evaluation" title="link to this section">12.10.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">EqualityExpression</span> <span class="geq">:</span> <span class="nt">EqualityExpression</span> <code class="t">==</code> <span class="nt">RelationalExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>EqualityExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Return the result of performing Abstract Equality Comparison <i>rval</i> == <i>lval</i>.</li>
</ol>
<div class="gp prod"><span class="nt">EqualityExpression</span> <span class="geq">:</span> <span class="nt">EqualityExpression</span> <code class="t">!=</code> <span class="nt">RelationalExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>EqualityExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>r</i> be the result of performing Abstract Equality Comparison <i>rval</i> == <i>lval</i>.</li>
<li>If <i>r</i> is <b>true</b>, return <b>false</b>. Otherwise, return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">EqualityExpression</span> <span class="geq">:</span> <span class="nt">EqualityExpression</span> <code class="t">===</code> <span class="nt">RelationalExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>EqualityExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>)</li>
<li>Let <i>rref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Return the result of performing Strict Equality Comparison <i>rval</i> === <i>lval</i>.</li>
</ol>
<div class="gp prod"><span class="nt">EqualityExpression</span> <span class="geq">:</span> <span class="nt">EqualityExpression</span> <code class="t">!==</code> <span class="nt">RelationalExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>EqualityExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>RelationalExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>r</i> be the result of performing Strict Equality Comparison <i>rval</i> === <i>lval</i>.</li>
<li>If <i>r</i> is <b>true</b>, return <b>false</b>. Otherwise, return <b>true</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> Given the above definition of equality:</p>
<ul>
<li>String comparison can be forced by: <code>"" + a == "" + b</code>.</li>
<li>Numeric comparison can be forced by: <code>+a == +b</code>.</li>
<li>Boolean comparison can be forced by: <code>!a == !b</code>.</li>
</ul>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The equality operators maintain the following invariants:</p>
<ul>
<li><code>A</code> <code>!=</code> <code>B</code> is equivalent to <code>!(A</code> <code>==</code>
<code>B)</code>.</li>
<li><code>A</code> <code>==</code> <code>B</code> is equivalent to <code>B</code> <code>==</code> <code>A</code>, except
in the order of evaluation of <code>A</code> and <code>B</code>.</li>
</ul>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> The equality operator is not always transitive. For example, there might be two distinct
String objects, each representing the same String value; each String object would be considered equal to the String value
by the <code>==</code> operator, but the two String objects would not be equal to each other. For Example:</p>
<ul>
<li><code>new String("a")</code> <code>==</code> <code>"a"</code> and <code>"a"</code> <code>==</code> <code>new
String("a")</code>are both <b>true</b>.</li>
<li><code>new String("a")</code> <code>==</code> <code>new String("a")</code> is <b>false</b>.</li>
</ul>
</div>
<div class="note">
<p><span class="nh">NOTE 4</span> Comparison of Strings uses a simple equality test on sequences of code unit values.
There is no attempt to use the more complex, semantically oriented definitions of character or string equality and
collating order defined in the Unicode specification. Therefore Strings values that are canonically equal according to the
Unicode standard could test as unequal. In effect this algorithm assumes that both Strings are already in normalized
form.</p>
</div>
</section>
</section>
<section id="sec-binary-bitwise-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators" title="link to this section">12.11</a></span> Binary Bitwise Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">BitwiseANDExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">BitwiseANDExpression</span><sub>[?In, ?Yield]</sub> <code class="t">&amp;</code> <span class="nt">EqualityExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BitwiseXORExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BitwiseANDExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">BitwiseXORExpression</span><sub>[?In, ?Yield]</sub> <code class="t">^</code> <span class="nt">BitwiseANDExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BitwiseORExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BitwiseXORExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">BitwiseORExpression</span><sub>[?In, ?Yield]</sub> <code class="t">|</code> <span class="nt">BitwiseXORExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.11.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition" title="link to this section">12.11.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<p><span class="prod"><span class="nt">BitwiseANDExpression</span> <span class="geq">:</span> <span class="nt">BitwiseANDExpression</span> <code class="t">&amp;</code> <span class="nt">EqualityExpression</span></span></p>
<p><span class="prod"><span class="nt">BitwiseXORExpression</span> <span class="geq">:</span> <span class="nt">BitwiseXORExpression</span> <code class="t">^</code> <span class="nt">BitwiseANDExpression</span></span></p>
<div class="gp prod"><span class="nt">BitwiseORExpression</span> <span class="geq">:</span> <span class="nt">BitwiseORExpression</span> <code class="t">|</code> <span class="nt">BitwiseXORExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.11.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.11.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<p><span class="prod"><span class="nt">BitwiseANDExpression</span> <span class="geq">:</span> <span class="nt">BitwiseANDExpression</span> <code class="t">&amp;</code> <span class="nt">EqualityExpression</span></span></p>
<p><span class="prod"><span class="nt">BitwiseXORExpression</span> <span class="geq">:</span> <span class="nt">BitwiseXORExpression</span> <code class="t">^</code> <span class="nt">BitwiseANDExpression</span></span></p>
<div class="gp prod"><span class="nt">BitwiseORExpression</span> <span class="geq">:</span> <span class="nt">BitwiseORExpression</span> <code class="t">|</code> <span class="nt">BitwiseXORExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-binary-bitwise-operators-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.11.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-runtime-semantics-evaluation" title="link to this section">12.11.3</a></span> Runtime Semantics: Evaluation</h1>
<p>The production <var>A</var> <b>:</b> <i><span style="font-family: Times New Roman">A</span> @ <span style="font-family:
Times New Roman">B</span></i>, where @ is one of the bitwise operators in the productions above, is evaluated as
follows:</p>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>A</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>B</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>lnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lnum</i>).</li>
<li>Let <i>rnum</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<i>rval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rnum</i>).</li>
<li>Return the result of applying the bitwise operator @ to <i>lnum</i> and <i>rnum</i>. The result is a signed 32 bit
integer.</li>
</ol>
</section>
</section>
<section id="sec-binary-logical-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators" title="link to this section">12.12</a></span> Binary Logical Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">LogicalANDExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BitwiseORExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">LogicalANDExpression</span><sub>[?In, ?Yield]</sub> <code class="t">&amp;&amp;</code> <span class="nt">BitwiseORExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LogicalORExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LogicalANDExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">LogicalORExpression</span><sub>[?In, ?Yield]</sub> <code class="t">||</code> <span class="nt">LogicalANDExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The value produced by a <code>&amp;&amp;</code> or <code>||</code> operator is not
necessarily of type Boolean. The value produced will always be the value of one of the two operand expressions.</p>
</div>
</div>
<section id="sec-binary-logical-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.12.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition" title="link to this section">12.12.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<p><span class="prod"><span class="nt">LogicalANDExpression</span> <span class="geq">:</span> <span class="nt">LogicalANDExpression</span> <code class="t">&amp;&amp;</code> <span class="nt">BitwiseORExpression</span></span></p>
<div class="gp prod"><span class="nt">LogicalORExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">||</code> <span class="nt">LogicalANDExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.12.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.12.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<p><span class="prod"><span class="nt">LogicalANDExpression</span> <span class="geq">:</span> <span class="nt">LogicalANDExpression</span> <code class="t">&amp;&amp;</code> <span class="nt">BitwiseORExpression</span></span></p>
<div class="gp prod"><span class="nt">LogicalORExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">||</code> <span class="nt">LogicalANDExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-binary-logical-operators-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.12.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-runtime-semantics-evaluation" title="link to this section">12.12.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">LogicalANDExpression</span> <span class="geq">:</span> <span class="nt">LogicalANDExpression</span> <code class="t">&amp;&amp;</code> <span class="nt">BitwiseORExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>LogicalANDExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li>Let <i>lbool</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lbool</i>).</li>
<li>If <i>lbool</i> is <b>false</b>, return <i>lval</i>.</li>
<li>Let <i>rref</i> be the result of evaluating <i>BitwiseORExpression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
</ol>
<div class="gp prod"><span class="nt">LogicalORExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">||</code> <span class="nt">LogicalANDExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>LogicalORExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li>Let <i>lbool</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>lval</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lbool</i>).</li>
<li>If <i>lbool</i> is <b>true</b>, return <i>lval</i>.</li>
<li>Let <i>rref</i> be the result of evaluating <i>LogicalANDExpression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
</ol>
</section>
</section>
<section id="sec-conditional-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator" title="link to this section">12.13</a></span>
Conditional Operator ( <span style="font-family: monospace">? : )</span></h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ConditionalExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LogicalORExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">LogicalORExpression</span><sub>[?In,?Yield]</sub> <code class="t">?</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">:</code> <span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The grammar for a <i>ConditionalExpression</i> in ECMAScript is slightly different from
that in C and Java, which each allow the second subexpression to be an <i>Expression</i> but restrict the third expression
to be a <i>ConditionalExpression</i>. The motivation for this difference in ECMAScript is to allow an assignment
expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma
expression as the centre expression.</p>
</div>
</div>
<section id="sec-conditional-operator-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.13.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition" title="link to this section">12.13.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp prod"><span class="nt">ConditionalExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">?</code> <span class="nt">AssignmentExpression</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.13.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.13.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp prod"><span class="nt">ConditionalExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">?</code> <span class="nt">AssignmentExpression</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-conditional-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.13.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-runtime-semantics-evaluation" title="link to this section">12.13.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ConditionalExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">?</code> <span class="nt">AssignmentExpression</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>LogicalORExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>If <i>lval</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>trueRef</i> be the result of evaluating the first <i>AssignmentExpression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>trueRef</i>).</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>falseRef</i> be the result of evaluating the second <i>AssignmentExpression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>falseRef</i>).</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-assignment-operators">
<div class="front">
<h1><span class="secnum" id="sec-12.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators" title="link to this section">12.14</a></span>
Assignment Operators</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentExpression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ConditionalExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="grhsannot">[+Yield]</span> <span class="nt">YieldExpression</span><sub>[?In]</sub></div>
<div class="rhs"><span class="nt">ArrowFunction</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <code class="t">=</code> <span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="gp prod"><span class="nt">AssignmentOperator</span> <span class="geq">:</span> <span class="grhsmod">one of</span></div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">*=</span></td>
<td><span style="font-family: monospace">/=</span></td>
<td><span style="font-family: monospace">%=</span></td>
<td><span style="font-family: monospace">+=</span></td>
<td><span style="font-family: monospace">-=</span></td>
<td><span style="font-family: monospace">&lt;&lt;=</span></td>
<td><span style="font-family: monospace">&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&gt;&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&amp;=</span></td>
<td><span style="font-family: monospace">^=</span></td>
<td><span style="font-family: monospace">|=</span></td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-assignment-operators-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.14.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-early-errors" title="link to this section">12.14.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">AssignmentExpression</span> <span class="geq">:</span> <span class="nt">LeftHandSideExpression</span> <code class="t">=</code> <span class="nt">AssignmentExpression</span></div>
<ul>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is either an <span class="nt">ObjectLiteral</span> or an <span class="nt">ArrayLiteral</span> and the lexical token sequence matched by
<span class="nt">LeftHandSideExpression</span> cannot be parsed with no tokens left over using <span class="nt">AssignmentPattern</span> as the goal symbol.</p>
</li>
<li>
<p>If <span class="nt">LeftHandSideExpression</span> is either an <span class="nt">ObjectLiteral</span> or an <span class="nt">ArrayLiteral</span> and if the lexical token sequence matched by <span class="nt">LeftHandSideExpression</span> can be parsed with no tokens left over using <span class="nt">AssignmentPattern</span> as the goal symbol then the following rules are not applied. Instead, the Early
Error rules for <span class="nt">AssignmentPattern</span> are used.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is an <span class="nt">IdentifierReference</span> that can be statically determined to always resolve to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> binding and the resolved binding is an
immutable binding.</p>
</li>
<li>
<p>It is an early <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error if <span class="nt">LeftHandSideExpression</span> is neither an <span class="nt">ObjectLiteral</span> nor an <span class="nt">ArrayLiteral</span> and <span style="font-family: Times New Roman">IsValidSimpleAssignmentTarget</span> of
<span class="nt">LeftHandSideExpression</span> is <span class="value">false</span>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">AssignmentExpression</span> <span class="geq">:</span> <span class="nt">LeftHandSideExpression</span> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span></div>
<ul>
<li>
<p>It is a Syntax Error if the <span class="nt">LeftHandSideExpression</span> is an <span class="nt">IdentifierReference</span> that can be statically determined to always resolve to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> binding and the resolved binding is an
immutable binding.</p>
</li>
<li>
<p>It is an early <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error if <span style="font-family: Times New
Roman">IsValidSimpleAssignmentTarget</span> of <span class="nt">LeftHandSideExpression</span> is <span class="value">false</span>.</p>
</li>
</ul>
</section>
<section id="sec-assignment-operators-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.14.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition" title="link to this section">12.14.2</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp prod"><span class="nt">AssignmentExpression</span> <span class="geq">:</span> <span class="nt">ArrowFunction</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">YieldExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">=</code> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.14.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.14.3</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">12.15.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">YieldExpression</span></div>
<div class="rhs"><span class="nt">ArrowFunction</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">=</code> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-assignment-operators-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.14.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-runtime-semantics-evaluation" title="link to this section">12.14.4</a></span> Runtime Semantics: Evaluation</h1>
<p><span class="nt">AssignmentExpression</span><sub>[In, Yield]</sub> <b>:</b> <span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <code>=</code> <span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></p>
<ol class="proc">
<li>If <i>LeftHandSideExpression</i> is neither an <i>ObjectLiteral</i> nor an <i>ArrayLiteral</i> then
<ol class="block">
<li>Let lref be the result of evaluating <i>LeftHandSideExpression</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(lref).</li>
<li>Let rref be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let rval be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(rref).</li>
<li>If both <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>AssignmentExpression)</i> and
IsIdentifierRef of <i>LeftHandSideExpression</i> are <b>true</b>, then
<ol class="block">
<li>Let hasNameProperty be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(rval, <code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(hasNameProperty).</li>
<li>If hasNameProperty is <b>false</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(rval, GetReferenceName(lref)).</li>
</ol>
</li>
</ol>
</li>
<li>Let status be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(lref, rval).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(status).</li>
<li>Return rval.</li>
</ol>
</li>
<li>Let AssignmentPattern be the parse of the source code corresponding to <i>LeftHandSideExpression</i> using
<i>AssignmentPattern</i><sub>[?Yield]</sub> as the goal symbol.</li>
<li>Let rref be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let rval be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(rref).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(rval).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(rval) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Let status be the result of performing DestructuringAssignmentEvaluation of AssignmentPattern using rval as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(status).</li>
<li>Return rval.</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentExpression</span> <span class="geq">:</span> <span class="nt">LeftHandSideExpression</span> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>LeftHandSideExpression</i>.</li>
<li>Let <i>lval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lval</i>).</li>
<li>Let <i>rref</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>Let <i>operator</i> be the <code>@</code> where <i>AssignmentOperator</i> is <code>@=</code></li>
<li>Let <i>r</i> be the result of applying operator @ to <i>lval</i> and <i>rval</i>.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lref</i>, <i>r</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>r</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> When an assignment occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, it
is an runtime error if <i>lref</i> in step 1.f.of the first algorithm or step 9 of the second algorithm it is an
unresolvable reference. If it is, a <b>ReferenceError</b> exception is thrown. The <i>LeftHandSide</i> also may not be a
reference to a data property with the attribute value {[[Writable]]:<b>false</b>}, to an accessor property with the
attribute value {[[Set]]:<b>undefined</b>}, nor to a non-existent property of an object for which the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a> predicate returns the value <b>false</b>. In these cases a <b>TypeError</b>
exception is thrown.</p>
</div>
</section>
<section id="sec-destructuring-assignment">
<div class="front">
<h1><span class="secnum" id="sec-12.14.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-assignment" title="link to this section">12.14.5</a></span> Destructuring Assignment</h1>
<h2>Supplemental Syntax</h2>
<p>In certain circumstances when processing the production <span class="prod"><span class="nt">AssignmentExpression</span>
<span class="geq">:</span> <span class="nt">LeftHandSideExpression</span> <code class="t">=</code> <span class="nt">AssignmentExpression</span></span> the following grammar is used to refine the interpretation of <span class="nt">LeftHandSideExpression</span>.</p>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentPattern</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ObjectAssignmentPattern</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ArrayAssignmentPattern</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ObjectAssignmentPattern</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">AssignmentPropertyList</span><sub>[?Yield]</sub> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">AssignmentPropertyList</span><sub>[?Yield]</sub> <code class="t">,</code> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ArrayAssignmentPattern</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentRestElement</span><sub>[?Yield]</sub><sub>opt</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">AssignmentElementList</span><sub>[?Yield]</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">AssignmentElementList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentRestElement</span><sub>[?Yield]</sub><sub>opt</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentPropertyList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentProperty</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">AssignmentPropertyList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">AssignmentProperty</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentElementList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentElisionElement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">AssignmentElementList</span><sub>[?Yield]</sub> <code class="t">,</code> <span class="nt">AssignmentElisionElement</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentElisionElement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentElement</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentProperty</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierReference</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[In,?Yield]</sub><sub>opt</sub></div>
<div class="rhs"><span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentElement</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentElement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">DestructuringAssignmentTarget</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[In,?Yield]</sub><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentRestElement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">...</code> <span class="nt">DestructuringAssignmentTarget</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DestructuringAssignmentTarget</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-destructuring-assignment-static-semantics-early-errors">
<h1><span class="secnum" id="sec-12.14.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-assignment-static-semantics-early-errors" title="link to this section">12.14.5.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">AssignmentProperty</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ul>
<li>
<p>It is a Syntax Error if IsValidSimpleAssignment of <span class="nt">IdentifierReference</span> is <span class="value">false</span>.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">IdentifierReference</span> statically resolves to a immutable
binding<i>.</i></p>
</li>
</ul>
<div class="gp prod"><span class="nt">AssignmentRestElement</span> <span class="geq">:</span> <code class="t">...</code> <span class="nt">DestructuringAssignmentTarget</span></div>
<ul>
<li>
<p>It is a Syntax Error if <span style="font-family: Times New Roman">IsValidSimpleAssignmentTarget</span> of <span class="nt">DestructuringAssignmentTarget</span> is <span style="font-family: Times New
Roman"><b>false</b><i>.</i></span></p>
</li>
</ul>
<div class="gp prod"><span class="nt">DestructuringAssignmentTarget</span> <span class="geq">:</span> <span class="nt">LeftHandSideExpression</span></div>
<ul>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is either an <span class="nt">ObjectLiteral</span> or an <span class="nt">ArrayLiteral</span> and if the lexical token sequence matched
by <span class="nt">LeftHandSideExpression</span> cannot be parsed with no tokens left over using <span class="nt">AssignmentPattern</span> as the goal symbol.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is neither an <span class="nt">ObjectLiteral</span> nor an <span class="nt">ArrayLiteral</span> and <span style="font-family: Times New
Roman">IsValidSimpleAssignmentTarget</span>(<span class="nt">LeftHandSideExpression</span>) is <span class="value">false</span>.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is an <span class="nt">IdentifierReference</span> that can be statically determined to always resolve to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> binding and the resolved binding is an
immutable binding.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is <span class="prod"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span> <span class="geq">:</span>
<code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></span> and <span class="nt">Expression</span> derives a production that would produce a Syntax Error according to these rules if that
production is substituted for <span class="nt">LeftHandSideExpression</span>. This rule is recursively applied.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The last rule means that the other rules are applied even if multiple levels of nested
parenthesizes surround <i>Expression</i>.</p>
</div>
</section>
<section id="sec-runtime-semantics-destructuringassignmentevaluation">
<h1><span class="secnum" id="sec-12.14.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-destructuringassignmentevaluation" title="link to this section">12.14.5.2</a></span> Runtime Semantics: DestructuringAssignmentEvaluation</h1>
<p>with parameter <var>obj</var></p>
<div class="gp prod"><span class="nt">ObjectAssignmentPattern</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">ArrayAssignmentPattern</span> <span class="geq">:</span> <code class="t">[</code> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">ArrayAssignmentPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with <i>iterator</i> as
the argument.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayAssignmentPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>If <i>Elision</i> is present, then
<ol class="block">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>AssignmentRestElement</i> with
<i>iterator</i> as the argument.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayAssignmentPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">AssignmentElementList</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>AssignmentElementList</i> using
<i>iterator</i> as the argument.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayAssignmentPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">AssignmentElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentRestElement</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of
<i>AssignmentElementList</i> using <i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>Elision</i> is present, then
<ol class="block">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>If <i>AssignmentRestElement</i> is present, then return the result of performing
IteratorDestructuringAssignmentEvaluation of <i>AssignmentRestElement</i> with <i>iterator</i> as the argument.</li>
<li>Return <i>lastIndex</i>.</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentPropertyList</span> <span class="geq">:</span> <span class="nt">AssignmentPropertyList</span> <code class="t">,</code> <span class="nt">AssignmentProperty</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing DestructuringAssignmentEvaluation for <i>AssignmentPropertyList</i>
using <i>obj</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing DestructuringAssignmentEvaluation for <i>AssignmentProperty</i> using <i>obj</i> as
the argument.</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentProperty</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>P</i> be StringValue of <i>IdentifierReference</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <i>Initializer</i><sub>opt</sub> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>Let <i>lref</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolvebinding">ResolveBinding</a>(<i>P)</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lref</i>,<i>v</i>).</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentProperty</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentElement</span></div>
<ol class="proc">
<li>Let <i>name</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Return the result of performing KeyedDestructuringAssignmentEvaluation of <i>AssignmentElement</i> with <i>obj</i>
and <i>name</i> as the arguments.</li>
</ol>
</section>
<section id="sec-runtime-semantics-iteratordestructuringassignmentevaluation">
<h1><span class="secnum" id="sec-12.14.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-iteratordestructuringassignmentevaluation" title="link to this section">12.14.5.3</a></span> Runtime Semantics: IteratorDestructuringAssignmentEvaluation</h1>
<p>with parameters <var>iterator</var></p>
<div class="gp prod"><span class="nt">AssignmentElementList</span> <span class="geq">:</span> <span class="nt">AssignmentElisionElement</span></div>
<ol class="proc">
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>AssignmentElisionElementList</i>
using <i>iterator</i> as the <i>argument</i>.</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentElementList</span> <span class="geq">:</span> <span class="nt">AssignmentElementList</span> <code class="t">,</code> <span class="nt">AssignmentElisionElement</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of
<i>AssignmentElementList</i> using <i>iterator</i> as the <i>argument.</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>AssignmentElisionElementList</i>
using <i>iterator</i> as the <i>argument</i>.</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentElisionElement</span> <span class="geq">:</span> <span class="nt">AssignmentElement</span></div>
<ol class="proc">
<li><i>R</i>eturn the result of performing IteratorDestructuringAssignmentEvaluation of <i>AssignmentElement</i> with
<i>iterator</i> as the argument.</li>
</ol>
<div class="gp prod"><span class="nt">AssignmentElisionElement</span> <span class="geq">:</span> <span class="nt">Elision</span> <span class="nt">AssignmentElement</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>AssignmentElement</i> with
<i>iterator</i> as the argument.</li>
</ol>
<div class="gp prod"><span class="nt">Elision</span> <span class="geq">:</span> <code class="t">,</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
</ol>
<div class="gp prod"><span class="nt">Elision</span> <span class="geq">:</span> <span class="nt">Elision</span> <code class="t">,</code></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
</ol>
<p><span class="nt">AssignmentElement</span><sub>[Yield]</sub> <b>:</b> <span class="nt">DestructuringAssignmentTarget</span> <span class="nt">Initializer</span><sub>opt</sub></p>
<ol class="proc">
<li>If <i>DestructuringAssignmentTarget</i> is neither an <i>ObjectLiteral</i> nor an <i>ArrayLiteral</i> then
<ol class="block">
<li>Let <i>lref</i> be the result of evaluating <i>DestructuringAssignmentTarget</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lref</i>).</li>
</ol>
</li>
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>v</i> be <b>undefined</b></li>
<li>Else
<ol class="block">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <i>Initializer</i> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let v be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <i>DestructuringAssignmentTarget</i> is an <i>ObjectLiteral or an ArrayLiteral</i> then
<ol class="block">
<li>Let <i>nestedAssignmentPattern</i> be the parse of the source code corresponding to
DestructuringAssignmentTarget using either <i>AssignmentPattern</i> or
<i>AssignmentPattern</i><sub>[Yield]</sub> as the goal symbol depending upon whether this
<i>AssignmentElement</i> has the <span style="font-family: sans-serif"><sub>Yield</sub></span> parameter.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return the result of performing DestructuringAssignmentEvaluation of <i>nestedAssignmentPattern</i> with
<i>v</i> as the argument.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lref</i>,<i>v</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Left to right evaluation order is maintained by evaluating a
<i>DestructuringAssignmentTarget</i> that is not a destruturing pattern prior to accessing the iterator or evaluating
the <i>Initializer</i>.</p>
</div>
<div class="gp prod"><span class="nt">AssignmentRestElement</span> <span class="geq">:</span> <code class="t">...</code> <span class="nt">DestructuringAssignmentTarget</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>DestructuringAssignmentTarget</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lref</i>).</li>
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>n</i>=0;</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lref</i>, <i>A</i>).</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>n)</i>), <i>nextValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Increment <i>n</i> by 1.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-runtime-semantics-keyeddestructuringassignmentevaluation">
<h1><span class="secnum" id="sec-12.14.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-keyeddestructuringassignmentevaluation" title="link to this section">12.14.5.4</a></span> Runtime Semantics: KeyedDestructuringAssignmentEvaluation</h1>
<p>with parameters <var>obj</var> and <var>propertyName</var></p>
<p><span class="nt">AssignmentElement</span> <span style="font-family: Times New Roman"><sub><i>[Yield]</i></sub></span>
<b>:</b> <span class="nt">DestructuringAssignmentTarget</span> <span class="nt">Initializer</span><sub>opt</sub></p>
<ol class="proc">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <i>Initializer</i> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <i>DestructuringAssignmentTarget</i> is an <i>ObjectLiteral or an ArrayLiteral</i> then
<ol class="block">
<li>Let <i>AssignmentPattern</i> be the parse of the source code corresponding to
<i>DestructuringAssignmentTarget</i> using either <i>AssignmentPattern</i> or
<i>AssignmentPattern</i><sub>[Yield]</sub> as the goal symbol depending upon whether this
<i>AssignmentElement</i> has the <sub>Yield</sub> parameter.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return the result of performing DestructuringAssignmentEvaluation of <i>AssignmentPattern</i> with <i>v</i> as
the argument.</li>
</ol>
</li>
<li>Let <i>lref</i> be the result of evaluating <i>DestructuringAssignmentTarget</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lref</i>,<i>v</i>).</li>
</ol>
</section>
</section>
</section>
<section id="sec-comma-operator">
<div class="front">
<h1><span class="secnum" id="sec-12.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator" title="link to this section">12.15</a></span> Comma
Operator ( <span style="font-family: monospace">, )</span></h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Expression</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">Expression</span><sub>[?In, ?Yield]</sub> <code class="t">,</code> <span class="nt">AssignmentExpression</span><sub>[?In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-comma-operator-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-12.15.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition" title="link to this section">12.15.1</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp prod"><span class="nt">Expression</span> <span class="geq">:</span> <span class="nt">Expression</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget">
<h1><span class="secnum" id="sec-12.15.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isvalidsimpleassignmenttarget" title="link to this section">12.15.2</a></span> Static Semantics: IsValidSimpleAssignmentTarget</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isidentifierref">12.2.0.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isvalidsimpleassignmenttarget">12.2.10.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isidentifierref">12.3.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isvalidsimpleassignmenttarget">12.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isvalidsimpleassignmenttarget">12.5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isvalidsimpleassignmenttarget">12.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isvalidsimpleassignmenttarget">12.7.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-isvalidsimpleassignmenttarget">12.8.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isvalidsimpleassignmenttarget">12.9.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isvalidsimpleassignmenttarget">12.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isvalidsimpleassignmenttarget">12.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isvalidsimpleassignmenttarget">12.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isvalidsimpleassignmenttarget">12.13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isvalidsimpleassignmenttarget">12.14.3</a>.</p>
<div class="gp prod"><span class="nt">Expression</span> <span class="geq">:</span> <span class="nt">Expression</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-comma-operator-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-12.15.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-runtime-semantics-evaluation" title="link to this section">12.15.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">Expression</span> <span class="geq">:</span> <span class="nt">Expression</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>lref</i> be the result of evaluating <i>Expression</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>lref</i>))</li>
<li>Let <i>rref</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rref</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a> must be called even though its value is not used
because it may have observable side-effects.</p>
</div>
</section>
</section>
</section>
<section id="sec-ecmascript-language-statements-and-declarations">
<div class="front">
<h1><span class="secnum" id="sec-13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations" title="link to this section">13</a></span> ECMAScript Language: Statements and Declarations</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Statement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BlockStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">VariableStatement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">EmptyStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">IfStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">BreakableStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">ContinueStatement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">BreakStatement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="grhsannot">[+Return]</span> <span class="nt">ReturnStatement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">WithStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">LabelledStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">ThrowStatement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">TryStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">DebuggerStatement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Declaration</span><sub>[Yield, Default]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FunctionDeclaration</span><sub>[?Yield,?Default]</sub></div>
<div class="rhs"><span class="nt">GeneratorDeclaration</span><sub>[?Yield, ?Default]</sub></div>
<div class="rhs"><span class="nt">ClassDeclaration</span><sub>[?Yield,?Default]</sub></div>
<div class="rhs"><span class="nt">LexicalDeclaration</span><sub>[In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BreakableStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IterationStatement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">SwitchStatement</span><sub>[?Yield, ?Return]</sub></div>
</div>
</div>
<section id="sec-statement-semantics">
<div class="front">
<h1><span class="secnum" id="sec-13.0"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics" title="link to this section">13.0</a></span>
Statement Semantics</h1>
</div>
<section id="sec-statement-semantics-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.0.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames" title="link to this section">13.0.1</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">Statement</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">EmptyStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
<div class="rhs"><span class="nt">ContinueStatement</span></div>
<div class="rhs"><span class="nt">BreakStatement</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">ThrowStatement</span></div>
<div class="rhs"><span class="nt">DebuggerStatement</span></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-statement-semantics-runtime-semantics-labelledevaluation">
<h1><span class="secnum" id="sec-13.0.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation" title="link to this section">13.0.2</a></span> Runtime Semantics: LabelledEvaluation</h1>
<p>With argument <var>labelSet</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation">13.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation">13.6.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation">13.6.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation">13.6.4.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a>.</p>
<div class="gp prod"><span class="nt">BreakableStatement</span> <span class="geq">:</span> <span class="nt">IterationStatement</span></div>
<ol class="proc">
<li>Let <i>stmtResult</i> be the result of performing LabelledEvaluation of <i>IterationStatement</i> with argument
<i>labelSet</i>.</li>
<li>If <i>stmtResult</i>.[[type]] is <span style="font-family: sans-serif">break</span> and <i>stmtResult</i>.[[target]]
is <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>If <i>stmtResult</i>.[[value]] is <span style="font-family: sans-serif">empty</span>, then let <i>stmtResult</i>
be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
<li>Else, let <i>stmtResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>stmtResult</i>.[[value]])</li>
</ol>
</li>
<li>Return <i>stmtResult</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BreakableStatement</span> <span class="geq">:</span> <span class="nt">SwitchStatement</span></div>
<ol class="proc">
<li>Let <i>stmtResult</i> be the result of evaluating <i>SwitchStatement</i>.</li>
<li>If <i>stmtResult</i>.[[type]] is <span style="font-family: sans-serif">break</span> and <i>stmtResult</i>.[[target]]
is <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>If <i>stmtResult</i>.[[value]] is <span style="font-family: sans-serif">empty</span>, then let <i>stmtResult</i>
be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
<li>Else, let <i>stmtResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>stmtResult</i>.[[value]])</li>
</ol>
</li>
<li>Return <i>stmtResult</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> A <i>BreakableStatement</i> is one that can be exited via an unlabelled
<i>BreakStatement.</i></p>
</div>
</section>
<section id="sec-statement-semantics-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.0.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-evaluation" title="link to this section">13.0.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp">
<div class="lhs"><span class="nt">BreakableStatement</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IterationStatement</span></div>
<div class="rhs"><span class="nt">SwitchStatement</span></div>
</div>
<ol class="proc">
<li>Let <i>newLabelSet</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return the result of performing LabelledEvaluation of this <i>BreakableStatement</i> with argument
<i>newLabelSet</i>.</li>
</ol>
</section>
</section>
<section id="sec-block">
<div class="front">
<h1><span class="secnum" id="sec-13.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block" title="link to this section">13.1</a></span> Block</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">BlockStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Block</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Block</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <span class="nt">StatementList</span><sub>[?Yield, ?Return]</sub><sub>opt</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementList</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">StatementListItem</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">StatementList</span><sub>[?Yield, ?Return]</sub> <span class="nt">StatementListItem</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StatementListItem</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">Declaration</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-block-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-early-errors" title="link to this section">13.1.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">Block</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">StatementList</span> <code class="t">}</code></div>
<ul>
<li>
<p>It is a Syntax Error if the LexicallyDeclaredNames of <span class="nt">StatementList</span> contains any duplicate
entries.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the LexicallyDeclaredNames of <span class="nt">StatementList</span> also
occurs in the VarDeclaredNames of <span class="nt">StatementList</span>.</p>
</li>
</ul>
</section>
<section id="sec-block-static-semantics-lexicaldeclarations">
<h1><span class="secnum" id="sec-13.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicaldeclarations" title="link to this section">13.1.2</a></span> Static Semantics: LexicalDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicaldeclarations">13.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicaldeclarations">15.2.0.11</a>.</p>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be LexicalDeclarations of <i>StatementList</i>.</li>
<li>Append to <i>declarations</i> the elements of the LexicalDeclarations of <i>StatementListItem.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>Declaration</i>.</li>
</ol>
</section>
<section id="sec-block-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-13.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames" title="link to this section">13.1.3</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">Block</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be LexicallyDeclaredNames of <i>StatementList</i>.</li>
<li>Append to <i>names</i> the elements of the LexicallyDeclaredNames of <i>StatementListItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>Declaration</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-toplevellexicallydeclarednames">
<h1><span class="secnum" id="sec-13.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevellexicallydeclarednames" title="link to this section">13.1.4</a></span> Static Semantics: TopLevelLexicallyDeclaredNames</h1>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be TopLevelLexicallyDeclaredNames of <i>StatementList</i>.</li>
<li>Append to <i>names</i> the elements of the TopLevelLexicallyDeclaredNames of <i>StatementListItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">FunctionDeclaration</span></span> , then return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">GeneratorDeclaration</span></span> , then return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return the BoundNames of <i>Declaration</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> At the top level of a function, or script, function declarations are treated like var
declarations rather than like lexical declarations.</p>
</div>
</section>
<section id="sec-static-semantics-toplevellexicallyscopeddeclarations">
<h1><span class="secnum" id="sec-13.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevellexicallyscopeddeclarations" title="link to this section">13.1.5</a></span> Static Semantics: TopLevelLexicallyScopedDeclarations</h1>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be TopLevelLexicallyScopedDeclarations of <i>StatementList</i>.</li>
<li>Append to <i>declarations</i> the elements of the TopLevelLexicallyScopedDeclarations of
<i>StatementListItem.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">FunctionDeclaration</span></span> , then return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">GeneratorDeclaration</span></span> , then return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>Declaration</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-toplevelvardeclarednames">
<h1><span class="secnum" id="sec-13.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevelvardeclarednames" title="link to this section">13.1.6</a></span> Static Semantics: TopLevelVarDeclaredNames</h1>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be TopLevelVarDeclaredNames of <i>StatementList</i>.</li>
<li>Append to <i>names</i> the elements of the TopLevelVarDeclaredNames of <i>StatementListItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">FunctionDeclaration</span></span> , then return the LexicallyDeclaredNames of <i>Declaration</i>.</li>
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">GeneratorDeclaration</span></span> , then return the LexicallyDeclaredNames of <i>Declaration</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return VarDeclaredNames of <i>Statement</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> At the top level of a function or script, inner function declarations are treated like var
declarations.</p>
</div>
</section>
<section id="sec-static-semantics-toplevelvarscopeddeclarations">
<h1><span class="secnum" id="sec-13.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-toplevelvarscopeddeclarations" title="link to this section">13.1.7</a></span> Static Semantics: TopLevelVarScopedDeclarations</h1>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be TopLevelVarScopedDeclarations of <i>StatementList</i>.</li>
<li>Append to <i>declarations</i> the elements of the TopLevelVarScopedDeclarations of <i>StatementListItem.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>If <i>Statement</i> is <span class="prod"><span class="nt">Statement</span> <span class="geq">:</span> <span class="nt">VariableStatement</span></span> , then return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>VariableStatement</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">FunctionDeclaration</span></span> , then return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>FunctionDeclaration</i>.</li>
<li>If <i>Declaration</i> is <span class="prod"><span class="nt">Declaration</span> <span class="geq">:</span> <span class="nt">GeneratorDeclaration</span></span> , then return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>GeneratorDeclaration</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-block-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames" title="link to this section">13.1.8</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">Block</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of <i>StatementList</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>StatementListItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-block-static-semantics-varscopeddeclarations">
<h1><span class="secnum" id="sec-13.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-varscopeddeclarations" title="link to this section">13.1.9</a></span> Static Semantics: VarScopedDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-varscopeddeclarations">15.1.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-varscopeddeclarations">15.2.0.14</a>.</p>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be VarScopedDeclarations of <i>StatementList</i>.</li>
<li>Append to <i>declarations</i> the elements of the VarScopedDeclarations of <i>StatementListItem.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Statement</span></div>
<ol class="proc">
<li>If <i>Statement</i> is <span class="prod"><span class="nt">Statement</span> <span class="geq">:</span> <span class="nt">VariableStatement</span></span> , then return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>VariableStatement</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-block-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-runtime-semantics-evaluation" title="link to this section">13.1.10</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">Block</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
<div class="gp prod"><span class="nt">Block</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">StatementList</span> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>blockEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>oldEnv</i>).</li>
<li>Perform Block Declaration Instantiation using <i>StatementList</i> and <i>blockEnv</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>blockEnv</i>.</li>
<li>Let <i>blockValue</i> be the result of evaluating <i>StatementList</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li>If <i>blockValue</i>.[[type]] is <span style="font-family: sans-serif">normal</span> and <i>blockValue</i>.[[value]]
is <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
<li>Return <i>blockValue</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> No matter how control leaves the <i>Block</i> the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> is always restored to its former state.</p>
</div>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>sl</i> be the result of evaluating <i>StatementList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>sl</i>).</li>
<li>Let <i>s</i> be the result of evaluating <i>StatementListItem</i>.</li>
<li>If <i>s</i>.[[type]] is <span style="font-family: sans-serif">throw</span>, return <i>s</i>.</li>
<li>If <i>s</i>.[[value]] is <span style="font-family: sans-serif">empty</span>, let <i>V</i> = <i>sl</i>.[[value]],
otherwise let <i>V</i> = <i>s</i>.[[value]].</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>s</i>.[[type]], [[value]]:
<i>V</i>, [[target]]: <i>s</i>.[[target]]}.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Steps 5 and 6 of the above algorithm ensure that the value of a <i>StatementList</i> is
the value of the last value producing <i>Statement</i> in the <i>StatementList</i>. For example, the following calls to
the <code>eval</code> function all return the value 1:</p>
<pre>eval("1;;;;;")</pre>
<pre>eval("1;{}")</pre>
<pre>eval("1;var a;")</pre>
</div>
</section>
<section id="sec-runtime-semantics-block-declaration-instantiation">
<h1><span class="secnum" id="sec-13.1.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-block-declaration-instantiation" title="link to this section">13.1.11</a></span> Runtime Semantics: Block Declaration Instantiation</h1>
<div class="note">
<p><span class="nh">NOTE</span> When a <span class="nt">Block</span> or <span class="nt">CaseBlock</span> production is
evaluated a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">Declarative Environment Record</a> is created and bindings
for each block scoped variable, constant, or function declarated in the block are instantiated in the environment
record.</p>
</div>
<p>Block Declaration Instantiation is performed as follows using arguments <var>code</var> and <var>env</var>.
<var>code</var> is the grammar production corresponding to the body of the block. <var>env</var> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> in which bindings are to be created.</p>
<ol class="proc">
<li>Let <i>declarations</i> be the LexicalDeclarations of <i>code</i>.</li>
<li>Let <i>functionsToInitialize</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each element <i>d</i> in <i>declarations</i> do
<ol class="block">
<li>For each element <i>dn</i> of the BoundNames of <i>d</i> do
<ol class="block">
<li>If IsConstantDeclaration of <i>d</i> is <b>true</b>, then
<ol class="block">
<li>Call <i>env</i>’s CreateImmutableBinding concrete method passing <i>dn</i> as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env</i>’s CreateMutableBinding concrete method passing
<i>dn</i> and <b>false</b> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>d</i> is a <i>GeneratorDeclaration</i> production or a <i>FunctionDeclaration</i> production, then
<ol class="block">
<li>Append <i>d</i> to <i>functionsToInitialize</i>.</li>
</ol>
</li>
</ol>
</li>
<li>For each production <i>f</i> in <i>functionsToInitialize</i>, in list order do
<ol class="block">
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>f.</i></li>
<li>Let <i>fo</i> be the result of performing InstantiateFunctionObject for <i>f</i> with argument <i>env</i>.</li>
<li>Call <i>env</i>’s InitializeBinding concrete method passing <i>fn</i>, and <i>fo</i> as the arguments.</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-declarations-and-the-variable-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarations-and-the-variable-statement" title="link to this section">13.2</a></span> Declarations and the Variable Statement</h1>
</div>
<section id="sec-let-and-const-declarations">
<div class="front">
<h1><span class="secnum" id="sec-13.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations" title="link to this section">13.2.1</a></span> Let and Const Declarations</h1>
<div class="note">
<p><span class="nh">NOTE</span> A <code>let</code> and <code>const</code> declarations define variables that are scoped
to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>. The variables are created when their containing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> is instantiated but may not be accessed in any way until the
variable’s <span class="nt">LexicalBinding</span> is evaluated. A variable defined by a <span class="nt">LexicalBinding</span> with an <span class="nt">Initializer</span> is assigned the value of its <span style="font-family: Times New Roman"><i>Initializer</i>’s</span> <span class="nt">AssignmentExpression</span> when
the <span class="nt">LexicalBinding</span> is evaluated, not when the variable is created. If a <span class="nt">LexicalBinding</span> in a <code>let</code> declaration does not have an <span class="nt">Initializer</span>
the variable is assigned the value <b>undefined</b> when the <span class="nt">LexicalBinding</span> is evaluated.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">LexicalDeclaration</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LetOrConst</span> <span class="nt">BindingList</span><sub>[?In, ?Yield]</sub> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LetOrConst</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">let</code></div>
<div class="rhs"><code class="t">const</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingList</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LexicalBinding</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">BindingList</span><sub>[?In, ?Yield]</sub> <code class="t">,</code> <span class="nt">LexicalBinding</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LexicalBinding</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[?In, ?Yield]</sub><sub>opt</sub></div>
<div class="rhs"><span class="nt">BindingPattern</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[?In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-let-and-const-declarations-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-early-errors" title="link to this section">13.2.1.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">LexicalDeclaration</span> <span class="geq">:</span> <span class="nt">LetOrConst</span> <span class="nt">BindingList</span> <code class="t">;</code></div>
<ul>
<li>It is a Syntax Error if the BoundNames of <span class="nt">BindingList</span> contains <code>"let"</code>.</li>
<li>It is a Syntax Error if the BoundNames of <span class="nt">BindingList</span> contains any duplicate entries.</li>
</ul>
<div class="gp prod"><span class="nt">LexicalBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ul>
<li>
<p>It is a Syntax Error if <span class="nt">Initializer</span> is not present and IsConstantDeclaration of the <span class="nt">LexicalDeclaration</span> containing this production is <span class="value">true</span>.</p>
</li>
</ul>
</section>
<section id="sec-let-and-const-declarations-static-semantics-boundnames">
<h1><span class="secnum" id="sec-13.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames" title="link to this section">13.2.1.2</a></span> Static Semantics: BoundNames</h1>
<p>See also:, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">LexicalDeclaration</span> <span class="geq">:</span> <span class="nt">LetOrConst</span> <span class="nt">BindingList</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingList</span> <span class="geq">:</span> <span class="nt">BindingList</span> <code class="t">,</code> <span class="nt">LexicalBinding</span></div>
<ol class="proc">
<li>Let <i>names</i> be the BoundNames of <i>BindingList</i>.</li>
<li>Append to <i>names</i> the elements of the BoundNames of <i>LexicalBinding.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LexicalBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LexicalBinding</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingPattern</i>.</li>
</ol>
</section>
<section id="sec-let-and-const-declarations-static-semantics-isconstantdeclaration">
<h1><span class="secnum" id="sec-13.2.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-isconstantdeclaration" title="link to this section">13.2.1.3</a></span> Static Semantics: IsConstantDeclaration</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey">14.4.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a>.</p>
<div class="gp prod"><span class="nt">LexicalDeclaration</span> <span class="geq">:</span> <span class="nt">LetOrConst</span> <span class="nt">BindingList</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return IsConstantDeclaration of <i>LetOrConst</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LetOrConst</span> <span class="geq">:</span> <code class="t">let</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">LetOrConst</span> <span class="geq">:</span> <code class="t">const</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-let-and-const-declarations-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.2.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-runtime-semantics-evaluation" title="link to this section">13.2.1.4</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">LexicalDeclaration</span> <span class="geq">:</span> <span class="nt">LetOrConst</span> <span class="nt">BindingList</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>next</i> be the result of evaluating <i>BindingList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">BindingList</span> <span class="geq">:</span> <span class="nt">BindingList</span> <code class="t">,</code> <span class="nt">LexicalBinding</span></div>
<ol class="proc">
<li>Let <i>next</i> be the result of evaluating <i>BindingList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Return the result of evaluating <i>LexicalBinding</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LexicalBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <b>undefined</b> and
<i>env</i> as the arguments.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> A static semantics rule ensures that this form of <span class="nt">LexicalBinding</span>
never occurs in a <code>const</code> declaration.</p>
</div>
<div class="gp prod"><span class="nt">LexicalBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Let <i>rhs</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rhs</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>Initializer)</i> is
<b>true</b>, then
<ol class="block">
<li>Let <i>hasNameProperty</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>value</i>,
<code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasNameProperty</i>).</li>
<li>If <i>hasNameProperty</i> is <b>false</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>value</i>,
StringValue(<i>BindingIdentifier</i>)).</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <i>value</i> and
<i>env</i> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">LexicalBinding</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Let <i>rhs</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rhs</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Return the result of performing BindingInitialization for <i>BindingPattern</i> using <i>value</i> and <i>env</i> as
the <i>arguments</i>.</li>
</ol>
</section>
</section>
<section id="sec-variable-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement" title="link to this section">13.2.2</a></span>
Variable Statement</h1>
<div class="note">
<p><span class="nh">NOTE</span> A <code>var</code> statement declares variables that are scoped to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a>. Var variables are created when their containing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> is instantiated and are initialized to <b>undefined</b> when
created. Within the scope of any VariableEnvironemnt a common <span class="nt">Identifier</span> may appear in more than
one <span class="nt">VariableDeclaration</span> but those declarations collective define only one variable. A variable
defined by a <span class="nt">VariableDeclaration</span> with an <span class="nt">Initializer</span> is assigned the
value of its <span style="font-family: Times New Roman"><i>Initializer</i>’s</span> <span class="nt">AssignmentExpression</span> when the <span class="nt">VariableDeclaration</span> is executed, not when the
variable is created.</p>
</div>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">VariableStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">var</code> <span class="nt">VariableDeclarationList</span><sub>[In, ?Yield]</sub> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclarationList</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">VariableDeclaration</span><sub>[?In, ?Yield]</sub></div>
<div class="rhs"><span class="nt">VariableDeclarationList</span><sub>[?In, ?Yield]</sub> <code class="t">,</code> <span class="nt">VariableDeclaration</span><sub>[?In, ?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">VariableDeclaration</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[?In, ?Yield]</sub><sub>opt</sub></div>
<div class="rhs"><span class="nt">BindingPattern</span><sub>[Yield]</sub> <span class="nt">Initializer</span><sub>[?In, ?Yield]</sub></div>
</div>
</div>
<section id="sec-variable-statement-static-semantics-boundnames">
<h1><span class="secnum" id="sec-13.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames" title="link to this section">13.2.2.1</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">VariableDeclarationList</span> <span class="geq">:</span> <span class="nt">VariableDeclarationList</span> <code class="t">,</code> <span class="nt">VariableDeclaration</span></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>VariableDeclarationList</i>.</li>
<li>Append to <i>names</i> the elements of BoundNames of <i>VariableDeclaration.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingPattern</i>.</li>
</ol>
</section>
<section id="sec-variable-statement-runtime-semantics-bindinginitialization">
<h1><span class="secnum" id="sec-13.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-bindinginitialization" title="link to this section">13.2.2.2</a></span> Runtime Semantics: BindingInitialization</h1>
<p>With arguments <var>value</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-bindinginitialization">12.2.4.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization">13.14.3</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> <b>undefined</b> is passed for <var>environment</var> to indicate that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
<code>var</code> statements formal parameter lists of non-strict functions. In those cases a lexical binding is hosted
and preinitialized prior to evaluation of its initializer.</p>
</div>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <i>value</i> and
<b>undefined</b> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <i>value</i> and
<b>undefined</b> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return the result of performing BindingInitialization for <i>BindingPattern</i> passing <i>value</i> and
<b>undefined</b> as the arguments.</li>
</ol>
</section>
<section id="sec-variable-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-evaluation" title="link to this section">13.2.2.3</a></span> <span style="font-family: sans-serif">Runtime</span> Semantics:
Evaluation</h1>
<div class="gp prod"><span class="nt">VariableStatement</span> <span class="geq">:</span> <code class="t">var</code> <span class="nt">VariableDeclarationList</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>next</i> be the result of evaluating <i>VariableDeclarationList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>( <span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclarationList</span> <span class="geq">:</span> <span class="nt">VariableDeclarationList</span> <code class="t">,</code> <span class="nt">VariableDeclaration</span></div>
<ol class="proc">
<li>Let <i>next</i> be the result of evaluating <i>VariableDeclarationList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Return the result of evaluating <i>VariableDeclaration</i>.</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Let <i>rhs</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rhs</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>Initializer)</i> is
<b>true</b>, then
<ol class="block">
<li>Let <i>hasNameProperty</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>value</i>,
<code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasNameProperty</i>).</li>
<li>If <i>hasNameProperty</i> is <b>false</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>value</i>,
StringValue(<i>BindingIdentifier</i>)).</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <i>value</i> and
<b>undefined</b> as the arguments.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE </span> If a <i>VariableDeclaration</i> is nested within a with statement and the
<i>Identifier</i> in the <i>VariableDeclaration</i> is the same as a property name of the binding object of the with
statement’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object environment record</a>, then step 3 will assign value
to the property instead of to the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> binding of the
<i>Identifier</i>.</p>
</div>
<div class="gp prod"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Let <i>rhs</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>rval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>rhs</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rval</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rval</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return the result of performing BindingInitialization for <i>BindingPattern</i> passing <i>rval</i> and
<b>undefined</b> as arguments.</li>
</ol>
</section>
</section>
<section id="sec-destructuring-binding-patterns">
<div class="front">
<h1><span class="secnum" id="sec-13.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns" title="link to this section">13.2.3</a></span> Destructuring Binding Patterns</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">BindingPattern</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ObjectBindingPattern</span><sub>[?Yield,?GeneratorParameter]</sub></div>
<div class="rhs"><span class="nt">ArrayBindingPattern</span><sub>[?Yield,?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ObjectBindingPattern</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">BindingPropertyList</span><sub>[?Yield,?GeneratorParameter]</sub> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">BindingPropertyList</span><sub>[?Yield,?GeneratorParameter]</sub> <code class="t">,</code> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ArrayBindingPattern</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span><sub>[?Yield, ?GeneratorParameter]</sub><sub>opt</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">BindingElementList</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">BindingElementList</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span><sub>[?Yield, ?GeneratorParameter]</sub><sub>opt</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingPropertyList</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingProperty</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
<div class="rhs"><span class="nt">BindingPropertyList</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">,</code> <span class="nt">BindingProperty</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingElementList</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingElisionElement</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
<div class="rhs"><span class="nt">BindingElementList</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">,</code> <span class="nt">BindingElisionElement</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingElisionElement</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingElement</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingProperty</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">SingleNameBinding</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
<div class="rhs"><span class="nt">PropertyName</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">:</code> <span class="nt">BindingElement</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingElement</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">SingleNameBinding</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
<div class="rhs"><span class="grhsannot">[+GeneratorParameter]</span> <span class="nt">BindingPattern</span><sub>[?Yield,GeneratorParameter]</sub> <span class="nt">Initializer</span><sub>[In]</sub><sub>opt</sub></div>
<div class="rhs"><span class="grhsannot">[~GeneratorParameter]</span> <span class="nt">BindingPattern</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[In, ?Yield]</sub><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SingleNameBinding</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[+GeneratorParameter]</span> <span class="nt">BindingIdentifier</span><sub>[Yield]</sub> <span class="nt">Initializer</span><sub>[In]</sub><sub>opt</sub></div>
<div class="rhs"><span class="grhsannot">[~GeneratorParameter]</span> <span class="nt">BindingIdentifier</span><sub>[?Yield]</sub> <span class="nt">Initializer</span><sub>[In, ?Yield]</sub><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">BindingRestElement</span><sub>[Yield, GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[+GeneratorParameter]</span> <code class="t">...</code> <span class="nt">BindingIdentifier</span><sub>[Yield]</sub></div>
<div class="rhs"><span class="grhsannot">[~GeneratorParameter]</span> <code class="t">...</code> <span class="nt">BindingIdentifier</span><sub>[?Yield]</sub></div>
</div>
</div>
<section id="sec-destructuring-binding-patterns-static-semantics-boundnames">
<h1><span class="secnum" id="sec-13.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-boundnames" title="link to this section">13.2.3.1</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">ObjectBindingPattern</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingRestElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingElementList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>BindingElementList</i>.</li>
<li>Append to <i>names</i> the elements of BoundNames of <i>BindingRestElement.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingPropertyList</span> <span class="geq">:</span> <span class="nt">BindingPropertyList</span> <code class="t">,</code> <span class="nt">BindingProperty</span></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>BindingPropertyList</i>.</li>
<li>Append to <i>names</i> the elements of BoundNames of <i>BindingProperty.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElementList</span> <span class="geq">:</span> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">BindingElisionElement</span></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>BindingElementList</i>.</li>
<li>Append to <i>names</i> the elements of BoundNames of <i>BindingElement.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElisionElement</span> <span class="geq">:</span> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Return BoundNames of <i>BindingElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingProperty</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingPattern</i>.</li>
</ol>
</section>
<section id="sec-destructuring-binding-patterns-static-semantics-containsexpression">
<h1><span class="secnum" id="sec-13.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-containsexpression" title="link to this section">13.2.3.2</a></span> Static Semantics: ContainsExpression</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-containsexpression">14.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-containsexpression">14.2.4</a>.</p>
<div class="gp prod"><span class="nt">ObjectBindingPattern</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<ol class="proc">
<li>Return ContainsExpression of <i>BindingElementList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>Return ContainsExpression of <i>BindingElementList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingPropertyList</span> <span class="geq">:</span> <span class="nt">BindingPropertyList</span> <code class="t">,</code> <span class="nt">BindingProperty</span></div>
<ol class="proc">
<li>Let <i>has</i> be ContainsExpression of <i>BindingPropertyList</i>.</li>
<li>If <i>has</i> is <b>true</b>, return <b>true</b><i>.</i></li>
<li>Return ContainsExpression of <i>BindingProperty</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElementList</span> <span class="geq">:</span> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">BindingElisionElement</span></div>
<ol class="proc">
<li>Return ContainsExpression of <i>BindingElementList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElisionElement</span> <span class="geq">:</span> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Return ContainsExpression of <i>BindingElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingProperty</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Let <i>has</i> be IsComputedPropertyKey of <i>PropertyName</i>.</li>
<li>If <i>has</i> is <b>true</b>, return <b>true</b><i>.</i></li>
<li>Return the ContainsExpression of <i>BindingElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-destructuring-binding-patterns-static-semantics-hasinitializer">
<h1><span class="secnum" id="sec-13.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-hasinitializer" title="link to this section">13.2.3.3</a></span> Static Semantics: HasInitializer</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-hasinitializer">13.2.3.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasinitializer">14.1.7</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasinitializer">14.2.7</a>.</p>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">
<h1><span class="secnum" id="sec-13.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist" title="link to this section">13.2.3.4</a></span> Static Semantics: IsSimpleParameterList</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname">14.2.8</a>.</p>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-destructuring-binding-patterns-runtime-semantics-bindinginitialization">
<h1><span class="secnum" id="sec-13.2.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-runtime-semantics-bindinginitialization" title="link to this section">13.2.3.5</a></span> Runtime Semantics: BindingInitialization</h1>
<p>With parameters <var>value</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-bindinginitialization">12.2.4.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-bindinginitialization">13.2.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization">13.14.3</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> When <b>undefined</b> is passed for <var>environment</var> it indicates that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order
to deal with the possibility of multiple parameters with the same name.</p>
</div>
<div class="gp prod"><span class="nt">BindingPattern</span> <span class="geq">:</span> <span class="nt">ObjectBindingPattern</span></div>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object</li>
<li>Return the result of performing BindingInitialization for <i>ObjectBindingPattern</i> using <i>value</i> and
<i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingPattern</span> <span class="geq">:</span> <span class="nt">ArrayBindingPattern</span></div>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Return the result of performing IteratorBindingInitialization for <i>ArrayBindingPattern</i> using <i>iterator</i>,
and <i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">ObjectBindingPattern</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">BindingPropertyList</span> <span class="geq">:</span> <span class="nt">BindingPropertyList</span> <code class="t">,</code> <span class="nt">BindingProperty</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing BindingInitialization for <i>BindingPropertyList</i> using
<i>value</i> and <i>environment</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing BindingInitialization for <i>BindingProperty</i> using <i>value</i> and
<i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingProperty</span> <span class="geq">:</span> <span class="nt">SingleNameBinding</span></div>
<ol class="proc">
<li>Let <i>name</i> be the string that is the only element of BoundNames of <i>SingleNameBinding</i>.</li>
<li>Return the result of performing KeyedBindingInitialization for <i>SingleNameBinding</i> using <i>value</i>,
<i>environment</i>, and <i>name</i> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingProperty</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Let <i>P</i> be the result of evaluating <i>PropertyName</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>Return the result of performing KeyedBindingInitialization for <i>BindingElement</i> using <i>value</i>,
<i>environment</i>, and <i>P</i> as arguments.</li>
</ol>
</section>
<section id="sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization">
<h1><span class="secnum" id="sec-13.2.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization" title="link to this section">13.2.3.6</a></span> Runtime Semantics: IteratorBindingInitialization</h1>
<p>With parameters <var>iterator,</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-iteratorbindinginitialization">14.1.20</a>, .</p>
<div class="note">
<p><span class="nh">NOTE</span> When <b>undefined</b> is passed for <var>environment</var> it indicates that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order
to deal with the possibility of multiple parameters with the same name.</p>
</div>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <code class="t">]</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span> <code class="t">]</code></div>
<ol class="proc">
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with <i>iterator</i> as
the argument.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>If <i>Elision</i> is present, then
<ol class="block">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return the result of performing IteratorBindingInitialization for <i>BindingRestElement</i> using <i>iterator</i>
and <i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">]</code></div>
<ol class="proc">
<li>Return the result of performing IteratorBindingInitialization for <i>BindingElementList</i> using <i>iterator</i>
and <i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <code class="t">]</code></div>
<ol class="proc">
<li>Return the result of performing IteratorBindingInitialization for <i>BindingElementList</i> using <i>iterator</i>
and <i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">Elision</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorBindingInitialization for <i>BindingElementList</i> using
<i>iterator</i> and <i>environment</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with <i>iterator</i> as
the argument.</li>
</ol>
<div class="gp prod"><span class="nt">ArrayBindingPattern</span> <span class="geq">:</span> <code class="t">[</code> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">BindingRestElement</span> <code class="t">]</code></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorBindingInitialization for <i>BindingElementList</i> using
<i>iterator</i> and <i>environment</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>Elision</i> is present, then
<ol class="block">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return the result of performing IteratorBindingInitialization for <i>BindingRestElement</i> using <i>iterator</i>
and <i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElementList</span> <span class="geq">:</span> <span class="nt">BindingElisionElement</span></div>
<ol class="proc">
<li>Return the result of performing IteratorBindingInitialization for <i>BindingElisionElement</i> using
<i>iterator</i> and <i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElementList</span> <span class="geq">:</span> <span class="nt">BindingElementList</span> <code class="t">,</code> <span class="nt">BindingElisionElement</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorBindingInitialization for <i>BindingElementList</i> iterator
and <i>environment</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing IteratorBindingInitialization for <i>BindingElement</i> using <i>iterator</i> and
<i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElisionElement</span> <span class="geq">:</span> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Return the result of performing IteratorBindingInitialization of <i>BindingElement</i> with <i>iterator</i> as the
argument.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElisionElement</span> <span class="geq">:</span> <span class="nt">Elision</span> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorDestructuringAssignmentEvaluation of <i>Elision</i> with
<i>iterator</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing IteratorBindingInitialization of <i>BindingElement</i> with <i>iterator</i> as the
argument.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">SingleNameBinding</span></div>
<ol class="proc">
<li>Return the result of performing IteratorBindingInitialization for <i>SingleNameBinding</i> using <i>iterator
and</i> <i>environment</i> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>v</i> be <b>undefined</b></li>
<li>Else
<ol class="block">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <i>Initializer</i> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>Initializer)</i> is
<b>true</b>, then
<ol class="block">
<li>Let <i>hasNameProperty</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>v</i>,
<code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasNameProperty</i>).</li>
<li>If <i>hasNameProperty</i> is <b>false</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>v</i>,
StringValue(<i>BindingIdentifier</i>)).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <i>v</i> and
<i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>v</i> be <b>undefined</b></li>
<li>Else
<ol class="block">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <i>Initializer</i> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Return the result of performing BindingInitialization of <i>BindingPattern</i> with <i>v</i> as the argument.</li>
</ol>
<div class="gp prod"><span class="nt">BindingRestElement</span> <span class="geq">:</span> <code class="t">...</code> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>n</i>=0.</li>
<li>Repeat,
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then
<ol class="block">
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> using <i>A</i> and
<i>environment</i> as arguments.</li>
</ol>
</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>n)</i>), <i>nextValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Increment <i>n</i> by 1.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-runtime-semantics-keyedbindinginitialization">
<h1><span class="secnum" id="sec-13.2.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-keyedbindinginitialization" title="link to this section">13.2.3.7</a></span> Runtime Semantics: KeyedBindingInitialization</h1>
<p>With parameters <var>obj</var>, <var>environment,</var> and <var>propertyName</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> When <b>undefined</b> is passed for <var>environment</var> it indicates that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order
to deal with the possibility of multiple parameters with the same name.</p>
</div>
<div class="gp prod"><span class="nt">BindingElement</span> <span class="geq">:</span> <span class="nt">BindingPattern</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>propertyName</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <i>Initializer</i> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Return the result of performing BindingInitialization for <i>BindingPattern</i> passing <i>v</i> and
<i>environment</i> as arguments.</li>
</ol>
<div class="gp prod"><span class="nt">SingleNameBinding</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span> <span class="nt">Initializer</span><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>propertyName</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <i>Initializer</i> is present and <i>v</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>defaultValue</i> be the result of evaluating <i>Initializer</i>.</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>defaultValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>Initializer</i>) is
<b>true</b>, then
<ol class="block">
<li>Let <i>hasNameProperty</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>v</i>,
<code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasNameProperty</i>).</li>
<li>If <i>hasNameProperty</i> is <b>false</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>v</i>,
StringValue(<i>BindingIdentifier</i>)).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> passing <i>v</i> and
<i>environment</i> as arguments.</li>
</ol>
</section>
</section>
</section>
<section id="sec-empty-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-empty-statement" title="link to this section">13.3</a></span> Empty
Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">EmptyStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">;</code></div>
</div>
</div>
<section id="sec-empty-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-empty-statement-runtime-semantics-evaluation" title="link to this section">13.3.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">EmptyStatement</span> <span class="geq">:</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>)<span style="font-family: sans-serif">.</span></li>
</ol>
</section>
</section>
<section id="sec-expression-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-expression-statement" title="link to this section">13.4</a></span>
Expression Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ExpressionStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[lookahead ∉ {<code class="t">{</code>, <code class="t">function</code>, <code class="t">class</code>, <code class="t">let [</code>}]</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">;</code></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> An <i>ExpressionStatement</i> cannot start with an opening curly brace because that might
make it ambiguous with a <i>Block</i>. Also, an <i>ExpressionStatement</i> cannot start with the <code>function</code> or
<code>class</code> keywords because that would make it ambiguous with a <i>FunctionDeclaration</i>, a
<i>GeneratorDeclaration</i>, or a <i>ClassDeclaration</i>. An <i>ExpressionStatement</i> cannot start with the two token
sequence <code>let [</code> because that would make it ambiguous with a <code>let</code> <i>LexicalDeclaration</i> whose
first <i>LexicalBinding</i> was an <i>ArrayBindingPattern</i>.</p>
</div>
</div>
<section id="sec-expression-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-expression-statement-runtime-semantics-evaluation" title="link to this section">13.4.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ExpressionStatement</span> <span class="geq">:</span> <span class="nt">Expression</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>value</i>).</li>
</ol>
</section>
</section>
<section id="sec-if-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement" title="link to this section">13.5</a></span> The <span style="font-family: monospace">if</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">IfStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub> <code class="t">else</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
</div>
<p>Each <code>else</code> for which the choice of associated <code>if</code> is ambiguous shall be associated with the
nearest possible <b>if</b> that would otherwise have no corresponding <code>else</code>.</p>
</div>
<section id="sec-if-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames" title="link to this section">13.5.1</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">IfStatement</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span> <code class="t">else</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of the first <i>Statement</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of the second <i>Statement.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IfStatement</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-if-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-runtime-semantics-evaluation" title="link to this section">13.5.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">IfStatement</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span> <code class="t">else</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exprValue</i>).</li>
<li>If <i>exprValue</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>stmtValue</i> be the result of evaluating the first <i>Statement</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>stmtValue</i> be the result of evaluating the second <i>Statement</i>.</li>
</ol>
</li>
<li>If <i>stmtValue</i>.[[type]] is <span style="font-family: sans-serif">normal</span> and <i>stmtValue</i>.[[value]] is
<span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
<li>Return <i>stmtValue</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IfStatement</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exprValue</i>).</li>
<li>If <i>exprValue</i> is <b>false</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>stmtValue</i> be the result of evaluating <i>Statement</i>.</li>
</ol>
</li>
<li>If <i>stmtValue</i>.[[type]] is <span style="font-family: sans-serif">normal</span> and <i>stmtValue</i>.[[value]] is
<span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</li>
<li>Return <i>stmtValue</i>.</li>
</ol>
</section>
</section>
<section id="sec-iteration-statements">
<div class="front">
<h1><span class="secnum" id="sec-13.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements" title="link to this section">13.6</a></span>
Iteration Statements</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">do</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <code class="t">;</code><sub>opt</sub></div>
<div class="rhs"><code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="grhsannot">[lookahead ∉ {<code class="t">let [</code>}]</span> <span class="nt">Expression</span><sub>[?Yield]</sub><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">VariableDeclarationList</span><sub>[?Yield]</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span><sub>[?Yield]</sub> <span class="nt">Expression</span><sub>[In, ?Yield]</sub><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="grhsannot">[lookahead ∉ {<code class="t">let [</code>}]</span> <span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <code class="t">in</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span><sub>[?Yield]</sub> <code class="t">in</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span><sub>[?Yield]</sub> <code class="t">in</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="grhsannot">[lookahead ∉ {<code class="t">let</code>}]</span> <span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub> <code class="t">of</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span><sub>[?Yield]</sub> <code class="t">of</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span><sub>[?Yield]</sub> <code class="t">of</code> <span class="nt">AssignmentExpression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ForDeclaration</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LetOrConst</span> <span class="nt">ForBinding</span><sub>[?Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE 1</span> <i>ForBinding</i> is defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension">12.2.4.2</a>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> A semicolon is not required after a <code>do-while</code> statement.</p>
</div>
</div>
<section id="sec-iteration-statements-semantics">
<div class="front">
<h1><span class="secnum" id="sec-13.6.0"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements-semantics" title="link to this section">13.6.0</a></span> Semantics</h1>
</div>
<section id="sec-loopcontinues">
<h1><span class="secnum" id="sec-13.6.0.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues" title="link to this section">13.6.0.1</a></span>
Runtime Semantics: LoopContinues(completion, labelSet)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">LoopContinues</span> with arguments
<var>completion</var> and <var>labelSet</var> is defined by the following step:</p>
<ol class="proc">
<li>If <i>completion</i>.[[type]] is <span style="font-family: sans-serif">normal</span>, then return <b>true</b>.</li>
<li>If <i>completion</i>.[[type]] is not <span style="font-family: sans-serif">continue</span>, then return
<b>false</b>.</li>
<li>If <i>completion</i>.[[target]] is <span style="font-family: sans-serif">empty</span>, then return <b>true</b>.</li>
<li>If <i>completion</i>.[[target]] is an element of <i>labelSet</i>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Within the <i>Statement</i> part of an <i>IterationStatement</i> a
<i>ContinueStatement</i> may be used to begin a new iteration.</p>
</div>
</section>
</section>
<section id="sec-do-while-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement" title="link to this section">13.6.1</a></span>
The <span style="font-family: monospace">do</span>-<span style="font-family: monospace">while</span> Statement</h1>
</div>
<section id="sec-do-while-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.6.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames" title="link to this section">13.6.1.1</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">do</code> <span class="nt">Statement</span> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <code class="t">;</code><sub>opt</sub></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-do-while-statement-runtime-semantics-labelledevaluation">
<h1><span class="secnum" id="sec-13.6.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation" title="link to this section">13.6.1.2</a></span> Runtime Semantics: LabelledEvaluation</h1>
<p>With argument <var>labelSet</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation">13.6.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation">13.6.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation">13.6.4.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">do</code> <span class="nt">Statement</span> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <code class="t">;</code><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>V</i> = undefined.</li>
<li>Repeat
<ol class="block">
<li>Let <i>stmt</i> be the result of evaluating <i>Statement</i>.</li>
<li>If <i>stmt</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, let <i>V</i> =
<i>stmt</i>.[[value]]<i>.</i></li>
<li>If <i>stmt</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a> (<i>stmt</i>,<i>labelSet</i>) is false, return <i>stmt</i>.</li>
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>)).</li>
<li>If <i>exprValue</i> is false, Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>Else if <i>exprValue</i> is not true, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>exprValue</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a> (<i>exprValue</i>,<i>labelSet</i>) is false, return
<i>exprValue.</i></li>
</ol>
</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-while-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement" title="link to this section">13.6.2</a></span> The
<span style="font-family: monospace">while</span> Statement</h1>
</div>
<section id="sec-while-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.6.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames" title="link to this section">13.6.2.1</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-while-statement-runtime-semantics-labelledevaluation">
<h1><span class="secnum" id="sec-13.6.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation" title="link to this section">13.6.2.2</a></span> Runtime Semantics: LabelledEvaluation</h1>
<p>With argument <var>labelSet</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation">13.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation">13.6.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation">13.6.4.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>V</i> = undefined.</li>
<li>Repeat
<ol class="block">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>)).</li>
<li>If <i>exprValue</i> is false, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>If <i>exprValue</i> is not true, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>exprValue</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a> (<i>exprValue</i>,<i>labelSet</i>) is false, return
<i>exprValue.</i></li>
</ol>
</li>
<li>Let <i>stmt</i> be the result of evaluating <i>Statement</i>.</li>
<li>If <i>stmt</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, let <i>V</i> =
<i>stmt</i>.[[value]].</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a> (<i>stmt</i>,<i>labelSet</i>) is false, return
<i>stmt</i>.</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-for-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement" title="link to this section">13.6.3</a></span> The
<span style="font-family: monospace">for</span> Statement</h1>
</div>
<section id="sec-for-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.6.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames" title="link to this section">13.6.3.1</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">VariableDeclarationList</span> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>VariableDeclarationList</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Statement.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-for-statement-runtime-semantics-labelledevaluation">
<h1><span class="secnum" id="sec-13.6.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation" title="link to this section">13.6.3.2</a></span> Runtime Semantics: LabelledEvaluation</h1>
<p>With argument <var>labelSet</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation">13.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation">13.6.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation">13.6.4.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>If the first <i>Expression</i> is present, then
<ol class="block">
<li>Let <i>exprRef</i> be the result of evaluating the first <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>exprValue</i>,<i>labelSet</i>) is <b>false</b>, return
<i>exprValue.</i></li>
</ol>
</li>
<li>Return the result of performing ForBodyEvaluation with the first <i>Expression</i> as the <i>testExpr</i> argument,
the second <i>Expression</i> as the <i>incrementExpr</i> argument, <i>Statement</i> as the <i>stmt</i> argument, ()
as the <i>perIterationBindings</i>, and with <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">VariableDeclarationList</span> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>varDcl</i> be the result of evaluating <i>VariableDeclarationList</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>varDcl</i>,<i>labelSet</i>) is <b>false</b>, return
<i>varDcl</i>.</li>
<li>Return the result of performing ForBodyEvaluation with the first <i>Expression</i> as the <i>testExpr</i> argument,
the second <i>Expression</i> as the <i>incrementExpr</i> argument, <i>Statement</i> as the <i>stmt</i> argument, ()
as the <i>perIterationBindings</i>, and with <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>loopEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>oldEnv</i>).</li>
<li>Let <i>isConst</i> be the result of performing IsConstantDeclaration of <i>LexicalDeclaration</i>.</li>
<li>Let <i>boundNames</i> be the BoundNames of <i>LexicalDeclaration</i>.</li>
<li>For each element <i>dn</i> of <i>boundNames</i> do
<ol class="block">
<li>If <i>isConst</i> is <b>true</b>, then
<ol class="block">
<li>Call <i>loopEnv</i>’s CreateImmutableBinding concrete method passing <i>dn</i> as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Call <i>loopEnv</i>’s CreateMutableBinding concrete method passing <i>dn</i> and <b>false</b> as the
arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call to CreateMutableBinding will never return an
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
</ol>
</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>loopEnv</i>.</li>
<li>Let <i>forDcl</i> be the result of evaluating <i>LexicalDeclaration</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>forDcl</i>,<i>labelSet</i>) is <b>false</b>, then
<ol class="block">
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li>Return <i>forDcl</i>.</li>
</ol>
</li>
<li>If <i>isConst</i> is <b>false</b>, let <i>perIterationLets</i> be <i>boundNames</i> otherwise let
<i>perInterationLets</i> be ( ).</li>
<li>Let <i>bodyResult</i> be the result of performing ForBodyEvaluation with the first <i>Expression</i> as the
<i>testExpr</i> argument, the second <i>Expression</i> as the <i>incrementExpr</i> argument, <i>Statement</i> as the
<i>stmt</i> argument, <i>perIterationLets</i> as the <i>perIterationBindings</i>, and with <i>labelSet</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li>Return <i>bodyResult</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-forbodyevaluation">
<h1><span class="secnum" id="sec-13.6.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forbodyevaluation" title="link to this section">13.6.3.3</a></span> Runtime Semantics: ForBodyEvaluation</h1>
<p>The abstract operation ForBodyEvaluation with arguments <var>testExpr</var>, <var>incrementExpr</var>, <var>stmt</var>,
<var>perIterationBindings</var>, and <var>labelSet</var> is performed as follows:</p>
<ol class="proc">
<li>Let <i>V</i> = <b>undefined</b>.</li>
<li>Let <i>status</i> be CreatePerIterationEnvironment(<i>perIterationBindings</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Repeat
<ol class="block">
<li>If <i>testExpr</i> is not [empty], then
<ol class="block">
<li>Let <i>testExprRef</i> be the result of evaluating <i>testExpr</i>.</li>
<li>Let <i>testExprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>testExprRef</i>))</li>
<li>If <i>testExprValue</i> is <b>false</b>, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a> (<i>testExprValue</i>,<i>labelSet</i>) is
<b>false</b>, return <i>testExprValue.</i></li>
</ol>
</li>
<li>Let <i>result</i> be the result of evaluating <i>stmt</i>.</li>
<li>If <i>result</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, let <i>V</i> =
<i>result</i>.[[value]].</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a> (<i>result</i>,<i>labelSet</i>) is <b>false</b>, return
<i>result</i>.</li>
<li>Let <i>status</i> be CreatePerIterationEnvironment(<i>perIterationBindings</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>incrementExpr</i> is not [empty], then
<ol class="block">
<li>Let <i>incExprRef</i> be the result of evaluating <i>incrementExpr</i>.</li>
<li>Let <i>incExprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>incExprRef</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>incExprValue</i>,<i>labelSet</i>) is <b>false</b>,
return <i>incExprValue.</i></li>
</ol>
</li>
</ol>
</li>
</ol>
</section>
<section id="sec-runtime-semantics-createperiterationenvironment">
<h1><span class="secnum" id="sec-13.6.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-createperiterationenvironment" title="link to this section">13.6.3.4</a></span> Runtime Semantics: CreatePerIterationEnvironment</h1>
<p>The abstract operation CreatePerIterationEnvironment with argument <var>perIterationBindings</var>, is performed as
follows:</p>
<ol class="proc">
<li>If <i>perIterationBindings</i> has any elements, then
<ol class="block">
<li>Let <i>lastIterationEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>outer</i> be <i>lastIterationEnv</i>’s <i>outer</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical
environment</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>outer</i> is not <b>null</b>.</li>
<li>Let <i>thisIterationEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>outer</i>).</li>
<li>For each element <i>bn</i> of <i>perIterationBindings</i> do,
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>thisIterationEnv</i>’s CreateMutableBinding concrete
method passing <i>bn</i> and <b>false</b> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Let <i>lastValue</i> be the result of calling <i>lastIterationEnv</i>’s GetBindingValue concrete
method passing <i>bn</i> and <b>true</b> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lastValue</i>).</li>
<li>Call the InitializeBinding concrete method of <i>thisIterationEnv</i> passing <i>bn</i> and <i>lastValue</i>
as the arguments.</li>
</ol>
</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>thisIterationEnv.</i></li>
</ol>
</li>
<li>Return <b>undefined</b></li>
</ol>
</section>
</section>
<section id="sec-for-in-and-for-of-statements">
<div class="front">
<h1><span class="secnum" id="sec-13.6.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements" title="link to this section">13.6.4</a></span> The <span style="font-family: monospace">for</span>-<span style="font-family: monospace">in</span> and <span style="font-family: monospace">for</span>-<span style="font-family:
monospace">of</span> Statements</h1>
</div>
<section id="sec-for-in-and-for-of-statements-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.6.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-early-errors" title="link to this section">13.6.4.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<ul>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is either an <span class="nt">ObjectLiteral</span> or an <span class="nt">ArrayLiteral</span> and if the lexical token sequence matched
by <span class="nt">LeftHandSideExpression</span> cannot be parsed with no tokens left over using <span class="nt">AssignmentPattern</span> as the goal symbol.</p>
</li>
<li>
<p>If <span class="nt">LeftHandSideExpression</span> is either an <span class="nt">ObjectLiteral</span> or an <span class="nt">ArrayLiteral</span> and if the lexical token sequence matched by <span class="nt">LeftHandSideExpression</span> can be parsed with no tokens left over using <span class="nt">AssignmentPattern</span> as the goal symbol then the following rules are not applied. Instead, the Early
Error rules for <span class="nt">AssignmentPattern</span> are used.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is a <span class="nt">IdentifierReference</span> that can be statically determined to always resolve to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarative-environment-records">declarative environment record</a> binding and the resolved binding is an
immutable binding.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">LeftHandSideExpression</span> is neither an <span class="nt">ObjectLiteral</span> nor an <span class="nt">ArrayLiteral</span> and <span style="font-family: Times New
Roman">IsValidSimpleAssignmentTarget</span> of <span class="nt">LeftHandSideExpression</span> is <span class="value">false</span>.</p>
</li>
<li>
<p>It is a Syntax Error if the <span class="nt">LeftHandSideExpression</span> is <span class="prod"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span> <span class="geq">:</span>
<code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></span> and <span class="nt">Expression</span> derives a production that would produce a Syntax Error according to these rules if that
production is substituted for <span class="nt">LeftHandSideExpression</span>. This rule is recursively applied.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The last rule means that the other rules are applied even if multiple levels of nested
parenthesizes surround <i>Expression</i>.</p>
</div>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<ul>
<li>
<p>It is a Syntax Error if the BoundNames of <span class="nt">ForDeclaration</span> contains <code>"let"</code>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <span class="nt">ForDeclaration</span> also occurs in the
VarDeclaredNames of <span class="nt">Statement</span>.</p>
</li>
</ul>
</section>
<section id="sec-for-in-and-for-of-statements-static-semantics-boundnames">
<h1><span class="secnum" id="sec-13.6.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames" title="link to this section">13.6.4.2</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">ForDeclaration</span> <span class="geq">:</span> <span class="nt">LetOrConst</span> <span class="nt">ForBinding</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>ForBinding</i>.</li>
</ol>
</section>
<section id="sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.6.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames" title="link to this section">13.6.4.3</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>names</i> be the BoundNames of <i>ForBinding</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Statement.</i></li>
<li>Return <i>names</i></li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>names</i> be the BoundNames of <i>ForBinding</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Statement.</i></li>
<li>Return <i>names</i></li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-bindinginstantiation">
<h1><span class="secnum" id="sec-13.6.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-bindinginstantiation" title="link to this section">13.6.4.4</a></span> Runtime Semantics: BindingInstantiation</h1>
<p>With arguments <var>value</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation">13.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation">13.6.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation">13.6.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a>.</p>
<div class="gp prod"><span class="nt">ForDeclaration</span> <span class="geq">:</span> <span class="nt">LetOrConst</span> <span class="nt">ForBinding</span></div>
<ol class="proc">
<li>For each element <i>name</i> of the BoundNames of <i>ForBinding</i> do
<ol class="block">
<li>If IsConstantDeclaration of <i>LetOrConst</i> is <b>true</b>, then
<ol class="block">
<li>Call <i>environment</i>’s CreateImmutableBinding concrete method with argument <i>name</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Call <i>environment</i>’s CreateMutableBinding concrete method with argument <i>name</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call to CreateMutableBinding will never return an
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of performing BindingInitialization for <i>ForBinding</i> passing <i>value</i> and
<i>environment</i> as the arguments.</li>
</ol>
</section>
<section id="sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation">
<h1><span class="secnum" id="sec-13.6.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation" title="link to this section">13.6.4.5</a></span> Runtime Semantics: LabelledEvaluation</h1>
<p>With argument <var>labelSet</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation">13.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation">13.6.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation">13.6.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation">13.12.3</a>.</p>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>keyResult</i> be the result of performing ForIn/OfExpressionEvaluation with <i>Expression</i>, <span style="font-family: sans-serif">enumerate</span>, and <i>labelSet</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keyResult</i>).</li>
<li>Return the result of performing ForIn/OfBodyEvaluation with <i>LeftHandSideExpression</i>, <i>Statement</i>,
<i>keyResult</i>, <span style="font-family: sans-serif">assignment</span>, and <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>keyResult</i> be the result of performing ForIn/OfExpressionEvaluation with <i>Expression</i>, <span style="font-family: sans-serif">enumerate</span>, and <i>labelSet</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keyResult</i>).</li>
<li>Return the result of performing ForIn/OfBodyEvaluation with <i>ForBinding</i>, <i>Statement</i>, <i>keyResult</i>,
<span style="font-family: sans-serif">varBinding</span>, and <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>keyResult</i> be the result of performing ForIn/OfExpressionEvaluation with <i>Expression</i>, <span style="font-family: sans-serif">enumerate</span>, and <i>labelSet</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keyResult</i>).</li>
<li>Return the result of performing ForIn/OfBodyEvaluation with <i>ForDeclaration</i>, <i>Statement</i>,
<i>keyResult</i>, <span style="font-family: sans-serif">lexicalBinding</span>, and <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>keyResult</i> be the result of performing ForIn/OfExpressionEvaluation with <i>AssignmentExpression</i>,
<span style="font-family: sans-serif">iterate</span>, and <i>labelSet</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keyResult</i>).</li>
<li>Return the result of performing ForIn/OfBodyEvaluation with <i>LeftHandSideExpression</i>, <i>Statement</i>,
<i>keyResult</i>, <span style="font-family: sans-serif">assignment</span>, and <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>keyResult</i> be the result of performing ForIn/OfExpressionEvaluation with <i>AssignmentExpression</i>,
<span style="font-family: sans-serif">iterate</span>, and <i>labelSet</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keyResult</i>).</li>
<li>Return the result of performing ForIn/OfBodyEvaluation with <i>ForBinding</i>, <i>Statement</i>, <i>keyResult</i>,
<span style="font-family: sans-serif">varBinding</span>, and <i>labelSet</i>.</li>
</ol>
<div class="gp prod"><span class="nt">IterationStatement</span> <span class="geq">:</span> <code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>keyResult</i> be the result of performing ForIn/OfExpressionEvaluation with <i>AssignmentExpression</i>,
<span style="font-family: sans-serif">iterate</span>, and <i>labelSet</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keyResult</i>).</li>
<li>Return the result of performing ForIn/OfBodyEvaluation with <i>ForDeclaration</i>, <i>Statement</i>,
<i>keyResult</i>, <span style="font-family: sans-serif">lexicalBinding</span>, and <i>labelSet</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-forin-div-ofexpressionevaluation-abstract-operation">
<h1><span class="secnum" id="sec-13.6.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofexpressionevaluation-abstract-operation" title="link to this section">13.6.4.6</a></span> Runtime Semantics: ForIn/OfExpressionEvaluation Abstract
Operation</h1>
<p>The abstract operation ForIn/OfExpressionEvaluation is called with arguments <var>expr</var>, <var>iterationKind</var>,
and <span style="font-family: Times New Roman"><i>labelSet</i>.</span> The value of <var>iterationKind</var> is either
<b>enumerate</b> or <b>iterate</b>.</p>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating the production that is <i>expr</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li>If <i>exprValue</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>,
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>exprValue</i>,<i>labelSet</i>) is <b>false</b>, then return
<i>exprValue</i>.</li>
<li>Else, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family: sans-serif">break</span>, [[value]]: <span style="font-family: sans-serif">empty,</span>
[[target]]: <span style="font-family: sans-serif">empty</span>}.</li>
</ol>
</li>
<li>If <i>exprValue</i>.[[value]] is <b>null</b> or <b>undefined</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">break</span>, [[value]]: <span style="font-family: sans-serif">empty,</span> [[target]]: <span style="font-family: sans-serif">empty</span>}.</li>
</ol>
</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>exprValue</i>).</li>
<li>If <i>iterationKind</i> is <span style="font-family: sans-serif">enumerate</span>, then
<ol class="block">
<li>Let <i>keys</i> be the result of calling the [[Enumerate]] internal method of <i>obj</i> with no arguments.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>iterationKind</i> is <span style="font-family:
sans-serif">iterate</span>.</li>
<li>Let <i>keys</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>obj</i>).</li>
</ol>
</li>
<li>If <i>keys</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>keys</i>,<i>labelSet</i>) is <b>false</b>, then return
<i>keys</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>keys</i>.[[type]] is <span style="font-family:
sans-serif">continue</span></li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">break</span>, [[value]]: <span style="font-family: sans-serif">empty</span>, [[target]]: <span style="font-family: sans-serif">empty</span>}.</li>
</ol>
</li>
<li>Return <i>keys</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-forin-div-ofbodyevaluation">
<h1><span class="secnum" id="sec-13.6.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofbodyevaluation" title="link to this section">13.6.4.7</a></span> Runtime Semantics: ForIn/OfBodyEvaluation</h1>
<p>The abstract operation ForIn/OfBodyEvaluation is called with arguments <var>lhs</var>, <var>stmt, keys,</var>
<var>lhsKind</var>, and <var>labelSet.</var> The value of <var>lhsKind</var> is either <b>assignment</b>,
<b>varBinding</b> or <b>lexicalBinding</b>.</p>
<ol class="proc">
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>V</i> = <b>undefined</b> .</li>
<li>Repeat
<ol class="block">
<li>Let <i>nextResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>keys</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextResult</i>).</li>
<li>If <i>nextResult</i> is <b>false</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>nextResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>If <i>lhsKind</i> is <span style="font-family: sans-serif">assignment</span>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>lhs</i> is a <i>LeftHandSideExpression</i>.</li>
<li>If <i>lhs</i> is neither an <i>ObjectLiteral</i> nor an <i>ArrayLiteral</i> then
<ol class="block">
<li>Let <i>lhsRef</i> be the result of evaluating <i>lhs</i> ( it may be evaluated repeatedly).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a>(<i>lhsRef</i>, <i>nextValue</i>).</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>assignmentPattern</i> be the parse of the source code corresponding to <i>lhs</i> using
<i>AssignmentPattern</i> as the goal symbol.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>nextValue</i>) is not Object, then throw
a <b>TypeError</b> exception.</li>
<li>Let <i>status</i> be the result of performing DestructuringAssignmentEvaluation of
<i>AssignmentPattern</i> using <i>nextValue</i> as the argument.</li>
</ol>
</li>
</ol>
</li>
<li>Else if <i>lhsKind</i> is <span style="font-family: sans-serif">varBinding</span>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>lhs</i> is a <i>ForBinding</i>.</li>
<li>Let <i>status</i> be the result of performing BindingInitialization for <i>lhs</i> passing <i>nextValue</i>
and <b>undefined</b> as the arguments.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>lhsKind</i> is <span style="font-family:
sans-serif">lexicalBinding</span>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>lhs</i> is a <i>ForDeclaration</i>.</li>
<li>Let <i>iterationEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>oldEnv</i>).</li>
<li>Perform BindingInstantiation for <i>lhs</i> passing <i>nextValue</i> and <i>iterationEnv</i> as
arguments.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>)</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>iterationEnv</i>.</li>
</ol>
</li>
<li>If <i>status</i>.[[type]] is <span style="font-family: sans-serif">normal</span>, then
<ol class="block">
<li>Let <i>status</i> be the result of evaluating <i>stmt</i>.</li>
<li>If <i>status</i>.[[type]] is <span style="font-family: sans-serif">normal</span> and <i>status</i>.[[value]]
is not <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>Let <i>V</i> = <i>status</i>.[[value]].</li>
</ol>
</li>
</ol>
</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loopcontinues">LoopContinues</a>(<i>status</i>,<i>labelSet</i>) is <b>false</b>, then return
<i>status</i>.</li>
</ol>
</li>
</ol>
</section>
</section>
</section>
<section id="sec-continue-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-continue-statement" title="link to this section">13.7</a></span> The
<span style="font-family: monospace">continue</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ContinueStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">continue</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">continue</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">LabelIdentifier</span><sub>[?Yield]</sub> <code class="t">;</code></div>
</div>
</div>
<section id="sec-continue-statement-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-continue-statement-static-semantics-early-errors" title="link to this section">13.7.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">ContinueStatement</span> <span class="geq">:</span> <code class="t">continue</code> <code class="t">;</code></div>
<ul>
<li>
<p>It is a Syntax Error if this production is not nested, directly or indirectly (but not crossing function boundaries),
within an <span class="nt">IterationStatement</span>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">ContinueStatement</span> <span class="geq">:</span> <code class="t">continue</code> <span class="nt">LabelIdentifier</span> <code class="t">;</code></div>
<ul>
<li>
<p>It is a Syntax Error if StringValue(<span class="nt">LabelIdentifier</span>) does not appear in the
<i>CurrentLabelSet</i> of an enclosing (but not crossing function boundaries) <i>IterationStatement</i>.</p>
</li>
</ul>
</section>
<section id="sec-continue-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.7.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-continue-statement-runtime-semantics-evaluation" title="link to this section">13.7.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ContinueStatement</span> <span class="geq">:</span> <code class="t">continue</code> <code class="t">;</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">continue</span>, [[value]]: <span style="font-family: sans-serif">empty</span>, [[target]]: <span style="font-family: sans-serif">empty</span>}.</li>
</ol>
<div class="gp prod"><span class="nt">ContinueStatement</span> <span class="geq">:</span> <code class="t">continue</code> <span class="nt">LabelIdentifier</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let label be the StringValue of <i>LabelIdentifier</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">continue</span>, [[value]]: <span style="font-family: sans-serif">empty</span>, [[target]]: label }.</li>
</ol>
</section>
</section>
<section id="sec-break-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-break-statement" title="link to this section">13.8</a></span> The <span style="font-family: monospace">break</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">BreakStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">break</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">break</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">LabelIdentifier</span><sub>[?Yield]</sub> <code class="t">;</code></div>
</div>
</div>
<section id="sec-break-statement-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-break-statement-static-semantics-early-errors" title="link to this section">13.8.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">BreakStatement</span> <span class="geq">:</span> <code class="t">break</code> <code class="t">;</code></div>
<ul>
<li>
<p>It is a Syntax Error if this production is not nested, directly or indirectly (but not crossing function boundaries),
within an <span class="nt">IterationStatement</span> or a <span class="nt">SwitchStatement</span>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">BreakStatement</span> <span class="geq">:</span> <code class="t">break</code> <span class="nt">LabelIdentifier</span> <code class="t">;</code></div>
<ul>
<li>
<p>It is a Syntax Error if StringValue(<span class="nt">LabelIdentifier</span>)does not appear in the
<i>CurrentLabelSet</i> of an enclosing (but not crossing function boundaries) <span class="nt">Statement</span>.</p>
</li>
</ul>
</section>
<section id="sec-break-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.8.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-break-statement-runtime-semantics-evaluation" title="link to this section">13.8.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">BreakStatement</span> <span class="geq">:</span> <code class="t">break</code> <code class="t">;</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">break</span>, [[value]]: <span style="font-family: sans-serif">empty</span>, [[target]]: <span style="font-family: sans-serif">empty</span>}.</li>
</ol>
<div class="gp prod"><span class="nt">BreakStatement</span> <span class="geq">:</span> <code class="t">break</code> <span class="nt">LabelIdentifier</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let label be the StringValue of <i>LabelIdentifier</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">break</span>, [[value]]: <span style="font-family: sans-serif">empty</span>, [[target]]: label }.</li>
</ol>
</section>
</section>
<section id="sec-return-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-return-statement" title="link to this section">13.9</a></span> The
<span style="font-family: monospace">return</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ReturnStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">return</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">return</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">;</code></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> A <code>return</code> statement causes a function to cease execution and return a value to
the caller. If <span class="nt">Expression</span> is omitted, the return value is <b>undefined</b>. Otherwise, the return
value is the value of <span class="nt">Expression</span>.</p>
</div>
</div>
<section id="sec-return-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.9.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-return-statement-runtime-semantics-evaluation" title="link to this section">13.9.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ReturnStatement</span> <span class="geq">:</span> <code class="t">return</code> <code class="t">;</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">return</span>, [[value]]: <b>undefined</b>, [[target]]: <span style="font-family:
sans-serif">empty</span>}.</li>
</ol>
<div class="gp prod"><span class="nt">ReturnStatement</span> <span class="geq">:</span> <code class="t">return</code> <span class="nt">Expression</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exprValue</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">return</span>, [[value]]: <i>exprValue</i>, [[target]]: <span style="font-family:
sans-serif">empty</span>}.</li>
</ol>
</section>
</section>
<section id="sec-with-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement" title="link to this section">13.10</a></span> The
<span style="font-family: monospace">with</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">WithStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">with</code> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The <code>with</code> statement adds an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records">object
environment record</a> for a computed object to the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>. It then executes a statement using this augmented <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a>. Finally, it restores the original <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a>.</p>
</div>
</div>
<section id="sec-with-statement-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.10.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-early-errors" title="link to this section">13.10.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">WithStatement</span> <span class="geq">:</span> <code class="t">with</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ul>
<li>
<p>It is a Syntax Error if the code that matches this production is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict
code</a>.</p>
</li>
</ul>
</section>
<section id="sec-with-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.10.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames" title="link to this section">13.10.2</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">WithStatement</span> <span class="geq">:</span> <code class="t">with</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-with-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.10.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-runtime-semantics-evaluation" title="link to this section">13.10.3</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">WithStatement</span> <span class="geq">:</span> <code class="t">with</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>val</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>val</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>newEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newobjectenvironment">NewObjectEnvironment</a>(<i>obj</i>, <i>oldEnv</i>).</li>
<li>Set the <i>withEnvironment</i> flag of <i>newEnv’s</i> environment record to <b>true</b>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>newEnv</i>.</li>
<li>Let <i>C</i> be the result of evaluating <i>Statement</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a> to <i>oldEnv</i>.</li>
<li>Return <i>C</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> No matter how control leaves the embedded <i>Statement</i>, whether normally or by some
form of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> or exception, the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> is always restored to its former state.</p>
</div>
</section>
</section>
<section id="sec-switch-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement" title="link to this section">13.11</a></span> The
<span style="font-family: monospace">switch</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">SwitchStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">switch</code> <code class="t">(</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">)</code> <span class="nt">CaseBlock</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CaseBlock</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <span class="nt">CaseClauses</span><sub>[?Yield, ?Return]</sub><sub>opt</sub> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">CaseClauses</span><sub>[?Yield, ?Return]</sub><sub>opt</sub> <span class="nt">DefaultClause</span><sub>[?Yield, ?Return]</sub> <span class="nt">CaseClauses</span><sub>[?Yield, ?Return]</sub><sub>opt</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CaseClauses</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">CaseClause</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><span class="nt">CaseClauses</span><sub>[?Yield, ?Return]</sub> <span class="nt">CaseClause</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CaseClause</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">case</code> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">:</code> <span class="nt">StatementList</span><sub>[?Yield, ?Return]</sub><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DefaultClause</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">default</code> <code class="t">:</code> <span class="nt">StatementList</span><sub>[?Yield, ?Return]</sub><sub>opt</sub></div>
</div>
</div>
<section id="sec-switch-statement-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.11.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-early-errors" title="link to this section">13.11.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span> <code class="t">}</code></div>
<ul>
<li>
<p>It is a Syntax Error if the LexicallyDeclaredNames of <span class="nt">CaseClauses</span> contains any duplicate
entries.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the LexicallyDeclaredNames of <span class="nt">CaseClauses</span> also occurs
in the VarDeclaredNames of <span class="nt">CaseClauses</span>.</p>
</li>
</ul>
</section>
<section id="sec-switch-statement-static-semantics-lexicaldeclarations">
<h1><span class="secnum" id="sec-13.11.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicaldeclarations" title="link to this section">13.11.2</a></span> Static Semantics: LexicalDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicaldeclarations">13.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicaldeclarations">15.2.0.11</a>.</p>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <span class="nt">DefaultClause</span> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<ol class="proc">
<li>If the first <i>CaseClauses</i> is present, let <i>declarations</i> be the LexicalDeclarations of the first
<i>CaseClauses</i>.</li>
<li>Else let <i>declarations</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Append to <i>declarations</i> the elements of the LexicalDeclarations of the <i>DefaultClause.</i></li>
<li>If the second <i>CaseClauses</i> is not present, return <i>declarations</i>.</li>
<li>Else return the result of appending to <i>declarations</i> the elements of the LexicalDeclarations of the second
<i>CaseClauses</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClauses</span> <span class="geq">:</span> <span class="nt">CaseClauses</span> <span class="nt">CaseClause</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be LexicalDeclarations of <i>CaseClauses</i>.</li>
<li>Append to <i>declarations</i> the elements of the LexicalDeclarations of <i>CaseClause.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If the <i>StatementList</i> is present, return the LexicalDeclarations of <i>StatementList</i>.</li>
<li>Else return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<p>DefaultClause <code>: default :</code> StatementList<sub>opt</sub></p>
<ol class="proc">
<li>If the <i>StatementList</i> is present, return the LexicalDeclarations of <i>StatementList</i>.</li>
<li>Else return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-switch-statement-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-13.11.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames" title="link to this section">13.11.3</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <span class="nt">DefaultClause</span> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<ol class="proc">
<li>If the first <i>CaseClauses</i> is present, let <i>names</i> be the LexicallyDeclaredNames of the first
<i>CaseClauses</i>.</li>
<li>Else let <i>names</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Append to <i>names</i> the elements of the LexicallyDeclaredNames of the <i>DefaultClause.</i></li>
<li>If the second <i>CaseClauses</i> is not present, return <i>names</i>.</li>
<li>Else return the result of appending to <i>names</i> the elements of the LexicallyDeclaredNames of the second
<i>CaseClauses</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClauses</span> <span class="geq">:</span> <span class="nt">CaseClauses</span> <span class="nt">CaseClause</span></div>
<ol class="proc">
<li>Let <i>names</i> be LexicallyDeclaredNames of <i>CaseClauses</i>.</li>
<li>Append to <i>names</i> the elements of the LexicallyDeclaredNames of <i>CaseClause.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If the <i>StatementList</i> is present, return the LexicallyDeclaredNames of <i>StatementList</i>.</li>
<li>Else return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">DefaultClause</span> <span class="geq">:</span> <code class="t">default</code> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If the <i>StatementList</i> is present, return the LexicallyDeclaredNames of <i>StatementList</i>.</li>
<li>Else return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-switch-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.11.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames" title="link to this section">13.11.4</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<p><span class="prod"><span class="nt">SwitchStatement</span> <span class="geq">:</span> <code class="t">switch</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></span> CaseBlock</p>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>CaseBlock</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <span class="nt">DefaultClause</span> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<ol class="proc">
<li>If the first <i>CaseClauses</i> is present, let <i>names</i> be the VarDeclaredNames of the first
<i>CaseClauses</i>.</li>
<li>Else let <i>names</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of the <code>DefaultClause</code><i>.</i></li>
<li>If the second <i>CaseClauses</i> is not present, return <i>names</i>.</li>
<li>Else return the result of appending to <i>names</i> the elements of the VarDeclaredNames of the second
<i>CaseClauses</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClauses</span> <span class="geq">:</span> <span class="nt">CaseClauses</span> <span class="nt">CaseClause</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of <i>CaseClauses</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>CaseClause.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If the <i>StatementList</i> is present, return the VarDeclaredNames of <i>StatementList</i>.</li>
<li>Else return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">DefaultClause</span> <span class="geq">:</span> <code class="t">default</code> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If the <i>StatementList</i> is present, return the VarDeclaredNames of <i>StatementList</i>.</li>
<li>Else return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-caseblockevaluation">
<h1><span class="secnum" id="sec-13.11.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-caseblockevaluation" title="link to this section">13.11.5</a></span> Runtime Semantics: CaseBlockEvaluation</h1>
<p>With argument <var>input</var>.</p>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>V</i> = <b>undefined</b>.</li>
<li>Let <i>A</i> be the list of <i>CaseClause</i> items in source text order.</li>
<li>Let <i>searching</i> be <b>true</b>.</li>
<li>Repeat, while <i>searching</i> is <b>true</b>
<ol class="block">
<li>Let <i>C</i> be the next <i>CaseClause</i> in <i>A</i>. If there is no such <i>CaseClause</i>, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>Let <i>clauseSelector</i> be the result of CaseSelectorEvaluation of <i>C</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>clauseSelector</i>).</li>
<li>Let <i>matched</i> be the result of performing Strict Equality Comparison <i>input</i> ===
<i>clauseSelector</i>.</li>
<li>If <i>matched</i> is <b>true</b>, then
<ol class="block">
<li>Set <i>searching</i> to <b>false</b>.</li>
<li>If <i>C</i> has a <i>StatementList</i>, then
<ol class="block">
<li>Let <i>V</i> be the result of evaluating <i>C</i>’s <i>StatementList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>V</i>).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Repeat
<ol class="block">
<li>Let <i>C</i> be the next <i>CaseClause</i> in <i>A</i>. If there is no such <code>CaseClause</code>, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>If <i>C</i> has a <i>StatementList</i>, then
<ol class="block">
<li>Let <i>R</i> be the result of evaluating <i>C</i>’s <i>StatementList</i>.</li>
<li>If <i>R</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, then let <i>V</i> =
<i>R</i>.[[value]].</li>
<li>If <i>R</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>R</i>.[[type]], [[value]]:
<i>V</i>, [[target]]: <i>R</i>.[[target]]}.</li>
</ol>
</li>
</ol>
</li>
</ol>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <span class="nt">DefaultClause</span> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>V</i> = <b>undefined</b>.</li>
<li>Let <i>A</i> be the list of <i>CaseClause</i> items in the first <i>CaseClauses</i>, in source text order.</li>
<li>Let <i>found</i> be <b>false</b>.</li>
<li>Repeat letting <i>C</i> be in order each <i>CaseClause</i> in <i>A</i>
<ol class="block">
<li>If <i>found</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>clauseSelector</i> be the result of CaseSelectorEvaluation of <i>C</i>.</li>
<li>If <i>clauseSelector</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <i>clauseSelector</i>.[[value]] is <span style="font-family: sans-serif">empty</span>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>clauseSelector</i>.[[type]],
[[value]]: <b>undefined</b>, [[target]]: <i>clauseSelector</i>.[[target]]}.</li>
<li>Else, return <i>clauseSelector</i>.</li>
</ol>
</li>
<li>Let <i>found</i> be the result of performing Strict Equality Comparison <i>input</i> ===
<i>clauseSelector</i>.</li>
</ol>
</li>
<li>If <i>found</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>R</i> be the result of evaluating <i>CaseClause</i> <i>C</i>.</li>
<li>If <i>R</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, then let <i>V</i> =
<i>R</i>.[[value]].</li>
<li>If <i>R</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>R</i>.[[type]], [[value]]:
<i>V</i>, [[target]]: <i>R</i>.[[target]]}.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>foundInB</i> be <b>false</b>.</li>
<li>If <i>found</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>B</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the <i>CaseClause</i>
items in the second <i>CaseClauses</i>, in source text order.</li>
<li>Repeat, letting <i>C</i> be in order each <i>CaseClause</i> in <i>B</i>
<ol class="block">
<li>If <i>foundInB</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>clauseSelector</i> be the result of CaseSelectorEvaluation of <i>C</i>.</li>
<li>If <i>clauseSelector</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>,
then
<ol class="block">
<li>If <i>clauseSelector</i>.[[value]] is <span style="font-family: sans-serif">empty</span>, then return
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]:
<i>clauseSelector</i>.[[type]], [[value]]: <b>undefined</b>, [[target]]:
<i>clauseSelector</i>.[[target]]}.</li>
<li>Else, return <i>clauseSelector</i>.</li>
</ol>
</li>
<li>Let <i>foundInB</i> be the result of performing Strict Equality Comparison <i>input</i> ===
<i>clauseSelector</i>.</li>
</ol>
</li>
<li>If <i>foundInB</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>R</i> be the result of evaluating <i>CaseClause C</i>.</li>
<li>If <i>R</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, then let <i>V</i> =
<i>R</i>.[[value]].</li>
<li>If <i>R</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then return
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>R</i>.[[type]], [[value]]:
<i>V</i>, [[target]]: <i>R</i>.[[target]]}.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>foundInB</i> is <b>true</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
<li>Let <i>R</i> be the result of evaluating <i>DefaultClause</i>.</li>
<li>If <i>R</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, then let <i>V</i> =
<i>R</i>.[[value]].</li>
<li>If <i>R</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>R</i>.[[type]], [[value]]: <i>V</i>,
[[target]]: <i>R</i>.[[target]]}.</li>
<li>Let <i>B</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the <i>CaseClause</i>
items in the second <i>CaseClauses</i>, in source text order.</li>
<li>Repeat, letting <i>C</i> be in order each <i>CaseClause</i> in <i>B</i> (NOTE this is another complete iteration of
the second <i>CaseClauses</i>)
<ol class="block">
<li>Let <i>R</i> be the result of evaluating <i>CaseClause</i> <i>C</i>.</li>
<li>If <i>R</i>.[[value]] is not <span style="font-family: sans-serif">empty</span>, then let <i>V</i> =
<i>R</i>.[[value]].</li>
<li>If <i>R</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <i>R</i>.[[type]], [[value]]: <i>V</i>,
[[target]]: <i>R</i>.[[target]]}.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>V</i>).</li>
</ol>
</section>
<section id="sec-runtime-semantics-caseselectorevaluation">
<h1><span class="secnum" id="sec-13.11.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-caseselectorevaluation" title="link to this section">13.11.6</a></span> Runtime Semantics: CaseSelectorEvaluation</h1>
<div class="gp prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> CaseSelectorEvaluation does not execute the associated <i>StatementList</i>. It simply
evaluates the <i>Expression</i> and returns the value, which the <i>CaseBlock</i> algorithm uses to determine which
<i>StatementList</i> to start executing.</p>
</div>
</section>
<section id="sec-switch-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.11.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-runtime-semantics-evaluation" title="link to this section">13.11.7</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">SwitchStatement</span> <span class="geq">:</span> <code class="t">switch</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">CaseBlock</span></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>switchValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>switchValue</i>).</li>
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>blockEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>oldEnv</i>).</li>
<li>Perform Block Declaration Instantiation(<i>CaseBlock,</i> <i>blockEnv</i>).</li>
<li>Let <i>R</i> be the result of performing CaseBlockEvaluation of <i>CaseBlock</i> with argument
<i>switchValue</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li>Return <i>R</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> No matter how control leaves the <i>SwitchStatement</i> the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> is always restored to its former state.</p>
</div>
<div class="gp prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return the result of evaluating <i>StatementList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">DefaultClause</span> <span class="geq">:</span> <code class="t">default</code> <code class="t">:</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">DefaultClause</span> <span class="geq">:</span> <code class="t">default</code> <code class="t">:</code> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return the result of evaluating <i>StatementList</i>.</li>
</ol>
</section>
</section>
<section id="sec-labelled-statements">
<div class="front">
<h1><span class="secnum" id="sec-13.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements" title="link to this section">13.12</a></span>
Labelled Statements</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">LabelledStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LabelIdentifier</span><sub>[?Yield]</sub> <code class="t">:</code> <span class="nt">Statement</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> A <span class="nt">Statement</span> may be prefixed by a label. Labelled statements are
only used in conjunction with labelled <code>break</code> and <code>continue</code> statements. ECMAScript has no
<code>goto</code> statement. A <span class="nt">Statement</span> can be part of a <span class="nt">LabelledStatement</span>, which itself can be part of a <span class="nt">LabelledStatement</span>, and so on.
The labels introduced this way are collectively referred to as the “current label set” when describing the
semantics of individual statements. A <span class="nt">LabelledStatement</span> has no semantic meaning other than the
introduction of a label to a <i>label set</i>. The label set of an <span class="nt">IterationStatement</span> or a <span class="nt">SwitchStatement</span> initially contains the single element <b>empty</b>. The label set of any other statement
is initially empty.</p>
</div>
</div>
<section id="sec-labelled-statements-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.12.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-early-errors" title="link to this section">13.12.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">LabelledStatement</span> <span class="geq">:</span> <span class="nt">LabelIdentifier</span> <code class="t">:</code> <span class="nt">Statement</span></div>
<ul>
<li>
<p>It is a Syntax Error if a <span class="nt">LabelledStatement</span> is directly or indirectly enclosed by a <span class="nt">LabelledStatement</span> and the StringValue of this <span class="nt">LabelIdentifier</span> is the same as
the StringValue of the <span class="nt">LabelIdentifier</span> of the enclosing <span class="nt">LabelledStatement</span>. This does not apply to a <span class="nt">LabelledStatement</span> appearing within
a <span class="nt">FunctionBody</span> and a <span class="nt">LabelledStatement</span> that indirectly encloses the
<span class="nt">FunctionBody</span> .</p>
</li>
</ul>
</section>
<section id="sec-labelled-statements-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.12.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames" title="link to this section">13.12.2</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">LabelledStatement</span> <span class="geq">:</span> <span class="nt">LabelIdentifier</span> <code class="t">:</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Statement</i>.</li>
</ol>
</section>
<section id="sec-labelled-statements-runtime-semantics-labelledevaluation">
<div class="front">
<h1><span class="secnum" id="sec-13.12.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-runtime-semantics-labelledevaluation" title="link to this section">13.12.3</a></span> Runtime Semantics: LabelledEvaluation</h1>
<p>With argument <var>labelSet</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-runtime-semantics-labelledevaluation">13.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-runtime-semantics-labelledevaluation">13.6.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-runtime-semantics-labelledevaluation">13.6.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-runtime-semantics-labelledevaluation">13.6.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation">13.6.4.5</a>.</p>
<div class="gp prod"><span class="nt">LabelledStatement</span> <span class="geq">:</span> <span class="nt">LabelIdentifier</span> <code class="t">:</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>label</i> be the StringValue of <i>LabelIdentifier</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelledstatementevaluation">LabelledStatementEvaluation</a>(<i>label</i>, <i>Statement</i>,
<i>labelSet</i>).</li>
</ol>
</div>
<section id="sec-labelledstatementevaluation">
<h1><span class="secnum" id="sec-13.12.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelledstatementevaluation" title="link to this section">13.12.3.1</a></span> Runtime Semantics: LabelledStatementEvaluation(label, stmt,
labelSet)</h1>
<p>The abstract operation LabelledStatementEvaluation with arguments <var>label</var>, <var>stmt</var>, and
<var>labelSet</var> is performed as follows:</p>
<ol class="proc">
<li>Let <i>newLabelSet</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>label</i>
and the elements of <i>labelSet</i>.</li>
<li>If <i>stmt</i> is either <i>LabelledStatement</i> or <i>BreakableStatement</i>, then
<ol class="block">
<li>Let <i>stmtResult</i> be the result of performing LabelledEvaluation of <i>stmt</i> with argument
<i>newLabelSet</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>stmtResult</i> be the result of evaluating <i>stmt</i>.</li>
</ol>
</li>
<li>If <i>stmtResult</i>.[[type]] is <b>break</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>stmtResult</i>.[[target]], <i>label</i>), then
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>stmtResult</i>.[[value]]).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>result</i> be <i>stmtResult</i>.</li>
</ol>
</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-labelledevaluation-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.12.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-labelledevaluation-runtime-semantics-evaluation" title="link to this section">13.12.3.2</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">LabelledStatement</span> <span class="geq">:</span> <span class="nt">LabelIdentifier</span> <code class="t">:</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>newLabelSet</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return the result of performing LabelledEvaluation of this <i>LabelledStatement</i> with argument
<i>newLabelSet</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-throw-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-throw-statement" title="link to this section">13.13</a></span> The
<span style="font-family: monospace">throw</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ThrowStatement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">throw</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span><sub>[In, ?Yield]</sub> <code class="t">;</code></div>
</div>
</div>
<section id="sec-throw-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.13.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-throw-statement-runtime-semantics-evaluation" title="link to this section">13.13.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ThrowStatement</span> <span class="geq">:</span> <code class="t">throw</code> <span class="nt">Expression</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>Expression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exprValue</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">throw</span>, [[value]]: <i>exprValue</i>, [[target]]: <span style="font-family:
sans-serif">empty</span>}.</li>
</ol>
</section>
</section>
<section id="sec-try-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement" title="link to this section">13.14</a></span> The <span style="font-family: monospace">try</span> Statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">TryStatement</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">try</code> <span class="nt">Block</span><sub>[?Yield, ?Return]</sub> <span class="nt">Catch</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">try</code> <span class="nt">Block</span><sub>[?Yield, ?Return]</sub> <span class="nt">Finally</span><sub>[?Yield, ?Return]</sub></div>
<div class="rhs"><code class="t">try</code> <span class="nt">Block</span><sub>[?Yield, ?Return]</sub> <span class="nt">Catch</span><sub>[?Yield, ?Return]</sub> <span class="nt">Finally</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Catch</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">catch</code> <code class="t">(</code> <span class="nt">CatchParameter</span><sub>[?Yield]</sub> <code class="t">)</code> <span class="nt">Block</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Finally</span><sub>[Yield, Return]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">finally</code> <span class="nt">Block</span><sub>[?Yield, ?Return]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CatchParameter</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">BindingPattern</span><sub>[?Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The <code>try</code> statement encloses a block of code in which an exceptional condition
can occur, such as a runtime error or a <code>throw</code> statement. The <code>catch</code> clause provides the
exception-handling code. When a catch clause catches an exception, its <i>CatchParameter</i> is bound to that
exception.</p>
</div>
</div>
<section id="sec-try-statement-static-semantics-early-errors">
<h1><span class="secnum" id="sec-13.14.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-early-errors" title="link to this section">13.14.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">Catch</span> <span class="geq">:</span> <code class="t">catch</code> <code class="t">(</code> <span class="nt">CatchParameter</span> <code class="t">)</code> <span class="nt">Block</span></div>
<ul>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <span class="nt">CatchParameter</span> also occurs in the
LexicallyDeclaredNames of <span class="nt">Block</span>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <span class="nt">CatchParameter</span> also occurs in the
VarDeclaredNames of <span class="nt">Block</span>.</p>
</li>
</ul>
</section>
<section id="sec-try-statement-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-13.14.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames" title="link to this section">13.14.2</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of <i>Block</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Catch.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Finally</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of <i>Block</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Finally.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span> <span class="nt">Finally</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of <i>Block</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Catch.</i></li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>Finally.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">Catch</span> <span class="geq">:</span> <code class="t">catch</code> <code class="t">(</code> <span class="nt">CatchParameter</span> <code class="t">)</code> <span class="nt">Block</span></div>
<ol class="proc">
<li>Return the VarDeclaredNames of <i>Block</i>.</li>
</ol>
</section>
<section id="sec-try-statement-runtime-semantics-bindinginitialization">
<h1><span class="secnum" id="sec-13.14.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization" title="link to this section">13.14.3</a></span> Runtime Semantics: BindingInitialization</h1>
<p>With arguments <var>value</var> and <var>environment</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> <b>undefined</b> is passed for <var>environment</var> to indicate that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
<code>var</code> statements formal parameter lists of non-strict functions. In those cases a lexical binding is hosted and
preinitialized prior to evaluation of its initializer.</p>
</div>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-bindinginitialization">12.2.4.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-bindinginitialization">13.2.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>.</p>
<p><span class="prod"><span class="nt">CatchParameter</span> <span class="geq">:</span> <span class="nt">BindingPattern</span></span></p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Return the result of performing BindingInitialization for <i>BindingPattern</i> passing <i>value</i> and
<i>environment</i> as the arguments.</li>
</ol>
</section>
<section id="sec-runtime-semantics-catchclauseevaluation">
<h1><span class="secnum" id="sec-13.14.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-catchclauseevaluation" title="link to this section">13.14.4</a></span> Runtime Semantics: CatchClauseEvaluation</h1>
<p>with parameter <var>thrownValue</var></p>
<div class="gp prod"><span class="nt">Catch</span> <span class="geq">:</span> <code class="t">catch</code> <code class="t">(</code> <span class="nt">CatchParameter</span> <code class="t">)</code> <span class="nt">Block</span></div>
<ol class="proc">
<li>Let <i>oldEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>catchEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>oldEnv</i>).</li>
<li>For each element <i>argName</i> of the BoundNames of <i>CatchParameter</i>, do
<ol class="block">
<li>Call the CreateMutableBinding concrete method of <i>catchEnv</i> passing <i>argName</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call to CreateMutableBinding will never return an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
<li>Let <i>status</i> be the result of performing BindingInitialization for <i>CatchParameter</i> passing
<i>thrownValue</i> and <i>catchEnv</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>catchEnv</i>.</li>
<li>Let <i>B</i> be the result of evaluating <i>Block</i>.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>oldEnv</i>.</li>
<li>Return <i>B</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> No matter how control leaves the <i>Block</i> the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> is always restored to its former state.</p>
</div>
</section>
<section id="sec-try-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.14.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-evaluation" title="link to this section">13.14.5</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span></div>
<ol class="proc">
<li>Let <i>B</i> be the result of evaluating <i>Block</i>.</li>
<li>If <i>B</i>.[[type]] is not <span style="font-family: sans-serif">throw</span>, return <i>B</i>.</li>
<li>Return the result of performing CatchClauseEvaluation of <i>Catch</i> with parameter <i>B</i>.[[value]].</li>
</ol>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Finally</span></div>
<ol class="proc">
<li>Let <i>B</i> be the result of evaluating <i>Block</i>.</li>
<li>Let <i>F</i> be the result of evaluating <i>Finally</i>.</li>
<li>If <i>F</i>.[[type]] is <span style="font-family: sans-serif">normal</span>, return <i>B</i>.</li>
<li>Return <i>F</i>.</li>
</ol>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span> <span class="nt">Finally</span></div>
<ol class="proc">
<li>Let <i>B</i> be the result of evaluating <i>Block</i>.</li>
<li>If <i>B</i>.[[type]] is <span style="font-family: sans-serif">throw</span>, then
<ol class="block">
<li>Let <i>C</i> be the result of performing CatchClauseEvaluation of <i>Catch</i> with parameter <i>B</i>.value.</li>
</ol>
</li>
<li>Else <i>B</i>.[[type]] is not <span style="font-family: sans-serif">throw</span><b>,</b>
<ol class="block">
<li>Let <i>C</i> be <i>B</i>.</li>
</ol>
</li>
<li>Let <i>F</i> be the result of evaluating <i>Finally</i>.</li>
<li>If <i>F</i>.[[type]] is <span style="font-family: sans-serif">normal</span>, return <i>C</i>.</li>
<li>Return <i>F</i>.</li>
</ol>
</section>
</section>
<section id="sec-debugger-statement">
<div class="front">
<h1><span class="secnum" id="sec-13.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-debugger-statement" title="link to this section">13.15</a></span> The
<span style="font-family: monospace">debugger</span> statement</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">DebuggerStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">debugger</code> <code class="t">;</code></div>
</div>
</div>
<section id="sec-debugger-statement-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-13.15.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-debugger-statement-runtime-semantics-evaluation" title="link to this section">13.15.1</a></span> Runtime Semantics: Evaluation</h1>
<div class="note">
<p><span class="nh">NOTE</span> Evaluating the <span class="nt">DebuggerStatement</span> production may allow an
implementation to cause a breakpoint when run under a debugger. If a debugger is not present or active this statement has
no observable effect.</p>
</div>
<div class="gp prod"><span class="nt">DebuggerStatement</span> <span class="geq">:</span> <code class="t">debugger</code> <code class="t">;</code></div>
<ol class="proc">
<li>If an implementation defined debugging facility is available and enabled, then
<ol class="block">
<li>Perform an implementation defined debugging action.</li>
<li>Let <i>result</i> be an implementation defined <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>
value.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
</li>
<li>Return <i>result.</i></li>
</ol>
</section>
</section>
</section>
<section id="sec-ecmascript-language-functions-and-classes">
<div class="front">
<h1><span class="secnum" id="sec-14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-functions-and-classes" title="link to this section">14</a></span> ECMAScript Language: Functions and Classes</h1>
<div class="note">
<p><span class="nh">NOTE</span> Various ECMAScript language elements cause the creation of ECMAScript function objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">9.1.14</a>). Evaluation of such functions starts with the execution of their
[[Call]] internal method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-argumentslist">9.2.1</a>).</p>
</div>
</div>
<section id="sec-function-definitions">
<div class="front">
<h1><span class="secnum" id="sec-14.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions" title="link to this section">14.1</a></span>
Function Definitions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">FunctionDeclaration</span><sub>[Yield, Default]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">function</code> <span class="nt">BindingIdentifier</span><sub>[?Yield, ?Default]</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FunctionExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">function</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">StrictFormalParameters</span><sub>[Yield, GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FormalParameters</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FormalParameters</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">FormalParameterList</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FormalParameterList</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FunctionRestParameter</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">FormalsList</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
<div class="rhs"><span class="nt">FormalsList</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">,</code> <span class="nt">FunctionRestParameter</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FormalsList</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FormalParameter</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">FormalsList</span><sub>[?Yield, ?GeneratorParameter]</sub> <code class="t">,</code> <span class="nt">FormalParameter</span><sub>[?Yield,?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FunctionRestParameter</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingRestElement</span><sub>[Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FormalParameter</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingElement</span><sub>[?Yield, ?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FunctionBody</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FunctionStatementList</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FunctionStatementList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">StatementList</span><sub>[?Yield, Return]</sub><sub>opt</sub></div>
</div>
</div>
<section id="sec-directive-prologues-and-the-use-strict-directive">
<h1><span class="secnum" id="sec-14.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive" title="link to this section">14.1.1</a></span> Directive Prologues and the Use Strict Directive</h1>
<p>A Directive Prologue is the longest sequence of <span class="nt">ExpressionStatement</span> productions occurring as the
initial <span class="nt">StatementListItem</span> productions of a <span class="nt">FunctionBody</span> or a <span class="nt">ScriptBody</span> and where each <span class="nt">ExpressionStatement</span> in the sequence consists entirely of
a <span class="nt">StringLiteral</span> token followed by a semicolon<span style="font-family: Times New Roman">.</span> The
semicolon may appear explicitly or may be inserted by <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">automatic semicolon
insertion</a>. A Directive Prologue may be an empty sequence.</p>
<p>A Use Strict Directive is an <span class="nt">ExpressionStatement</span> in a Directive Prologue whose <span class="nt">StringLiteral</span> is either the exact character sequences <code>"use</code>&nbsp;<code>strict"</code> or
<code>'use</code>&nbsp;<code>strict'</code>. A Use Strict Directive may not contain an <span class="nt">EscapeSequence</span> or <span class="nt">LineContinuation</span>.</p>
<p>A Directive Prologue may contain more than one Use Strict Directive. However, an implementation may issue a warning if
this occurs.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <i>ExpressionStatement</i> productions of a Directive Prologue are evaluated normally
during evaluation of the containing production. Implementations may define implementation specific meanings for
<i>ExpressionStatement</i> productions which are not a Use Strict Directive and which occur in a Directive Prologue. If
an appropriate notification mechanism exists, an implementation should issue a warning if it encounters in a Directive
Prologue an <i>ExpressionStatement</i> that is not a Use Strict Directive and which does not have a meaning defined by the
implementation.</p>
</div>
</section>
<section id="sec-function-definitions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-14.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-early-errors" title="link to this section">14.1.2</a></span> Static Semantics: Early Errors</h1>
<p><span class="prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code>
<span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></span><br>and<br><span class="prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span>
<code class="t">function</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span>
<code class="t">}</code></span></p>
<ul>
<li>
<p>If the source code matching this production is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, the Early Error rules
for <span class="prod"><span class="nt">StrictFormalParameters</span> <span class="geq">:</span> <span class="nt">FormalParameters</span></span> are applied.</p>
</li>
<li>
<p>It is a Syntax Error if IsSimpleParameterList of <i>FormalParameters</i> is <b>false</b> and any element of the
BoundNames of <i>FormalParameters</i> also occurs in the VarDeclaredNames of <i>FunctionBody</i>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>FormalParameters</i> also occurs in the
LexicallyDeclaredNames of <i>FunctionBody</i>.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The LexicallyDeclaredNames of a <i>FunctionBody</i> does not include identifiers bound
using var or function declarations. Simple parameter lists bind identifiers as VarDeclaredNames. Parameter lists that
contain destructuring patterns, default value initializers, or a rest parameter bind identifiers as
LexicallyDeclaredNames.</p>
</div>
<div class="gp prod"><span class="nt">StrictFormalParameters</span> <span class="geq">:</span> <span class="nt">FormalParameters</span></div>
<ul>
<li>
<p>It is a Syntax Error if BoundNames of <i>FormalParameters</i> contains any duplicate elements.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="nt">FormalParameterList</span></div>
<ul>
<li>
<p>It is a Syntax Error if IsSimpleParameterList of <i>FormalParameterList</i> is <b>false</b> and BoundNames of
<i>FormalParameterList</i> contains any duplicate elements.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> Multiple occurrences of the same <i>Identifier</i> in a <i>FormalParamterList</i> is only
allowed for non-strict functions and generator functions that have simple parameter lists.</p>
</div>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ul>
<li>
<p>It is a Syntax Error if the LexicallyDeclaredNames of <i>StatementList</i> contains any duplicate entries.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the LexicallyDeclaredNames of <i>StatementList</i> also occurs in the
VarDeclaredNames of <i>StatementList</i>.</p>
</li>
</ul>
</section>
<section id="sec-function-definitions-static-semantics-boundnames">
<h1><span class="secnum" id="sec-14.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames" title="link to this section">14.1.3</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>FormalsList</i>.</li>
<li>Append to <i>names</i> the BoundNames of <i>FunctionRestParameter.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>Let <i>names</i> be BoundNames of <i>FormalsList</i>.</li>
<li>Append to <i>names</i> the elements of BoundNames of <i>FormalParameter.</i></li>
<li>Return <i>names</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-contains">
<h1><span class="secnum" id="sec-14.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains" title="link to this section">14.1.4</a></span> Static Semantics: Contains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-contains">12.3.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains">14.2.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains">14.5.4</a></p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Static semantic rules that depend upon substructure generally do not look into function
definitions.</p>
</div>
</section>
<section id="sec-function-definitions-static-semantics-containsexpression">
<h1><span class="secnum" id="sec-14.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-containsexpression" title="link to this section">14.1.5</a></span> Static Semantics: ContainsExpression</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-containsexpression">13.2.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-containsexpression">14.2.4</a>.</p>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return ContainsExpression of <i>FormalsList</i>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>If ContainsExpression of <i>FormalsList</i> is <b>true</b>, then return <b>true</b>.</li>
<li>Return ContainsExpression of <i>FormalParameter</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-expectedargumentcount">
<h1><span class="secnum" id="sec-14.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-expectedargumentcount" title="link to this section">14.1.6</a></span> Static Semantics: ExpectedArgumentCount</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-expectedargumentcount">14.2.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains">14.3.2</a>.</p>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return 0.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return 0.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return the ExpectedArgumentCount of <i>FormalsList</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The ExpectedArgumentCount of a <i>FormalParameterList</i> is the number of
<i>FormalParameters</i> to the left of either the rest parameter or the first <i>FormalParameter</i> with an Initializer.
A <i>FormalParameter</i> without an initializer is allowed after the first parameter with an initializer but such
parameters are considered to be optional with <b>undefined</b> as their default value.</p>
</div>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>If HasInitializer of <i>FormalParameter</i> is <b>true</b> return 0</li>
<li>Return 1.</li>
</ol>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>Let <i>count</i> be the ExpectedArgumentCount of <i>FormalsList.</i></li>
<li>If HasInitializer of <i>FormalsList</i> is <b>true</b> or HasInitializer of <i>FormalParameter</i> is <b>true</b>,
then return <i>count</i>.</li>
<li>Return <i>count</i>+1.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-hasinitializer">
<h1><span class="secnum" id="sec-14.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasinitializer" title="link to this section">14.1.7</a></span> Static Semantics: HasInitializer</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-hasinitializer">13.2.3.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasinitializer">14.2.7</a>.</p>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>If HasInitializer of <i>FormalsList</i> is <b>true</b>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>If HasInitializer of <i>FormalsList</i> is <b>true</b>, then return <b>true</b>.</li>
<li>Return HasInitializer of <i>FormalParameter</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-hasname">
<h1><span class="secnum" id="sec-14.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname" title="link to this section">14.1.8</a></span> Static Semantics: HasName</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname">14.2.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hasname">14.4.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-hasname">14.5.6</a>.</p>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-isanonymousfunctiondefinition">
<h1><span class="secnum" id="sec-14.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition" title="link to this section">14.1.9</a></span> Static Semantics: IsAnonymousFunctionDefinition ( production) Abstract
Operation</h1>
<p>The abstract operation IsAnonymousFunctionDefinition determines if its argument is a function definition that does not
bind a name. The argument <var>production</var> is is the result of parsing an <span class="nt">AssignmentExpression</span>.
The following steps are taken:</p>
<ol class="proc">
<li>If IsFunctionDefinition(<i>production</i>) is <b>false</b>, then return <b>false</b>.</li>
<li>Let <i>hasName</i> be the result of HasName of <i>production</i>.</li>
<li>If <i>hasName</i> is <b>true</b>, then return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-isconstantdeclaration">
<h1><span class="secnum" id="sec-14.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isconstantdeclaration" title="link to this section">14.1.10</a></span> Static Semantics: IsConstantDeclaration</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-isconstantdeclaration">13.2.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey">14.4.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a>.</p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-14.1.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition" title="link to this section">14.1.11</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-issimpleparameterlist">
<h1><span class="secnum" id="sec-14.1.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-issimpleparameterlist" title="link to this section">14.1.12</a></span> Static Semantics: IsSimpleParameterList</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname">14.2.8</a></p>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>If IsSimpleParameterList of <i>FormalsList</i> is <b>false</b>, return <b>false</b>.</li>
<li>Return IsSimpleParameterList of <i>FormalParameter</i>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameter</span> <span class="geq">:</span> <span class="nt">BindingElement</span></div>
<ol class="proc">
<li>Return IsSimpleParameterList of <i>BindingElement</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-isstrict">
<h1><span class="secnum" id="sec-14.1.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isstrict" title="link to this section">14.1.13</a></span> Static Semantics: IsStrict</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-isstrict">15.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-isstrict">15.2.0.7</a>.</p>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If this <i>FunctionStatementList</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if
<i>StatementList</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then return <b>true</b>. Otherwise, return
<b>false</b>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-lexicaldeclarations">
<h1><span class="secnum" id="sec-14.1.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations" title="link to this section">14.1.14</a></span> Static Semantics: LexicalDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicaldeclarations">13.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicaldeclarations">15.2.0.11</a>.</p>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return the TopLevelLexicallyScopedDeclarations of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-14.1.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicallydeclarednames" title="link to this section">14.1.15</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return TopLevelLexicallyDeclaredNames of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-referencessuper">
<h1><span class="secnum" id="sec-14.1.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper" title="link to this section">14.1.16</a></span> Static Semantics: <i>ReferencesSuper</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-referencessuper">14.2.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-referencessuper">14.3.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-referencessuper">14.4.11</a>.</p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>FormalParameters</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>FormalParameters</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="nt">FormalParametersList</span></div>
<ol class="proc">
<li>Return <i>FormalParametersList</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionBody</span> <span class="geq">:</span> <span class="nt">FunctionStatementList</span></div>
<ol class="proc">
<li>Return <i>FunctionStatementList</i> Contains <code>super</code>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-14.1.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-vardeclarednames" title="link to this section">14.1.17</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return TopLevelVarDeclaredNames of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-static-semantics-varscopeddeclarations">
<h1><span class="secnum" id="sec-14.1.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-varscopeddeclarations" title="link to this section">14.1.18</a></span> Static Semantics: VarScopedDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-varscopeddeclarations">15.1.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-varscopeddeclarations">15.2.0.14</a>.</p>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return the TopLevelVarScopedDeclarations of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-runtime-semantics-evaluatebody">
<h1><span class="secnum" id="sec-14.1.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-evaluatebody" title="link to this section">14.1.19</a></span> Runtime Semantics: EvaluateBody</h1>
<p>With parameter <var>functionObject</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-evaluatebody">14.2.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluatebody">14.4.13</a>.</p>
<div class="gp prod"><span class="nt">FunctionBody</span> <span class="geq">:</span> <span class="nt">FunctionStatementList</span></div>
<ol class="proc">
<li>The code of this <i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> if it is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> or if the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Directive Prologue</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">14.1.1</a>) of its <i>FunctionStatementList</i> contains
a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Use Strict Directive</a> or if any of the conditions
in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a> apply. If the code of this <i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, <i>FunctionStatementList</i> is evaluated in the following steps as
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>. Otherwise, <i>StatementList</i> is evaluated in the following
steps as non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>.</li>
<li>Let <i>result</i> be the result of evaluating <i>FunctionStatementList</i>.</li>
<li>If <i>result</i>.[[type]] is <span style="font-family: sans-serif">return</span> then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>result</i>.[[value]])</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</section>
<section id="sec-function-definitions-runtime-semantics-iteratorbindinginitialization">
<h1><span class="secnum" id="sec-14.1.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-iteratorbindinginitialization" title="link to this section">14.1.20</a></span> Runtime Semantics: IteratorBindingInitialization</h1>
<p>With parameters <var>iterator</var> and <var>environment</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> When <b>undefined</b> is passed for <var>environment</var> it indicates that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to
deal with the possibility of multiple parameters with the same name.</p>
</div>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization">13.2.3.6</a>,
.</p>
<div class="gp prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">FormalParameterList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FunctionRestParameter</span></div>
<ol class="proc">
<li>Let <i>restIndex</i> be the result of performing IteratorBindingInitialization for <i>FormalsList</i> using
<i>iterator</i>, and <i>environment</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>restIndex</i>).</li>
<li>Return the result of performing IteratorBindingInitialization for <i>FunctionRestParameter</i> using <i>iterator</i>
and <i>environment</i> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">FormalsList</span> <span class="geq">:</span> <span class="nt">FormalsList</span> <code class="t">,</code> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>Let <i>status</i> be the result of performing IteratorBindingInitialization for <i>FormalsList</i> using
<i>iterator</i> and <i>environment</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return the result of performing IteratorBindingInitialization for <i>FormalParameter</i> using <i>iterator</i> and
<i>environment</i> as the arguments.</li>
</ol>
</section>
<section id="sec-function-definitions-runtime-semantics-instantiatefunctionobject">
<h1><span class="secnum" id="sec-14.1.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-instantiatefunctionobject" title="link to this section">14.1.21</a></span> Runtime Semantics: InstantiateFunctionObject</h1>
<p>With parameter <var>scope</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject">14.4.14</a>.</p>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If the <i>FunctionDeclaration</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>name</i> be StringValue of <i>BindingIdentifier.</i></li>
<li>Let <i>F</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family: sans-serif">Normal</span>,
<i>FormalParameters</i>, <i>FunctionBody, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>FunctionDeclaration</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>F</i>, <i>name</i>, <b>undefined</b>).</li>
</ol>
</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>F</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>F</i>, <i>name</i>).</li>
<li>Return <i>F</i>.</li>
</ol>
</section>
<section id="sec-function-definitions-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-14.1.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-evaluation" title="link to this section">14.1.22</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>)</li>
</ol>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If the <i>FunctionExpression</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>scope</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family:
sans-serif">Normal</span>, <i>FormalParameters</i>, <i>FunctionBody, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>FunctionExpression</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <b>undefined</b>, <b>undefined</b>).</li>
</ol>
</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>closure</i>).</li>
<li>Return <i>closure</i>.</li>
</ol>
<div class="gp prod"><span class="nt">FunctionExpression</span> <span class="geq">:</span> <code class="t">function</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If the <i>FunctionExpression</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>runningContext</i> be running <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a>.</li>
<li>Let <i>funcEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>runningContext</i>
).</li>
<li>Let <i>envRec</i> be <i>funcEnv’s</i> environment record.</li>
<li>Let <i>name</i> be StringValue of <i>BindingIdentifier</i>.</li>
<li>Call the CreateImmutableBinding concrete method of <i>envRec</i> passing <i>name</i> as the argument.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family:
sans-serif">Normal</span>, <i>FormalParameters</i>, <i>FunctionBody, funcEnv</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>FunctionExpression</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <i>name</i>, <b>undefined</b>).</li>
</ol>
</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>closure</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>closure</i>, <i>name</i>).</li>
<li>Call the InitializeBinding concrete method of <i>envRec</i> passing <i>name</i> and <i>closure</i> as the
arguments.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>closure</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> The <i>BindingIdentifier</i> in a <i>FunctionExpression</i> can be referenced from
inside the <i>FunctionExpression's</i> <i>FunctionBody</i> to allow the function to call itself recursively. However,
unlike in a <i>FunctionDeclaration</i>, the <i>BindingIdentifier</i> in a <i>FunctionExpression</i> cannot be referenced
from and does not affect the scope enclosing the <i>FunctionExpression</i>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> A <code>prototype</code> property is automatically created for every function defined
using a <i>FunctionDeclaration</i> or <i>FunctionExpression</i>, to allow for the possibility that the function will be
used as a constructor.</p>
</div>
<div class="gp prod"><span class="nt">FunctionStatementList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
</ol>
</section>
</section>
<section id="sec-arrow-function-definitions">
<div class="front">
<h1><span class="secnum" id="sec-14.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions" title="link to this section">14.2</a></span> Arrow Function Definitions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ArrowFunction</span><sub>[In, Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ArrowParameters</span><sub>[?Yield]</sub> <code class="t">=&gt;</code> <span class="nt">ConciseBody</span><sub>[?In]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ArrowParameters</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ConciseBody</span><sub>[In]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[lookahead ∉ {<code class="t">{</code>}]</span> <span class="nt">AssignmentExpression</span><sub>[?In]</sub></div>
<div class="rhs"><code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<h2>Supplemental Syntax</h2>
<p>When processing the production</p>
<p><span class="nt">ArrowParameters</span><sub>[Yield]</sub> <b>:</b> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span><sub>[?Yield]</sub></p>
<p>the following grammar is used to refine the interpretation of:</p>
<div class="gp prod"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span> <span class="geq">:</span></div>
<div class="gp">
<div class="lhs"><span class="nt">ArrowFormalParameters</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">StrictFormalParameters</span><sub>[?Yield]</sub> <code class="t">)</code></div>
</div>
</div>
<section id="sec-arrow-function-definitions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-14.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-early-errors" title="link to this section">14.2.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">ArrowFunction</span> <span class="geq">:</span> <span class="nt">ArrowParameters</span> <code class="t">=&gt;</code> <span class="nt">ConciseBody</span></div>
<ul>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>ArrowParameters</i> also occurs in the VarDeclaredNames
of <i>ConciseBody</i>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>ArrowParameters</i> also occurs in the
LexicallyDeclaredNames of <i>ConciseBody</i>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ul>
<li>
<p>It is a Syntax Error if the lexical token sequence matched by
<i>CoverParenthesizedExpressionAndArrowParameterList</i> cannot be parsed with no tokens left over using
<i>ArrowFormalParameters</i> as the goal symbol.</p>
</li>
<li>
<p>It is a Syntax Error if any early errors are present for CoveredFormalsList of
<i>CoverParenthesizedExpressionAndArrowParameterList</i>.</p>
</li>
</ul>
</section>
<section id="sec-arrow-function-definitions-static-semantics-boundnames">
<h1><span class="secnum" id="sec-14.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames" title="link to this section">14.2.2</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the BoundNames of <i>formals</i>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-contains">
<h1><span class="secnum" id="sec-14.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains" title="link to this section">14.2.3</a></span> Static Semantics: Contains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-contains">12.3.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains">14.1.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains">14.5.4</a></p>
<div class="gp prod"><span class="nt">ArrowFunction</span> <span class="geq">:</span> <span class="nt">ArrowParameters</span> <code class="t">=&gt;</code> <span class="nt">ConciseBody</span></div>
<ol class="proc">
<li>If <i>symbol</i> is neither <code>super</code> nor <code>this</code>, then return <b>false</b>.</li>
<li>If <i>ArrowParameters</i> Contains <i>symbol</i> is <b>true</b>, return <b>true</b>;</li>
<li>Return <i>ConciseBody</i> Contains <i>symbol</i> .</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> <span style="font-family: sans-serif">Normally,</span> Contains <span style="font-family:
sans-serif">does not look inside most function forms However,</span> Contains is used to detect <code>this</code> and
<code>super</code> usage within an <i>ArrowFunction</i>.</p>
</div>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return <i>formals</i> Contains <i>symbol</i>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-containsexpression">
<h1><span class="secnum" id="sec-14.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-containsexpression" title="link to this section">14.2.4</a></span> Static Semantics: ContainsExpression</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-containsexpression">13.2.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-containsexpression">14.1.5</a>.</p>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the ContainsExpression of <i>formals</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-coveredformalslist">
<h1><span class="secnum" id="sec-14.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-coveredformalslist" title="link to this section">14.2.5</a></span> Static Semantics: CoveredFormalsList</h1>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <i>BindingIdentifier</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">...</code> <span class="nt">IdentifierName</span> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Expression</span> <code class="t">,</code> <code class="t">...</code> <span class="nt">IdentifierName</span> <code class="t">)</code></div>
</div>
<ol class="proc">
<li>Return the result of parsing the lexical token stream matched by
<i>CoverParenthesizedExpressionAndArrowParameterList</i> using <i>ArrowFormalParameters</i> as the goal symbol.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-expectedargumentcount">
<h1><span class="secnum" id="sec-14.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-expectedargumentcount" title="link to this section">14.2.6</a></span> Static Semantics: ExpectedArgumentCount</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-containsexpression">14.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains">14.3.2</a>.</p>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return 1.</li>
</ol>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the ExpectedArgumentCount of <i>formals</i>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-hasinitializer">
<h1><span class="secnum" id="sec-14.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasinitializer" title="link to this section">14.2.7</a></span> Static Semantics: HasInitializer</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-hasinitializer">13.2.3.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasinitializer">14.1.7</a>.</p>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the HasInitializer of <i>formals</i>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-hasname">
<h1><span class="secnum" id="sec-14.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname" title="link to this section">14.2.8</a></span> Static Semantics: HasName</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hasname">14.4.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-hasname">14.5.6</a>.</p>
<div class="gp prod"><span class="nt">ArrowFunction</span> <span class="geq">:</span> <span class="nt">ArrowParameters</span> <code class="t">=&gt;</code> <span class="nt">ConciseBody</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-issimpleparameterlist">
<h1><span class="secnum" id="sec-14.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-issimpleparameterlist" title="link to this section">14.2.9</a></span> Static Semantics: IsSimpleParameterList</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>.</p>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the IsSimpleParameterList of <i>formals</i>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-lexicaldeclarations">
<h1><span class="secnum" id="sec-14.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations" title="link to this section">14.2.10</a></span> Static Semantics: LexicalDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicaldeclarations">13.11.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicaldeclarations">15.2.0.11</a>.</p>
<div class="gp prod"><span class="nt">ConciseBody</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-14.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicallydeclarednames" title="link to this section">14.2.11</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">ConciseBody</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-referencessuper">
<h1><span class="secnum" id="sec-14.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-referencessuper" title="link to this section">14.2.12</a></span> Static Semantics: ReferencesSuper</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-referencessuper">14.3.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-referencessuper">14.4.11</a>.</p>
<div class="gp prod"><span class="nt">ArrowFunction</span> <span class="geq">:</span> <span class="nt">ArrowParameters</span> <code class="t">=&gt;</code> <span class="nt">ConciseBody</span></div>
<ol class="proc">
<li>Return <code>false</code>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> ReferencesSuper is used to determine whether a function requires its own super bindings.
This is never the case for Arrow Functions.</p>
</div>
</section>
<section id="sec-arrow-function-definitions-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-14.2.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-vardeclarednames" title="link to this section">14.2.13</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">ConciseBody</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-static-semantics-varscopeddeclarations">
<h1><span class="secnum" id="sec-14.2.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-varscopeddeclarations" title="link to this section">14.2.14</a></span> Static Semantics: VarScopedDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-varscopeddeclarations">15.1.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-varscopeddeclarations">15.2.0.14</a>.</p>
<div class="gp prod"><span class="nt">ConciseBody</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-runtime-semantics-iteratorbindinginitialization">
<h1><span class="secnum" id="sec-14.2.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-iteratorbindinginitialization" title="link to this section">14.2.15</a></span> Runtime Semantics: IteratorBindingInitialization</h1>
<p>With parameters <var>iterator</var> and <var>environment</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-comprehension-runtime-semantics-bindinginitialization">12.2.4.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>,<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-runtime-semantics-bindinginitialization">13.2.2.2</a>,<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist">13.2.3.4</a>,<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-runtime-semantics-bindinginitialization">13.14.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-iteratorbindinginitialization">14.1.20</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> When <b>undefined</b> is passed for <var>environment</var> it indicates that a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">PutValue</a> operation should be used to assign the initialization value. This is the case for
formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to
deal with the possibility of multiple parameters with the same name.</p>
</div>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">BindingIdentifier</span></div>
<ol class="proc">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>v</i> be <b>undefined</b></li>
<li>Else
<ol class="block">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
</ol>
</li>
<li>Return the result of performing BindingInitialization for <i>BindingIdentifier</i> using <i>v</i> and
<i>environment</i> as the arguments.</li>
</ol>
<div class="gp prod"><span class="nt">ArrowParameters</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>formals</i> be CoveredFormalsList of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return the result of performing IteratorBindingInitialization of <i>formals</i> with arguments <i>value</i> and
<i>environment</i>.</li>
</ol>
</section>
<section id="sec-arrow-function-definitions-runtime-semantics-evaluatebody">
<h1><span class="secnum" id="sec-14.2.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-evaluatebody" title="link to this section">14.2.16</a></span> Runtime Semantics: EvaluateBody</h1>
<p>With parameter <var>functionObject</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-varscopeddeclarations">14.1.18</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluatebody">14.4.13</a>.</p>
<div class="gp prod"><span class="nt">ConciseBody</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>The code of this <i>ConciseBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> if it is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> or if any of the conditions in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a> apply. If the code of this <i>ConciseBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, <i>AssignmentExpression</i> is evaluated in the following steps as
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>. Otherwise, <i>AssignmentExpression</i> is evaluated in the
following steps as non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>.</li>
<li>Let <i>exprRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>exprValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li>If <i>exprValue</i>.[[type]] is <span style="font-family: sans-serif">return</span> then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>exprValue</i>.[[value]]).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exprValue</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>exprValue</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> In the absence of extensions to this specification, the test is step 4 will never be
<b>true</b>.</p>
</div>
</section>
<section id="sec-arrow-function-definitions-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-14.2.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-evaluation" title="link to this section">14.2.17</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ArrowFunction</span> <span class="geq">:</span> <span class="nt">ArrowParameters</span> <code class="t">=&gt;</code> <span class="nt">ConciseBody</span></div>
<ol class="proc">
<li>If the code of this <i>ArrowFunction</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> or if
any of the conditions in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a> apply, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>scope</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>parameters</i> be CoveredFormalsList of <i>ArrowParameters</i>.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family:
sans-serif">Arrow</span>, <i>parameters</i>, <i>ConciseBody, scope</i>, <i>strict</i>).</li>
<li>Return <i>closure</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Any reference to <code>arguments</code>, <code>super</code>, or <code>this</code> within
an <i>ArrowFunction</i> are resoved to their bindings in the lexically enclosing function. Even though an
<i>ArrowFunction</i> may contain references to <code>super</code>, the function object created in step 4 is not made into
a method by performing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>. An <i>ArrowFunction</i> that references
<code>super</code> is always contained within a non-<i>ArrowFunction</i> and the necessary state to implement
<code>super</code> is accessible via the <i>scope</i> that is captured by the function object of the
<i>ArrowFunction</i>.</p>
</div>
</section>
</section>
<section id="sec-method-definitions">
<div class="front">
<h1><span class="secnum" id="sec-14.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions" title="link to this section">14.3</a></span> Method
Definitions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">MethodDefinition</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">PropertyName</span><sub>[?Yield]</sub> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><span class="nt">GeneratorMethod</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">get</code> <span class="nt">PropertyName</span><sub>[?Yield]</sub> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">set</code> <span class="nt">PropertyName</span><sub>[?Yield]</sub> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PropertySetParameterList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FormalParameter</span></div>
</div>
</div>
<section id="sec-method-definitions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-14.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-early-errors" title="link to this section">14.3.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ul>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>StrictFormalParameters</i> also occurs in the
VarDeclaredNames of <i>FunctionBody</i>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>StrictFormalParameters</i> also occurs in the
LexicallyDeclaredNames of <i>FunctionBody</i>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ul>
<li>
<p>It is a Syntax Error if IsSimpleParameterList of <i>PropertySetParameterList</i> is <b>false</b> and any element of
the BoundNames of <i>PropertySetParameterList</i> also occurs in the VarDeclaredNames of <i>FunctionBody</i>.</p>
</li>
<li>
<p>It is a Syntax Error if IsSimpleParameterList of <i>PropertySetParameterList</i> is <b>false</b> and BoundNames of
<i>PropertySetParameterList</i> contains either <b><span style="font-family: sans-serif">″</span><span style="font-family: monospace">eval</span><span style="font-family: sans-serif">″</span></b> or <b><span style="font-family: sans-serif">″</span><span style="font-family: monospace">arguments</span><span style="font-family: sans-serif">″</span></b>.</p>
</li>
<li>
<p>It is a Syntax Error if BoundNames of <i>PropertySetParameterList</i> contains any duplicate elements.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>PropertySetParameterList</i> also occurs in the
LexicallyDeclaredNames of <i>FunctionBody</i>.</p>
</li>
</ul>
</section>
<section id="sec-method-definitions-static-semantics-computedpropertycontains">
<h1><span class="secnum" id="sec-14.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains" title="link to this section">14.3.2</a></span> Static Semantics: ComputedPropertyContains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">MethodDefinition</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<ol class="proc">
<li>Return the result of ComputedPropertyContains for <i>PropertyName</i> with argument <i>symbol</i>.</li>
</ol>
</section>
<section id="sec-method-definitions-static-semantics-expectedargumentcount">
<h1><span class="secnum" id="sec-14.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-expectedargumentcount" title="link to this section">14.3.3</a></span> Static Semantics: ExpectedArgumentCount</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-containsexpression">14.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-expectedargumentcount">14.2.6</a>.</p>
<div class="gp prod"><span class="nt">PropertySetParameterList</span> <span class="geq">:</span> <span class="nt">FormalParameter</span></div>
<ol class="proc">
<li>If HasInitializer of <i>FormalParameter</i> is <b>true</b> return 0</li>
<li>Return 1.</li>
</ol>
</section>
<section id="sec-method-definitions-static-semantics-hascomputedpropertykey">
<h1><span class="secnum" id="sec-14.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-hascomputedpropertykey" title="link to this section">14.3.4</a></span> Static Semantics: HasComputedPropertyKey</h1>
<p><b>See also:</b> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-hascomputedpropertykey">12.2.5.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey">14.4.5</a></p>
<div class="gp">
<div class="lhs"><span class="nt">MethodDefinition</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<ol class="proc">
<li>Return HasComputedPropertyKey of <i>PropertyName</i>.</li>
</ol>
</section>
<section id="sec-method-definitions-static-semantics-propname">
<h1><span class="secnum" id="sec-14.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-propname" title="link to this section">14.3.5</a></span> Static Semantics: <i>PropName</i></h1>
<p><b>See also:</b> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-propname">12.2.5.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-propname">14.4.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-propname">14.5.13</a></p>
<div class="gp">
<div class="lhs"><span class="nt">MethodDefinition</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<ol class="proc">
<li>Return PropName of <i>PropertyName</i>.</li>
</ol>
</section>
<section id="sec-method-definitions-static-semantics-referencessuper">
<h1><span class="secnum" id="sec-14.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-referencessuper" title="link to this section">14.3.6</a></span> Static Semantics: <i>ReferencesSuper</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-referencessuper">14.2.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-referencessuper">14.4.11</a>.</p>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>StrictFormalParameters</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>PropertySetParameterList</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
</section>
<section id="sec-static-semantics-specialmethod">
<h1><span class="secnum" id="sec-14.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-specialmethod" title="link to this section">14.3.7</a></span> Static Semantics: <i>SpecialMethod</i></h1>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">MethodDefinition</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">GeneratorMethod</span></div>
<div class="rhs"><code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-definemethod">
<h1><span class="secnum" id="sec-14.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-definemethod" title="link to this section">14.3.8</a></span> Runtime Semantics: DefineMethod</h1>
<p>With parameters <var>object</var> and optional parameter <span style="font-family: Times New
Roman"><i>functionPrototype</i>.</span></p>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>propKey</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propKey</i>).</li>
<li>Let <i>strict</i> be IsStrict of <i>FunctionBody</i>.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family:
sans-serif">Method</span>, <i>StrictFormalParameters</i>, <i>FunctionBody, scope</i>, <i>strict</i>). If
<i>functionPrototype</i> was passed as a parameter then pass its value as the <i>functionPrototype</i> optional
argument of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>.</li>
<li>If ReferencesSuper of <i>MethodDefinition</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <i>propKey</i>, <i>object</i>).</li>
</ol>
</li>
<li>Return the Record{[[key]]: <i>propKey</i>, [[closure]]: <i>closure</i>}.</li>
</ol>
</section>
<section id="sec-method-definitions-runtime-semantics-propertydefinitionevaluation">
<h1><span class="secnum" id="sec-14.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-runtime-semantics-propertydefinitionevaluation" title="link to this section">14.3.9</a></span> Runtime Semantics: PropertyDefinitionEvaluation</h1>
<p>With parameter <span style="font-family: Times New Roman"><i>object</i>.</span></p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-runtime-semantics-propertydefinitionevaluation">12.2.5.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation">14.4.15</a>, B.3.1</p>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>methodDef</i> be the result of DefineMethod of this <i>MethodDefinition</i> with argument <i>object</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>methodDef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>methodDef</i>.[[closure]], <i>methodDef</i>.[[key]]).</li>
<li>Let <i>desc</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>{[[Value]]:
<i>methodDef</i>.[[closure]], [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]:
<b>true</b>}.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>methodDef</i>.[[key]],
<i>desc</i>).</li>
</ol>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <span class="nt">GeneratorMethod</span></div>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions">14.4</a>.</p>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>propKey</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propKey</i>).</li>
<li>Let <i>strict</i> be IsStrict of <i>FunctionBody</i>.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>formalParameterList</i> be the production <span class="prod"><span class="nt">FormalParameters</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></span></li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family:
sans-serif">Method</span>, <i>formalParameterList</i>, <i>FunctionBody, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>MethodDefinition</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <i>propKey</i>, <i>object</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>closure</i>, <i>propKey</i>, <span style="font-family:
monospace">"<b>get</b>"</span>).</li>
<li>Let <i>desc</i> be the PropertyDescriptor{[[Get]]: <i>closure</i>, [[Enumerable]]: <b>true</b>, [[Configurable]]:
<b>true</b>}</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>propKey</i>,
<i>desc</i>).</li>
</ol>
<div class="gp prod"><span class="nt">MethodDefinition</span> <span class="geq">:</span> <code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>propKey</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propKey</i>).</li>
<li>Let <i>strict</i> be IsStrict of <i>FunctionBody</i>.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioncreate">FunctionCreate</a>(<span style="font-family:
sans-serif">Method</span>, <i>PropertySetParameterList</i>, <i>FunctionBody, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>MethodDefinition</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <i>propKey</i>, <i>object</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>closure</i>, <i>propKey</i>, <span style="font-family:
monospace">"<b>set</b>"</span>).</li>
<li>Let <i>desc</i> be the PropertyDescriptor{[[Set]]: <i>closure</i>, [[Enumerable]]: <b>true</b>, [[Configurable]]:
<b>true</b>}</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>propKey</i>,
<i>desc</i>).</li>
</ol>
</section>
</section>
<section id="sec-generator-function-definitions">
<div class="front">
<h1><span class="secnum" id="sec-14.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions" title="link to this section">14.4</a></span> Generator Function Definitions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">GeneratorMethod</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">*</code> <span class="nt">PropertyName</span><sub>[?Yield]</sub> <code class="t">(</code> <span class="nt">StrictFormalParameters</span><sub>[Yield,GeneratorParameter]</sub> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span><sub>[Yield]</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">GeneratorDeclaration</span><sub>[Yield, Default]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span><sub>[?Yield, ?Default]</sub> <code class="t">(</code> <span class="nt">FormalParameters</span><sub>[Yield,GeneratorParameter]</sub> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span><sub>[Yield]</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">GeneratorExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span><sub>[Yield]</sub><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span><sub>[Yield,GeneratorParameter]</sub> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span><sub>[Yield]</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">YieldExpression</span><sub>[In]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">yield</code></div>
<div class="rhs"><code class="t">yield</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="grhsannot">[Lexical goal <span class="nt">InputElementRegExp</span>]</span> <span class="nt">AssignmentExpression</span><sub>[?In, Yield]</sub></div>
<div class="rhs"><code class="t">yield</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">*</code> <span class="grhsannot">[Lexical goal <span class="nt">InputElementRegExp</span>]</span> <span class="nt">AssignmentExpression</span><sub>[?In, Yield]</sub></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> <i>YieldExpression</i> cannot be used within the <i>FormalParameters</i> of a generator
function because any expressions that are part of <i>FormalParameters</i> are evaluate before the resulting generator
object is in a resumable state.</p>
</div>
<h2>Supplemental Syntax</h2>
<p>The following productions are used as an aid in specifying the semantics of certain ECMAScript language features. They
are not used when parsing ECMAScript source code.</p>
<div class="gp">
<div class="lhs"><span class="nt">GeneratorBody</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">FunctionBody</span></div>
<div class="rhs"><span class="nt">Comprehension</span></div>
</div>
<div class="note">
<p><span class="nh">NOTE:</span> Abstract operations relating to generator objects are defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-abstract-operations">25.3.3</a>.</p>
</div>
</div>
<section id="sec-generator-function-definitions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-14.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-early-errors" title="link to this section">14.4.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">GeneratorMethod</span> <span class="geq">:</span> <code class="t">*</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ul>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>StrictFormalParameters</i> also occurs in the
VarDeclaredNames of <i>FunctionBody</i>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>StrictFormalParameters</i> also occurs in the
LexicallyDeclaredNames of <i>FunctionBody</i>.</p>
</li>
</ul>
<p><span class="prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span>
<code class="t">}</code></span><br>and<br><span class="prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></span></p>
<ul>
<li>
<p>If the source code matching this production is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, the Early Error rules
for <span class="prod"><span class="nt">StrictFormalParameters</span> <span class="geq">:</span> <span class="nt">FormalParameters</span></span> are applied.</p>
</li>
<li>
<p>It is a Syntax Error if IsSimpleParameterList of <i>FormalParameters</i> is <b>false</b> and any element of the
BoundNames of <i>FormalParameters</i> also occurs in the VarDeclaredNames of <i>FunctionBody</i>.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the BoundNames of <i>FormalParameters</i> also occurs in the
LexicallyDeclaredNames of <i>FunctionBody</i>.</p>
</li>
</ul>
</section>
<section id="sec-generator-function-definitions-static-semantics-boundnames">
<h1><span class="secnum" id="sec-14.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames" title="link to this section">14.4.2</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-computedpropertycontains">
<h1><span class="secnum" id="sec-14.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains" title="link to this section">14.4.3</a></span> Static Semantics: ComputedPropertyContains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains">14.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a>.</p>
<div class="gp prod"><span class="nt">GeneratorMethod</span> <span class="geq">:</span> <code class="t">*</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return the result of ComputedPropertyContains for <i>PropertyName</i> with argument <i>symbol</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-contains">
<h1><span class="secnum" id="sec-14.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-contains" title="link to this section">14.4.4</a></span> Static Semantics: Contains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-contains">12.3.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains">14.1.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains">14.2.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains">14.5.4</a></p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Static semantic rules that depend upon substructure generally do not look into function
definitions.</p>
</div>
</section>
<section id="sec-generator-function-definitions-static-semantics-hascomputedpropertykey">
<h1><span class="secnum" id="sec-14.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey" title="link to this section">14.4.5</a></span> Static Semantics: HasComputedPropertyKey</h1>
<p><b>See also:</b> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-hascomputedpropertykey">12.2.5.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-hascomputedpropertykey">14.3.4</a></p>
<div class="gp prod"><span class="nt">GeneratorMethod</span> <span class="geq">:</span> <code class="t">*</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return IsComputedPropertyKey of <i>PropertyName</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-hasname">
<h1><span class="secnum" id="sec-14.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hasname" title="link to this section">14.4.6</a></span> Static Semantics: HasName</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname">14.2.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-hasname">14.5.6</a>.</p>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-isconstantdeclaration">
<h1><span class="secnum" id="sec-14.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isconstantdeclaration" title="link to this section">14.4.7</a></span> Static Semantics: IsConstantDeclaration</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-isconstantdeclaration">13.2.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains">14.5.5</a>.</p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-14.4.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition" title="link to this section">14.4.8</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition">14.5.8</a>.</p>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-14.4.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-lexicallydeclarednames" title="link to this section">14.4.9</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-propname">
<h1><span class="secnum" id="sec-14.4.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-propname" title="link to this section">14.4.10</a></span> Static Semantics: <i>PropName</i></h1>
<p><b>See also:</b> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-propname">12.2.5.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-propname">14.3.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-propname">14.5.13</a></p>
<div class="gp prod"><span class="nt">GeneratorMethod</span> <span class="geq">:</span> <code class="t">*</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return PropName of <i>PropertyName</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-referencessuper">
<h1><span class="secnum" id="sec-14.4.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-referencessuper" title="link to this section">14.4.11</a></span> Static Semantics: <i>ReferencesSuper</i></h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, ,<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-referencessuper">14.2.12</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-referencessuper">14.3.6</a>.</p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>FormalParameters</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>FormalParameters</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorMethod</span> <span class="geq">:</span> <code class="t">*</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>StrictFormalParameters</i> Contains <code>super</code> is <b>true</b>, then return <b>true.</b></li>
<li>Return <i>FunctionBody</i> Contains <code>super</code>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-14.4.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames" title="link to this section">14.4.12</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-runtime-semantics-evaluatebody">
<h1><span class="secnum" id="sec-14.4.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluatebody" title="link to this section">14.4.13</a></span> Runtime Semantics: EvaluateBody</h1>
<p>With parameter <var>functionObject</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-varscopeddeclarations">14.1.18</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-runtime-semantics-evaluatebody">14.2.16</a>.</p>
<div class="gp prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">FunctionBody</span></div>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records">Function Environment
Record</a> containing a this binding has already been activated as the current environment.</li>
<li>Let <i>env</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisenvironment">GetThisEnvironment</a>( ).</li>
<li>Let <i>G</i> be the result of calling the GetThisBinding concrete method of <i>env</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>G</i>) is not Object or if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>G</i>) is Object and <i>G</i> does not have a
[[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>G</i>) is Object and <i>G</i> has a [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of <i>G’s</i>
[[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not
<b>undefined</b>, then
<ol class="block">
<li>Let <i>newG</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>functionObject</i>,
<code>"%GeneratorPrototype%"</code>, ( [[GeneratorState]], [[GeneratorContext]]) ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>newG</i>).</li>
<li>Let <i>G</i> be <i>newG.</i></li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorstart">GeneratorStart</a>(<i>G</i>, <i>FunctionBody</i>).</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">Comprehension</span></div>
<ol class="proc">
<li>Let <i>G</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif"><b>%</b>GeneratorPrototype<b>%</b></span>, ( [[GeneratorState]], [[GeneratorContext]]) ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>G</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: the value of <i>G’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>.</li>
<li>Let <i>startStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorstart">GeneratorStart</a>(<i>G</i>, <i>Comprehension</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>startStatus</i>).</li>
<li>Return <i>G</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject">
<h1><span class="secnum" id="sec-14.4.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject" title="link to this section">14.4.14</a></span> Runtime Semantics: InstantiateFunctionObject</h1>
<p>With parameter <var>scope</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-instantiatefunctionobject">14.1.21</a>.</p>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If the <i>GeneratorDeclaration</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>name</i> be StringValue of <i>BindingIdentifier.</i></li>
<li>Using <i>FunctionBody</i> from the production that is being evaluated, let <i>body</i> be the supplemental syntactic
grammar production: <span class="prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">FunctionBody</span></span> .</li>
<li>Let <i>F</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate">GeneratorFunctionCreate</a>(<span style="font-family:
sans-serif">Normal</span>, <i>FormalParameters</i>, <i>body, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>GeneratorDeclaration</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>F</i>, <i>name</i>, <b>undefined</b>).</li>
</ol>
</li>
<li>Let <i>prototype</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%GeneratorPrototype%</span>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>F</i>, <b>true</b>, <i>prototype</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>F</i>, <i>name</i>).</li>
<li>Return <i>F</i>.</li>
</ol>
</section>
<section id="sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation">
<h1><span class="secnum" id="sec-14.4.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation" title="link to this section">14.4.15</a></span> Runtime Semantics: PropertyDefinitionEvaluation</h1>
<p>With parameter <span style="font-family: Times New Roman"><i>object</i>.</span></p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-runtime-semantics-propertydefinitionevaluation">12.2.5.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-runtime-semantics-propertydefinitionevaluation">14.3.9</a>, B.3.1</p>
<div class="gp prod"><span class="nt">GeneratorMethod</span> <span class="geq">:</span> <code class="t">*</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">StrictFormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>propKey</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propKey</i>).</li>
<li>Let <i>strict</i> be IsStrict of <i>FunctionBody</i>.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Using <i>FunctionBody</i> from the production that is being evaluated, let <i>body</i> be the supplemental syntactic
grammar production: <span class="prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">FunctionBody</span></span> .</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate">GeneratorFunctionCreate</a>(<span style="font-family:
sans-serif">Method</span>, <i>StrictFormalParameters</i>, <i>body, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>GeneratorMethod</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <i>propKey</i>, <i>homeObject</i>).</li>
</ol>
</li>
<li>Let <i>prototype</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%GeneratorPrototype</span>%).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>closure</i>, <b>true</b>, <i>prototype</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>closure</i>, <i>propKey</i>).</li>
<li>Let <i>desc</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>{[[Value]]:
<i>closure</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>propKey</i>,
<i>desc</i>).</li>
</ol>
</section>
<section id="sec-generator-function-definitions-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-14.4.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluation" title="link to this section">14.4.16</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">GeneratorDeclaration</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>)</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If the <i>GeneratorExpression</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Using <i>FunctionBody</i> from the production that is being evaluated, let <i>body</i> be the supplemental syntactic
grammar production: <span class="prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">FunctionBody</span></span> .</li>
<li>Let <i>scope</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate">GeneratorFunctionCreate</a>(<span style="font-family:
sans-serif">Normal</span>, <i>FormalParameters</i>, <i>body, scope</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>GeneratorExpression</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <b>undefined</b>, <b>undefined</b>).</li>
</ol>
</li>
<li>Let <i>prototype</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%GeneratorPrototype%</span>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a>(<i>closure</i>, <b>true</b>, <i>prototype</i>).</li>
<li>Return <i>closure</i>.</li>
</ol>
<div class="gp prod"><span class="nt">GeneratorExpression</span> <span class="geq">:</span> <code class="t">function</code> <code class="t">*</code> <span class="nt">BindingIdentifier</span> <code class="t">(</code> <span class="nt">FormalParameters</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If the <i>GeneratorExpression</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strict</i> be <b>true</b>.
Otherwise let <i>strict</i> be <b>false</b>.</li>
<li>Using <i>FunctionBody</i> from the production that is being evaluated, let <i>body</i> be the supplemental syntactic
grammar production: <span class="prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">FunctionBody</span></span> .</li>
<li>Let <i>runningContext</i> be running <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">Lexical Environment</a>.</li>
<li>Let <i>funcEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>runningContext</i>).</li>
<li>Let <i>envRec</i> be <i>funcEnv’s</i> environment record.</li>
<li>Let <i>name</i> be StringValue of <i>BindingIdentifier</i>.</li>
<li>Call the CreateImmutableBinding concrete method of <i>envRec</i> passing <i>name</i> as the argument.</li>
<li>Let <i>closure</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunctioncreate">GeneratorFunctionCreate</a>(<span style="font-family:
sans-serif">Normal</span>, <i>FormalParameters</i>, <i>body, funcEnv</i>, <i>strict</i>).</li>
<li>If ReferencesSuper of <i>GeneratorExpression</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>closure</i>, <i>name</i>, <b>undefined</b>).</li>
</ol>
</li>
<li>Let <i>prototype</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%GeneratorPrototype%</span>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a> (<i>closure</i>, <b>true</b>, <i>prototype</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>closure</i>, <i>name</i>).</li>
<li>Call the InitializeBinding concrete method of <i>envRec</i> passing <i>name</i> and <i>closure</i> as the
arguments.</li>
<li>Return <i>closure</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> The <i>BindingIdentifier</i> in a <i>GeneratorExpression</i> can be referenced from
inside the <i>GeneratorExpression's</i> <i>FunctionBody</i> to allow the generator code to call itself recursively.
However, unlike in a <i>GeneratorDeclaration</i>, the <i>BindingIdentifier</i> in a <i>GeneratorExpression</i> cannot be
referenced from and does not affect the scope enclosing the <i>GeneratorExpression</i>.</p>
</div>
<div class="gp prod"><span class="nt">YieldExpression</span> <span class="geq">:</span> <code class="t">yield</code></div>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatoryield">GeneratorYield</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>false</b>)).</li>
</ol>
<div class="gp prod"><span class="nt">YieldExpression</span> <span class="geq">:</span> <code class="t">yield</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatoryield">GeneratorYield</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>value</i>, <b>false</b>)).</li>
</ol>
<div class="gp prod"><span class="nt">YieldExpression</span> <span class="geq">:</span> <code class="t">yield</code> <code class="t">*</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>exprRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>)<i>.</i></li>
<li>Let <i>received</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<b>undefined</b>).</li>
<li>Repeat
<ol class="block">
<li>If <i>received</i>.[[type]] is <span style="font-family: sans-serif">normal</span>, then
<ol class="block">
<li>Let <i>innerResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratornext">IteratorNext</a>(<i>iterator</i>,
<i>received</i>.[[value]]).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>innerResult</i>).</li>
</ol>
</li>
<li>Else
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>received</i>.[[type]] is <span style="font-family:
sans-serif">throw.</span></li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>iterator</i>, <code>"throw"</code>) is <b>true</b>, then
<ol class="block">
<li>Let <i>innerResult</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>iterator</i>, <code>"throw"</code>,
(<i>received</i>.[[value]])).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>innerResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>innerResult</i>) is not Object, then throw
a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Else, return <i>received.</i></li>
</ol>
</li>
<li>Let <i>done</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorcomplete">IteratorComplete</a>(<i>innerResult</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>done</i>).</li>
<li>If <i>done</i> is <b>true</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a> (<i>innerResult</i>).</li>
</ol>
</li>
<li>Let <i>received</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatoryield">GeneratorYield</a>(<i>innerResult</i>).</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-class-definitions">
<div class="front">
<h1><span class="secnum" id="sec-14.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions" title="link to this section">14.5</a></span> Class
Definitions</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">ClassDeclaration</span><sub>[Yield, Default]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">class</code> <span class="nt">BindingIdentifier</span><sub>[?Yield, ?Default]</sub> <span class="nt">ClassTail</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassExpression</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">class</code> <span class="nt">BindingIdentifier</span><sub>[?Yield]</sub><sub>opt</sub> <span class="nt">ClassTail</span><sub>[?Yield,?GeneratorParameter]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassTail</span><sub>[Yield,GeneratorParameter]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[~GeneratorParameter]</span> <span class="nt">ClassHeritage</span><sub>[?Yield]</sub><sub>opt</sub> <code class="t">{</code> <span class="nt">ClassBody</span><sub>[?Yield]</sub><sub>opt</sub> <code class="t">}</code></div>
<div class="rhs"><span class="grhsannot">[+GeneratorParameter]</span> <span class="nt">ClassHeritage</span><sub>opt</sub> <code class="t">{</code> <span class="nt">ClassBody</span><sub>opt</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassHeritage</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">extends</code> <span class="nt">LeftHandSideExpression</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassBody</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ClassElementList</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassElementList</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ClassElement</span><sub>[?Yield]</sub></div>
<div class="rhs"><span class="nt">ClassElementList</span><sub>[?Yield]</sub> <span class="nt">ClassElement</span><sub>[?Yield]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassElement</span><sub>[Yield]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MethodDefinition</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">static</code> <span class="nt">MethodDefinition</span><sub>[?Yield]</sub></div>
<div class="rhs"><code class="t">;</code></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> A <i>ClassBody</i> is always <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>.</p>
</div>
</div>
<section id="sec-class-definitions-static-semantics-early-errors">
<h1><span class="secnum" id="sec-14.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-early-errors" title="link to this section">14.5.1</a></span> Static Semantics: Early Errors</h1>
<p><span class="prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></span></p>
<p><span class="prod"><span class="nt">ClassExpression</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></span></p>
<ul>
<li>It is a Syntax Error if the StringValue of <i>BindingIdentifier</i> is <code>"let"</code>.</li>
</ul>
<div class="gp prod"><span class="nt">ClassBody</span> <span class="geq">:</span> <span class="nt">ClassElementList</span></div>
<ul>
<li>
<p>It is a Syntax Error if PrototypePropertyNameList of <i>ClassElementList</i> <i>contains any duplicate entries,
unless the following condition is true for each duplicate entry:</i> The duplicated entry occurs exactly twice in the
list and one occurrence was obtained from a <code>get</code> accessor <i>MethodDefinition</i> and the other occurrence
was obtained from a <code>set</code> accessor <i>MethodDefinition</i>.</p>
</li>
<li>
<p>It is a Syntax Error if StaticPropertyNameList of <i>ClassElementList</i> <i>contains any duplicate entries, unless
the following condition is true for each duplicate entry:</i> The duplicated entry occurs exactly twice in the list and
one occurrence was obtained from a <code>get</code> accessor <i>MethodDefinition</i> and the other occurrence was
obtained from a <code>set</code> accessor <i>MethodDefinition</i>.</p>
</li>
</ul>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <span class="nt">MethodDefinition</span></div>
<ul>
<li>
<p>It is a Syntax Error if PropName of <i>MethodDefinition</i> <i>is</i> <b><span style="font-family:
sans-serif">″</span><span style="font-family: monospace">constructor</span><span style="font-family:
sans-serif">″</span></b> <i>and SpecialMethod of MethodDefinition is <b>true</b>.</i></p>
</li>
</ul>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">static</code> <span class="nt">MethodDefinition</span></div>
<ul>
<li>It is a Syntax Error if PropName of <i>MethodDefinition</i> <i>is</i> <b><span style="font-family:
sans-serif">″</span><span style="font-family: monospace">prototype</span><span style="font-family:
sans-serif">″</span></b><i>.</i></li>
</ul>
</section>
<section id="sec-class-definitions-static-semantics-boundnames">
<h1><span class="secnum" id="sec-14.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames" title="link to this section">14.5.2</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-constructormethod">
<h1><span class="secnum" id="sec-14.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-constructormethod" title="link to this section">14.5.3</a></span> Static Semantics: ConstructorMethod</h1>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>If <i>ClassElement</i> is the production <span class="prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></span> then, return <span style="font-family:
sans-serif">empty</span>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>true</b>, return <span style="font-family: sans-serif">empty</span>.</li>
<li>If PropName of <i>ClassElement</i> is not <b><span style="font-family: sans-serif">″</span><span style="font-family: monospace">constructor</span><span style="font-family: sans-serif">″</span></b>, return
<span style="font-family: sans-serif">empty</span>.</li>
<li>Return <i>ClassElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElementList</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>Let <i>head</i> be ConstructorMethod of <i>ClassElementList.</i></li>
<li>If <i>head</i> is not <span style="font-family: sans-serif">empty</span>, return <i>head</i>.</li>
<li>If <i>ClassElement</i> is the production <span class="prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></span> then, return <span style="font-family:
sans-serif">empty</span>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>true</b>, return <span style="font-family: sans-serif">empty</span>.</li>
<li>If PropName of <i>ClassElement</i> is not <b><span style="font-family: sans-serif">″</span><span style="font-family: monospace">constructor</span><span style="font-family: sans-serif">″</span></b>, return
<span style="font-family: sans-serif">empty</span>.</li>
<li>Return <i>ClassElement</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Early Error rules ensure that there is only one method definition named <b><span style="font-family: sans-serif">″</span><span style="font-family: monospace">constructor</span><span style="font-family: sans-serif">″</span></b> and that it is not an accessor property or generator definition.</p>
</div>
</section>
<section id="sec-class-definitions-static-semantics-contains">
<h1><span class="secnum" id="sec-14.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-contains" title="link to this section">14.5.4</a></span> Static Semantics: Contains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantic-rules">5.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-contains">12.3.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-contains">14.1.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-contains">14.2.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a></p>
<div class="gp prod"><span class="nt">ClassTail</span> <span class="geq">:</span> <span class="nt">ClassHeritage</span><sub>opt</sub> <code class="t">{</code> <span class="nt">ClassBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>symbol</i> is <i>ClassBody</i>, return <b>true</b>.</li>
<li>If <i>symbol</i> is ClassHeritage, then
<ol class="block">
<li>If <i>ClassHeritage</i> is present, return <b>true</b> otherwise return <b>false</b>.</li>
</ol>
</li>
<li>Let <i>inHeritage</i> be the result of Contains for <i>ClassHeritage</i> with argument <i>symbol</i>.</li>
<li>If <i>inHeritage</i> is <b>true</b>, then return <b>true</b>.</li>
<li>Return the result of ComputedPropertyContains for <i>ClassBody</i> with argument <i>symbol</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Static semantic rules that depend upon substructure generally do not look into class
bodies except for <i>PropertyName</i> productions.</p>
</div>
</section>
<section id="sec-class-definitions-static-semantics-computedpropertycontains">
<h1><span class="secnum" id="sec-14.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-computedpropertycontains" title="link to this section">14.5.5</a></span> Static Semantics: ComputedPropertyContains</h1>
<p>With parameter <var>symbol</var>.</p>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-computedpropertycontains">12.2.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-computedpropertycontains">14.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-computedpropertycontains">14.4.3</a>.</p>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElementList</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>Let <i>inList</i> be the result of ComputedPropertyContains for <i>ClassElementList</i> with argument
<i>symbol.</i></li>
<li>If <i>inList</i> is <b>true</b>, then return <b>true</b>.</li>
<li>Return the result of ComputedPropertyContains for <i>ClassElement</i> with argument <i>symbol</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <span class="nt">MethodDefinition</span></div>
<ol class="proc">
<li>Return the result of ComputedPropertyContains for <i>MethodDefinition</i> with argument <i>symbol</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">static</code> <span class="nt">MethodDefinition</span></div>
<ol class="proc">
<li>Return the result of ComputedPropertyContains for <i>MethodDefinition</i> with argument <i>symbol</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-class-definitions-static-semantics-hasname">
<h1><span class="secnum" id="sec-14.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-hasname" title="link to this section">14.5.6</a></span> Static Semantics: HasName</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-hasname">14.2.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hasname">14.4.6</a>.</p>
<div class="gp prod"><span class="nt">ClassExpression</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassExpression</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-class-definitions-static-semantics-isconstantdeclaration">
<h1><span class="secnum" id="sec-14.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isconstantdeclaration" title="link to this section">14.5.7</a></span> Static Semantics: IsConstantDeclaration</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-isconstantdeclaration">13.2.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-hasname">14.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-hascomputedpropertykey">14.4.5</a>.</p>
<div class="gp prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-class-definitions-static-semantics-isfunctiondefinition">
<h1><span class="secnum" id="sec-14.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-isfunctiondefinition" title="link to this section">14.5.8</a></span> Static Semantics: IsFunctionDefinition</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-semantics-static-semantics-isfunctiondefinition">12.2.0.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grouping-operator-static-semantics-isfunctiondefinition">12.2.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-static-semantics-isfunctiondefinition">12.3.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions-static-semantics-isfunctiondefinition">12.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators-static-semantics-isfunctiondefinition">12.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators-static-semantics-isfunctiondefinition">12.6.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators-static-semantics-isfunctiondefinition">12.7.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators-static-semantics-isfunctiondefinition">12.8.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators-static-semantics-isfunctiondefinition">12.9.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators-static-semantics-isfunctiondefinition">12.11.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators-static-semantics-isfunctiondefinition">12.12.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator-static-semantics-isfunctiondefinition">12.13.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-isfunctiondefinition">12.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator-static-semantics-isfunctiondefinition">12.15.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isfunctiondefinition">14.1.11</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>.</p>
<div class="gp prod"><span class="nt">ClassExpression</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassExpression</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-static-semantics-isstatic">
<h1><span class="secnum" id="sec-14.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-isstatic" title="link to this section">14.5.9</a></span> Static Semantics: IsStatic</h1>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <span class="nt">MethodDefinition</span></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">static</code> <span class="nt">MethodDefinition</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-class-definitions-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-14.5.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames" title="link to this section">14.5.10</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>BindingIdentifier</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-prototypemethoddefinitions">
<h1><span class="secnum" id="sec-14.5.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-prototypemethoddefinitions" title="link to this section">14.5.11</a></span> Static Semantics: PrototypeMethodDefinitions</h1>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>If <i>ClassElement</i> is the production <span class="prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></span> then, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>true</b>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If PropName of <i>ClassElement</i> is <b><span style="font-family: sans-serif">″</span><span style="font-family:
monospace">constructor</span><span style="font-family: sans-serif">″</span></b>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>ClassElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElementList</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>Let <i>list</i> be PrototypeMethodDefinitions of <i>ClassElementList.</i></li>
<li>If <i>ClassElement</i> is the production <span class="prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></span> then, return <i>list</i>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>true</b>, return <i>list</i>.</li>
<li>If PropName of <i>ClassElement</i> is <b><span style="font-family: sans-serif">″</span><span style="font-family:
monospace">constructor</span><span style="font-family: sans-serif">″</span></b>, return <i>list</i>.</li>
<li>Append <i>ClassElement</i> to the end of <i>list</i>.</li>
<li>Return <i>list</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-prototypepropertynamelist">
<h1><span class="secnum" id="sec-14.5.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-prototypepropertynamelist" title="link to this section">14.5.12</a></span> Static Semantics: PrototypePropertyNameList</h1>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>If PropName of <i>ClassElement</i> is <span style="font-family: sans-serif">empty</span>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>true</b>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing PropName of <i>ClassElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElementList</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>Let <i>list</i> be PrototypePropertyNameList of <i>ClassElementList.</i></li>
<li>If PropName of <i>ClassElement</i> is <span style="font-family: sans-serif">empty</span>, return <i>list</i>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>true</b>, return <i>list</i>.</li>
<li>Append PropName of <i>ClassElement</i> to the end of <i>list</i>.</li>
<li>Return <i>list</i>.</li>
</ol>
</section>
<section id="sec-class-definitions-static-semantics-propname">
<h1><span class="secnum" id="sec-14.5.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-propname" title="link to this section">14.5.13</a></span> Static Semantics: <i>PropName</i></h1>
<p><b>See also:</b> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-propname">12.2.5.6</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions-static-semantics-propname">14.3.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-propname">14.4.10</a></p>
<div class="gp prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return <span style="font-family: sans-serif">empty</span>.</li>
</ol>
</section>
<section id="sec-static-semantics-staticpropertynamelist">
<h1><span class="secnum" id="sec-14.5.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-staticpropertynamelist" title="link to this section">14.5.14</a></span> Static Semantics: StaticPropertyNameList</h1>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>If PropName of <i>ClassElement</i> is <span style="font-family: sans-serif">empty</span>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>false</b>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing PropName of <i>ClassElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElementList</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>Let <i>list</i> be StaticPropertyNameList of <i>ClassElementList.</i></li>
<li>If PropName of <i>ClassElement</i> is <span style="font-family: sans-serif">empty</span>, return <i>list</i>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>false</b>, return <i>list</i>.</li>
<li>Append PropName of <i>ClassElement</i> to the end of <i>list</i>.</li>
<li>Return <i>list</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-staticmethoddefinitions">
<h1><span class="secnum" id="sec-14.5.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-staticmethoddefinitions" title="link to this section">14.5.15</a></span> Static Semantics: StaticMethodDefinitions</h1>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>If <i>ClassElement</i> is the production <span class="prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></span> then, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>false</b>, return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>ClassElement</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ClassElementList</span> <span class="geq">:</span> <span class="nt">ClassElementList</span> <span class="nt">ClassElement</span></div>
<ol class="proc">
<li>Let <i>list</i> be StaticMethodDefinitions of <i>ClassElementList.</i></li>
<li>If <i>ClassElement</i> is the production <span class="prod"><span class="nt">ClassElement</span> <span class="geq">:</span> <code class="t">;</code></span> then, return <i>list</i>.</li>
<li>If IsStatic of <i>ClassElement</i> is <b>false</b>, return <i>list</i>.</li>
<li>Append <i>ClassElement</i> to the end of <i>list</i>.</li>
<li>Return <i>list</i>.</li>
</ol>
</section>
<section id="sec-class-definitions-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-14.5.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames" title="link to this section">14.5.16</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<p><span class="prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></span></p>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-classdefinitionevaluation">
<h1><span class="secnum" id="sec-14.5.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-classdefinitionevaluation" title="link to this section">14.5.17</a></span> Runtime Semantics: ClassDefinitionEvaluation</h1>
<p>With parameter <var>className</var>.</p>
<div class="gp prod"><span class="nt">ClassTail</span> <span class="geq">:</span> <span class="nt">ClassHeritage</span><sub>opt</sub> <code class="t">{</code> <span class="nt">ClassBody</span> <code class="t">}</code></div>
<ol class="proc">
<li>If <i>ClassHeritage</i><sub>opt</sub> is not present, then
<ol class="block">
<li>Let <i>protoParent</i> be the intrinsic object %ObjectPrototype%.</li>
<li>Let <i>constructorParent</i> be the intrinsic object %FunctionPrototype%.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>superclass</i> be the result of evaluating <i>ClassHeritage</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>superclass</i>).</li>
<li>If <i>superclass</i> is <b>null</b>, then
<ol class="block">
<li>Let <i>protoParent</i> be <b>null</b>.</li>
<li>Let <i>constructorParent</i> be the intrinsic object %FunctionPrototype%.</li>
</ol>
</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>superclass</i>) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Else
<ol class="block">
<li>Let <i>protoParent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>superclass</i>, <code>"prototype"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>protoParent</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>protoParent</i>) is neither Object nor Null,
throw a <b>TypeError</b> exception.</li>
<li>Let <i>constructorParent</i> be <i>superclass</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<i>protoParent</i>).</li>
<li>Let <i>lex</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>If <i>className</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>lex</i>).</li>
<li>Let <i>envRec</i> be <i>scope’s</i> environment record.</li>
<li>Call the CreateImmutableBinding concrete method of <i>envRec</i> passing <i>className</i> as the argument.</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>scope</i>.</li>
</ol>
</li>
<li>Let <i>constructor</i> be ConstructorMethod of <i>ClassBody</i>.</li>
<li>If <i>constructor</i> is <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>If <i>ClassHeritage</i><sub>opt</sub> is present, then
<ol class="block">
<li>Let <i>constructor</i> be the result of parsing the String <code>"constructor(... args){ super</code>
<code>(...args);}"</code> using the syntactic grammar with the goal symbol <i>MethodDefinition.</i></li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>constructor</i> be the result of parsing the String <code>"constructor( ){ }"</code> using the
syntactic grammar with the goal symbol <i>MethodDefinition.</i></li>
</ol>
</li>
</ol>
</li>
<li>Let <i>strict</i> be <b>true</b>.</li>
<li>Let <i>constructorInfo</i> be the result of performing DefineMethod for <i>constructor</i> with arguments <i>proto</i>
and <i>constructorParent</i> as the optional <i>functionPrototype</i> argument.</li>
<li>Let <i>F</i> be <i>constructorInfo</i>.[[closure]]</li>
<li>Perform the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a> with argument <i>F</i> and
<b>false</b> as the optional <i>writablePrototype</i> argument and <i>proto</i> as the optional <i>prototype</i>
argument.</li>
<li>Let <i>desc</i> be the PropertyDescriptor{[[Enumerable]]: <b>false</b>, [[Writable]]: <b>true</b>, [[Configurable]]:
<b>true</b>}.</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>proto</i> with arguments <code>"constructor"</code> and
<i>desc</i></li>
<li>Let <i>protoMethods</i> be PrototypeMethodDefinitions of <i>ClassBody</i>.</li>
<li>For each <i>MethodDefinition</i> <i>m</i> in order from <i>protoMethods</i>
<ol class="block">
<li>Let <i>status</i> be the result of performing PropertyDefinitionEvaluation for <i>m</i> with argument
<i>proto</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Let <i>staticMethods</i> be StaticMethodDefinitions of <i>ClassBody</i>.</li>
<li>For each <i>MethodDefinition</i> <i>s</i> in order from <i>staticMethods</i>
<ol class="block">
<li>Let <i>status</i> be the result of performing PropertyDefinitionEvaluation for <i>s</i> with argument
<i>F</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Set <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>lex</i>.</li>
<li>If <i>className</i> is not <b>undefined</b>, then
<ol class="block">
<li>Call the InitializeBinding concrete method of <i>envRec</i> passing <i>className</i> and <i>F</i> as the
arguments.</li>
</ol>
</li>
<li>Return <i>F</i>.</li>
</ol>
</section>
<section id="sec-class-definitions-runtime-semantics-evaluation">
<h1><span class="secnum" id="sec-14.5.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-runtime-semantics-evaluation" title="link to this section">14.5.18</a></span> Runtime Semantics: Evaluation</h1>
<div class="gp prod"><span class="nt">ClassDeclaration</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>Let className be StringValue(BindingIdentifier).</li>
<li>Let value be the result of ClassDefinitionEvaluation of <i>ClassTail</i> with argument className</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(value).</li>
<li>Let hasNameProperty be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(value, <code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(hasNameProperty).</li>
<li>If hasNameProperty is <b>false</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(value, className).</li>
</ol>
</li>
<li>Let env be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let status be the result of performing BindingInitialization for BindingIdentifier passing value and env as the
arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(status).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
</ol>
<div class="gp prod"><span class="nt">ClassExpression</span> <span class="geq">:</span> <code class="t">class</code> <span class="nt">BindingIdentifier</span><sub>opt</sub> <span class="nt">ClassTail</span></div>
<ol class="proc">
<li>If <i>BindingIdentifier</i><sub>opt</sub> is not present, then let <i>className</i> be <b>undefined</b>.</li>
<li>Else, let <i>className</i> be StringValue(<i>BindingIdentifier</i>).</li>
<li>Let <i>value</i> be the result of ClassDefinitionEvaluation of <i>ClassTail</i> with argument <i>className</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <i>className</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>hasNameProperty</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>value</i>,
<code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasNameProperty</i>).</li>
<li>If <i>hasNameProperty</i> is <b>false</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>value</i>, <i>className</i>).</li>
</ol>
</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>value</i>).</li>
</ol>
</section>
</section>
<section id="sec-tail-position-calls">
<div class="front">
<h1><span class="secnum" id="sec-14.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tail-position-calls" title="link to this section">14.6</a></span> Tail
Position Calls</h1>
</div>
<section id="sec-intailposition">
<h1><span class="secnum" id="sec-14.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-intailposition" title="link to this section">14.6.1</a></span> Static
Semantics: InTailPosition(nonterminal) Abstract Operation</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>nonterminal</i> is a parsed grammar production.</li>
<li>If the source code matching <i>nonterminal</i> is not <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then return
<b>false.</b></li>
<li>If <i>nonterminal</i> is not contained within a <i>FunctionBody</i> or <i>ConciseBody</i>, then return
<b>false</b>.</li>
<li>Let <i>body</i> be the <i>FunctionBody</i> or <i>ConciseBody</i> that most closely contains <i>nonterminal</i>.</li>
<li>If <i>body</i> is the <i>FunctionBody</i> of a <i>GeneratorMethod</i>, <i>GeneratorDeclaration</i>, or a
<i>GeneratorExpression</i>, then return <b>false</b>.</li>
<li>Return the result of HasProductionInTailPosition of <i>body</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Tail Position calls are only defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode
code</a> because of a common non-standard language extension (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">see
9.2.8</a>) that enables observation of the chain of caller contexts.</p>
</div>
</section>
<section id="sec-static-semantics-hasproductionintailposition">
<div class="front">
<h1><span class="secnum" id="sec-14.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-hasproductionintailposition" title="link to this section">14.6.2</a></span> Static Semantics: HasProductionInTailPosition</h1>
<p>With parameter <var>nonterminal</var>.</p>
</div>
<section id="sec-statement-rules">
<h1><span class="secnum" id="sec-14.6.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-rules" title="link to this section">14.6.2.1</a></span>
Statement Rules</h1>
<div class="gp prod"><span class="nt">ConciseBody</span> <span class="geq">:</span> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>AssignmentExpression</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">StatementList</span> <span class="geq">:</span> <span class="nt">StatementList</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Let <i>has</i> be HasProductionInTailPosition of <i>StatementList</i> with argument <i>nonterminal</i>.</li>
<li>If <i>has</i> is <b>true,</b> then return <b>true</b>.</li>
<li>Return HasProductionInTailPosition of <i>StatementListItem</i> with argument <i>nonterminal</i>.</li>
</ol>
<p><span class="prod"><span class="nt">StatementListItem</span> <span class="geq">:</span> <span class="nt">Declaration</span></span></p>
<div class="gp">
<div class="lhs"><span class="nt">Statement</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">VariableStatement</span></div>
<div class="rhs"><span class="nt">EmptyStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
<div class="rhs"><span class="nt">ContinueStatement</span></div>
<div class="rhs"><span class="nt">BreakStatement</span></div>
<div class="rhs"><span class="nt">ThrowStatement</span></div>
<div class="rhs"><span class="nt">DebuggerStatement</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span> <code class="t">:</code> <code class="t">return</code> <code class="t">;</code></div>
<div class="rhs"><span class="nt">CaseBlock</span> <code class="t">:</code> <code class="t">{</code> <code class="t">}</code></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">IfStatement</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span> <code class="t">else</code> <span class="nt">Statement</span></div>
<ol class="proc">
<li>Let <i>has</i> be HasProductionInTailPosition of the first <i>Statement</i> with argument <i>nonterminal</i>.</li>
<li>If <i>has</i> is <b>true,</b> then return <b>true</b>.</li>
<li>Return HasProductionInTailPosition of the second <i>Statement</i> with argument <i>nonterminal</i>.</li>
</ol>
<p><span class="prod"><span class="nt">IfStatement</span> <span class="geq">:</span> <code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></span></p>
<div class="gp">
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">do</code> <span class="nt">Statement</span> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <code class="t">;</code><sub>opt</sub></div>
<div class="rhs"><code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">VariableDeclarationList</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LexicalDeclaration</span> <span class="nt">Expression</span> <code class="t">;</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">ForBinding</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">ForDeclaration</span> <code class="t">of</code> <span class="nt">AssignmentExpression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><span class="nt">WithStatement</span> <code class="t">:</code> <code class="t">with</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LabelledStatement</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">IdentifierReference</span> <code class="t">:</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">yield</code> <code class="t">:</code> <span class="nt">Statement</span></div>
</div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>Statement</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ReturnStatement</span> <span class="geq">:</span> <code class="t">return</code> <span class="nt">Expression</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>Expression</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">SwitchStatement</span> <span class="geq">:</span> <code class="t">switch</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">CaseBlock</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>CaseBlock</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseBlock</span> <span class="geq">:</span> <code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <span class="nt">DefaultClause</span> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<ol class="proc">
<li>Let <i>has</i> be <b>false</b>.</li>
<li>If the first <i>CaseClauses</i> is present, let <i>has</i> be HasProductionInTailPosition of the first
<i>CaseClauses</i> with argument <i>nonterminal</i>.</li>
<li>If <i>has</i> is <b>true,</b> then return <b>true</b>.</li>
<li>Let <i>has</i> be HasProductionInTailPosition of the <i>DefaultClause</i> with argument <i>nonterminal</i>.</li>
<li>If <i>has</i> is <b>true,</b> then return <b>true</b>.</li>
<li>If the second <i>CaseClauses</i> is present, let <i>has</i> be HasProductionInTailPosition of the second
<i>CaseClauses</i> with argument <i>nonterminal</i>.</li>
<li>Return <i>has</i>.</li>
</ol>
<div class="gp prod"><span class="nt">CaseClauses</span> <span class="geq">:</span> <span class="nt">CaseClauses</span> <span class="nt">CaseClause</span></div>
<ol class="proc">
<li>Let <i>has</i> be HasProductionInTailPosition of <i>CaseClauses</i> with argument <i>nonterminal</i>.</li>
<li>If <i>has</i> is <b>true,</b> then return <b>true</b>.</li>
<li>Return HasProductionInTailPosition of <i>CaseClause</i> with argument <i>nonterminal</i>.</li>
</ol>
<p><span class="prod"><span class="nt">CaseClause</span> <span class="geq">:</span> <code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></span></p>
<div class="gp prod"><span class="nt">DefaultClause</span> <span class="geq">:</span> <code class="t">default</code> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
<ol class="proc">
<li>If <i>StatementList</i> is present, return HasProductionInTailPosition of <i>StatementList</i> with argument
<i>nonterminal</i>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>Catch</i> with argument <i>nonterminal</i>.</li>
</ol>
<p><span class="prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Finally</span></span></p>
<div class="gp prod"><span class="nt">TryStatement</span> <span class="geq">:</span> <code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span> <span class="nt">Finally</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>Finally</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">Catch</span> <span class="geq">:</span> <code class="t">catch</code> <code class="t">(</code> <span class="nt">CatchParameter</span> <code class="t">)</code> <span class="nt">Block</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>Finally</i> with argument <i>nonterminal</i>.</li>
</ol>
</section>
<section id="sec-expression-rules">
<h1><span class="secnum" id="sec-14.6.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-expression-rules" title="link to this section">14.6.2.2</a></span> Expression Rules</h1>
<div class="note">
<p><span class="nh">NOTE</span> A potential tail position call that is immediately followed by return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a> of the call result is also a possible tail position call. Functional calls can not
return reference values, so such a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a> operation will always returns the same value as
the actual function call result.</p>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AssignmentExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">YieldExpression</span></div>
<div class="rhs"><span class="nt">ArrowFunction</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">=</code> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">BitwiseANDExpression</span> <code class="t">:</code> <span class="nt">BitwiseANDExpression</span> <code class="t">&amp;</code> <span class="nt">EqualityExpression</span></div>
<div class="rhs"><span class="nt">BitwiseXORExpression</span> <code class="t">:</code> <span class="nt">BitwiseXORExpression</span> <code class="t">^</code> <span class="nt">BitwiseANDExpression</span></div>
<div class="rhs"><span class="nt">BitwiseORExpression</span> <code class="t">:</code> <span class="nt">BitwiseORExpression</span> <code class="t">|</code> <span class="nt">BitwiseXORExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">EqualityExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">==</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!=</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">===</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!==</code> <span class="nt">RelationalExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RelationalExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">instanceof</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">in</code> <span class="nt">ShiftExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ShiftExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&lt;&lt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AdditiveExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">+</code> <span class="nt">MultiplicativeExpression</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">-</code> <span class="nt">MultiplicativeExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MultiplicativeExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">*</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">/</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">%</code> <span class="nt">UnaryExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">UnaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">delete</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">void</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">typeof</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">++</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">--</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">~</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">!</code> <span class="nt">UnaryExpression</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PostfixExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">--</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CallExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">super</code> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">super</code> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PrimaryExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">this</code></div>
<div class="rhs"><span class="nt">IdentifierReference</span></div>
<div class="rhs"><span class="nt">Literal</span></div>
<div class="rhs"><span class="nt">ArrayInitializer</span></div>
<div class="rhs"><span class="nt">ObjectLiteral</span></div>
<div class="rhs"><span class="nt">FunctionExpression</span></div>
<div class="rhs"><span class="nt">ClassExpression</span></div>
<div class="rhs"><span class="nt">GeneratorExpression</span></div>
<div class="rhs"><span class="nt">GeneratorComprehension</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
<div class="rhs"><span class="nt">TemplateLiteral</span></div>
</div>
<ol class="proc">
<li>Return <b>false</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">Expression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">Expression</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
</div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>AssignmentExpression</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ConditionalExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">?</code> <span class="nt">AssignmentExpression</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>has</i> be HasProductionInTailPosition of the first <i>AssignmentExpression</i> with argument
<i>nonterminal</i>.</li>
<li>If <i>has</i> is <b>true,</b> then return <b>true</b>.</li>
<li>Return HasProductionInTailPosition of the second <i>AssignmentExpression</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LogicalANDExpression</span> <span class="geq">:</span> <span class="nt">LogicalANDExpression</span> <code class="t">&amp;&amp;</code> <span class="nt">BitwiseORExpression</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>BitwiseORExpression</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp prod"><span class="nt">LogicalORExpression</span> <span class="geq">:</span> <span class="nt">LogicalORExpression</span> <code class="t">||</code> <span class="nt">LogicalANDExpression</span></div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>LogicalANDExpression</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">CallExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><code class="t">super</code> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">TemplateLiteral</span></div>
</div>
<ol class="proc">
<li>If this <i>CallExpression</i> is <i>nonterminal</i><b>,</b> then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">TemplateLiteral</span></div>
<div class="rhs"><code class="t">new</code> <code class="t">super</code> <span class="nt">Arguments</span><sub>opt</sub></div>
<div class="rhs"><code class="t">new</code> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
</div>
<ol class="proc">
<li>If this <i>MemberExpression</i> is <i>nonTerminal</i><b>,</b> then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">NewExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">new</code> <span class="nt">NewExpression</span></div>
</div>
<ol class="proc">
<li>If this <i>NewExpression</i> is <i>nonterminal</i><b>,</b> then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="gp prod"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> <span class="nt">CoverParenthesizedExpressionAndArrowParameterList</span></div>
<ol class="proc">
<li>Let <i>expr</i> be CoveredParenthesizedExpression of <i>CoverParenthesizedExpressionAndArrowParameterList</i>.</li>
<li>Return HasProductionInTailPosition of <i>expr</i> with argument <i>nonterminal</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ParenthesizedExpression</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></div>
</div>
<ol class="proc">
<li>Return HasProductionInTailPosition of <i>Expression</i> with argument <i>nonterminal</i>.</li>
</ol>
</section>
</section>
<section id="sec-runtime-semantics-preparefortailcall">
<h1><span class="secnum" id="sec-14.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-preparefortailcall" title="link to this section">14.6.3</a></span> Runtime Semantics: PrepareForTailCall</h1>
<p>The abstract operation PrepareForTailCall performs the following steps:</p>
<ol class="proc">
<li>Let <i>leafContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>leafContext</i>.</li>
<li>Pop <i>leafContext</i> from the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context context stack</a>. The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> now on the top of the stack becomes <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>, however it remains in its <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> state.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>leafContext</i> has no further use. It will never be activated as
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
</ol>
<p>A tail position call must either release any transient internal resources associated with the currently executing
function <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> before invoking the target function or reuse those
resources in support of the target function.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> For example, a tail position call should only grow an implementation’s activation
record stack by the amount that the size of the target function’s activation record exceeds the size of the calling
function’s activation record. If the target function’s activation record is smaller, then the total size of
the stack should decrease.</p>
</div>
</section>
</section>
</section>
<section id="sec-ecmascript-language-scripts-and-modules">
<div class="front">
<h1><span class="secnum" id="sec-15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-scripts-and-modules" title="link to this section">15</a></span> ECMAScript Language: Scripts and Modules</h1>
</div>
<section id="sec-scripts">
<div class="front">
<h1><span class="secnum" id="sec-15.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts" title="link to this section">15.1</a></span> Scripts</h1>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Script</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ScriptBody</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ScriptBody</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">StatementList</span></div>
</div>
</div>
<section id="sec-scripts-static-semantics-early-errors">
<h1><span class="secnum" id="sec-15.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-early-errors" title="link to this section">15.1.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">ScriptBody</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ul>
<li>
<p>It is a Syntax Error if the LexicallyDeclaredNames of <span class="nt">StatementList</span> contains any duplicate
entries.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the <span style="font-family: Times New Roman">LexicallyDeclaredNames</span>
of <span class="nt">StatementList</span> also occurs in the <span style="font-family: Times New
Roman">VarDeclaredNames</span> of <span class="nt">StatementList</span>.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">StatementList</span> <span style="font-family: Times New
Roman">Contains</span> <code>super</code>.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> Additional error conditions relating to conflicting or duplicate declarations are checked
during module linking prior to evaluation of a <i>Script</i>. If any such errors are detected the <i>Script</i> is not
evaluated.</p>
</div>
</section>
<section id="sec-scripts-static-semantics-isstrict">
<h1><span class="secnum" id="sec-15.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-isstrict" title="link to this section">15.1.2</a></span> Static Semantics: IsStrict</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isstrict">14.1.13</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-isstrict">15.2.0.7</a>.</p>
<div class="gp prod"><span class="nt">ScriptBody</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>If this <i>ScriptBody</i> is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if <i>StatementList</i>
is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then return <b>true</b>. Otherwise, return <b>false</b>.</li>
</ol>
</section>
<section id="sec-scripts-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-15.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames" title="link to this section">15.1.3</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames">15.2.0.10</a>.</p>
<div class="gp prod"><span class="nt">ScriptBody</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return TopLevelLexicallyDeclaredNames of <i>StatementList</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> At the top level of a <i>Script</i>, function declarations are treated like var
declarations rather than like lexical declarations.</p>
</div>
</section>
<section id="sec-static-semantics-lexicallyscopeddeclarations">
<h1><span class="secnum" id="sec-15.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-lexicallyscopeddeclarations" title="link to this section">15.1.4</a></span> Static Semantics: LexicallyScopedDeclarations</h1>
<div class="gp prod"><span class="nt">ScriptBody</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return TopLevelLexicallyScopedDeclarations of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-scripts-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-15.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames" title="link to this section">15.1.5</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames">15.2.0.13</a>.</p>
<div class="gp prod"><span class="nt">ScriptBody</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return TopLevelVarDeclaredNames of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-scripts-static-semantics-varscopeddeclarations">
<h1><span class="secnum" id="sec-15.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-varscopeddeclarations" title="link to this section">15.1.6</a></span> Static Semantics: VarScopedDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-varscopeddeclarations">13.1.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-varscopeddeclarations">15.2.0.14</a>.</p>
<div class="gp prod"><span class="nt">ScriptBody</span> <span class="geq">:</span> <span class="nt">StatementList</span></div>
<ol class="proc">
<li>Return TopLevelVarScopedDeclarations of <i>StatementList</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-script-evaluation">
<h1><span class="secnum" id="sec-15.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-script-evaluation" title="link to this section">15.1.7</a></span> Runtime Semantics: Script Evaluation</h1>
<p>With argument <span style="font-family: Times New Roman"><i>realm</i> and <i>deletableBindings</i></span>.</p>
<div class="gp prod"><span class="nt">Script</span> <span class="geq">:</span> <span class="nt">ScriptBody</span><sub>opt</sub></div>
<ol class="proc">
<li>The code of this <i>Script</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> if the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Directive Prologue</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">14.1.1</a>) of its <i>ScriptBody</i> contains a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-directive-prologues-and-the-use-strict-directive">Use Strict Directive</a> or if any of the conditions of
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a> apply. If the code of this <i>Script</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, <i>ScriptBody</i> is evaluated in the following steps as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>. Otherwise <i>ScriptBody</i> is evaluated in the following steps as
non-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>.</li>
<li>If <i>ScriptBody</i> is not present, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>).</li>
<li>Let <i>globalEnv</i> be <i>realm</i>.[[globalEnv]].</li>
<li>Let <i>status</i> be GlobalDeclarationInstantiation(<i>ScriptBody</i>, <i>globalEnv</i>, and
<i>deletableBindings</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>progCxt</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">ECMAScript code execution context</a>.</li>
<li>Set the <i>progCxt’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> to <i>realm</i>.</li>
<li>Set the <i>progCxt’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> to <i>globalEnv</i>.</li>
<li>Set the <i>progCxt’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>globalEnv</i>.</li>
<li>If there is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">currently running execution context</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspend</a> it.</li>
<li>Push <i>progCxt</i> on to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>progCxt</i> is now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>result</i> be the result of evaluating <i>ScriptBody</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>progCxt</i> and remove it from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the
execution context stack</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> is not empty, resume the context that is now on
the top of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the
running execution context</a>. Otherwise, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> is now
empty and there is no running <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a>.</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The processes for initiating the evaluation of a <i>Script</i> and for dealing with the
result of such an evaluation are defined by an ECMAScript implementation and not by this specification.</p>
</div>
</section>
<section id="sec-runtime-semantics-globaldeclarationinstantiation">
<h1><span class="secnum" id="sec-15.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-globaldeclarationinstantiation" title="link to this section">15.1.8</a></span> Runtime Semantics: GlobalDeclarationInstantiation</h1>
<div class="note">
<p><span class="nh">NOTE</span> When an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> is established for
evaluating scripts, declarations are instantiated in the current global environment. Each global binding declared in the
code is instantiated.</p>
</div>
<p>GlobalDeclarationInstantiation is performed as follows using arguments <span style="font-family: Times New
Roman"><i>script</i>,</span> <span style="font-family: Times New Roman"><i>env</i>,</span> <span style="font-family: Times
New Roman">and <i>deletableBindings</i></span>. <var>script</var> is the <span class="nt">ScriptBody</span> that for which
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> is being established. <var>env</var> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global environment record</a> in which bindings are to be created.
<var>deletableBindings</var> is <span class="value">true</span> if the bindings that are created should be deletable.</p>
<ol class="proc">
<li>Let <i>strict</i> be IsStrict of <i>script</i>.</li>
<li>Let <i>lexNames</i> be the LexicallyDeclaredNames of <i>script</i>.</li>
<li>Let <i>varNames</i> be the VarDeclaredNames of <i>script</i>.</li>
<li>For each <i>name</i> in <i>lexNames</i>, do
<ol class="block">
<li>If the result of calling <i>env’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasvardeclaration">HasVarDeclaration</a> concrete method
passing <i>name</i> as the argument is <b>true</b>, throw a <b>SyntaxError</b> exception.</li>
<li>If the result of calling <i>env’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-haslexicaldeclaration">HasLexicalDeclaration</a>
concrete method passing <i>name</i> as the argument is <b>true</b>, throw a <b>SyntaxError</b> exception.</li>
</ol>
</li>
<li>For each <i>name</i> in <i>varNames</i>, do
<ol class="block">
<li>If the result of calling <i>env’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-haslexicaldeclaration">HasLexicalDeclaration</a>
concrete method passing <i>name</i> as the argument is <b>true</b>, throw a <b>SyntaxError</b> exception.</li>
</ol>
</li>
<li>Let <i>varDeclarations</i> be the VarScopedDeclarations of <i>script</i>.</li>
<li>Let <i>functionsToInitialize</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>declaredFunctionNames</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>d</i> in <i>varDeclarations</i>, in reverse list order do
<ol class="block">
<li>If <i>d</i> is a <i>FunctionDeclaration</i> then
<ol class="block">
<li>NOTE If there are multiple <span style="font-family: Times New
Roman"><i>FunctionDeclarations</i></span> for the same name, the last declaration is used.</li>
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>d.</i></li>
<li>If <i>fn</i> is not an element of <i>declaredFunctionNames</i>, then
<ol class="block">
<li>Let <i>fnDefinable</i> be the result of calling <i>env’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-candeclareglobalfunction">CanDeclareGlobalFunction</a> concrete method passing <i>fn</i> as the
argument.</li>
<li>If <i>fnDefinable</i> is <b>false</b>, throw <b>TypeError</b> exception.</li>
<li>Append <i>fn</i> to <i>declaredFunctionNames</i>.</li>
<li>Append <i>d</i> to <i>functionsToInitialize</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>declaredVarNames</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>d</i> in <i>varDeclarations</i>, do
<ol class="block">
<li>If <i>d</i> is a <i>VariableStatement</i> then
<ol class="block">
<li>For each String <i>vn</i> in the BoundNames of <i>d</i>, do
<ol class="block">
<li>If <i>vn</i> is not an element of <i>declaredFunctionNames</i>, then
<ol class="block">
<li>Let <i>vnDefinable</i> be the result of calling <i>env’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-candeclareglobalvar">CanDeclareGlobalVar</a> concrete method passing <i>vn</i> as the
argument.</li>
<li>If <i>vnDefinable</i> is <b>false</b>, throw <b>TypeError</b> exception.</li>
<li>If <i>vn</i> is not an element of <i>declaredVarNames</i>, then
<ol class="block">
<li>Append <i>vn</i> to <i>declaredVarNames</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>NOTE: No abnormal terminations occur after this algorithm step.</li>
<li>For each <i>FunctionDeclaration</i> <i>f</i> in <i>functionsToInitialize</i>, do
<ol class="block">
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>f.</i></li>
<li>Let <i>fo</i> be the result of performing InstantiateFunctionObject for <i>f</i> with argument <i>env</i>.</li>
<li>Let <i>status</i> be the result of calling <i>env</i>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalfunctionbinding">CreateGlobalFunctionBinding</a> concrete method passing <i>fn</i>,
<i>fo</i>, and <i>deletableBindings</i> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>For each String <i>vn</i> in <i>declaredVarNames</i>, in list order do
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createglobalvarbinding">CreateGlobalVarBinding</a> concrete method passing <i>vn</i> and
<i>deletableBindings</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Let <i>lexDeclarations</i> be the LexicallyScopedDeclarations of <i>script</i>.</li>
<li>For each element <i>d</i> in <i>lexDeclarations</i> do
<ol class="block">
<li>NOTE Except for generator function declarations, lexically declarated names are only instantiated here but not
initialized.</li>
<li>For each element <i>dn</i> of the BoundNames of <i>d</i> do
<ol class="block">
<li>If IsConstantDeclaration of <i>d</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env</i>’s CreateImmutableBinding concrete method
passing <i>dn</i> as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env</i>’s CreateMutableBinding concrete method passing
<i>dn</i> and <b>false</b> as the arguments.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> for lexically declared names.</li>
</ol>
</li>
<li>If <i>d</i> is a <i>GeneratorDeclaration</i> production, then
<ol class="block">
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>d.</i></li>
<li>Let <i>fo</i> be the result of performing InstantiateFunctionObject for <i>d</i> with argument
<i>env</i>.</li>
<li>Let <i>status</i> be the result of calling <i>env</i>’s SetMutableBinding concrete method passing
<i>fn</i>, <i>fo</i>, and <b>false</b> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family: sans-serif">empty</span>)</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Early errors specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-early-errors">15.1.1</a>
prevent name conflicts between function/var declarations and let/const/class declarations as well as redeclaration of
let/const/class bindings for declaration contained within a single <i>Script</i>. However, such conflicts and
redeclarations that span more than one <i>Script</i> are detected as runtime errors during GlobalDeclarationInstantiation.
If any such errors are detected, no bindings are instantiated for the script.</p>
<p>Unlike explicit var or function declarations, properties that are directly created on the global object result in
global bindings that may be shadowed by let/const/class declarations.</p>
</div>
</section>
</section>
<section id="sec-modules">
<div class="front">
<h1><span class="secnum" id="sec-15.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-modules" title="link to this section">15.2</a></span> Modules</h1>
<div class="gp">
<div class="lhs"><span class="nt">Module</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ModuleBody</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ModuleBody</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ModuleItemList</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ModuleItemList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ModuleItem</span></div>
<div class="rhs"><span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ModuleItem</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ImportDeclaration</span></div>
<div class="rhs"><span class="nt">ExportDeclaration</span></div>
<div class="rhs"><span class="nt">StatementListItem</span></div>
</div>
</div>
<section id="sec-module-static-semantics">
<div class="front">
<h1><span class="secnum" id="sec-15.2.0"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics" title="link to this section">15.2.0</a></span> Module Static Semantics</h1>
</div>
<section id="sec-module-static-semantics-static-semantics-early-errors">
<h1><span class="secnum" id="sec-15.2.0.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-early-errors" title="link to this section">15.2.0.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">ModuleBody</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span></div>
<ul>
<li>
<p>It is a Syntax Error if the LexicallyDeclaredNames of <span class="nt">ModuleItemList</span> contains any duplicate
entries.</p>
</li>
<li>
<p>It is a Syntax Error if the ExportedBindings of <span class="nt">ModuleItemList</span> contains any duplicate
entries.</p>
</li>
<li>
<p>It is a Syntax Error if any element of the LexicallyDeclaredNames of <span class="nt">ModuleItemList</span> also
occurs in the VarDeclaredNames of <span class="nt">ModuleItemList</span>.</p>
</li>
<li>
<p>It is a Syntax Error if <span class="nt">ModuleItemList</span> Contains <code>super</code>.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> Additional error conditions relating to conflicting or duplicate declarations are
checked during module linking prior to evaluation of a <i>Module</i>. If any such errors are detected the <i>Module</i>
is not evaluated.</p>
</div>
</section>
<section id="sec-static-semantics-declarednames">
<h1><span class="secnum" id="sec-15.2.0.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-declarednames" title="link to this section">15.2.0.2</a></span> Static Semantics: DeclaredNames</h1>
<div class="gp prod"><span class="nt">Module</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">Module</span> <span class="geq">:</span> <span class="nt">ModuleBody</span></div>
<ol class="proc">
<li>Let <i>names</i> be LexicallyDeclaredNames of <i>ModuleBody</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaratedNames of <i>ModuleBody.</i></li>
<li>Return <i>names</i>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-exportedbindings">
<h1><span class="secnum" id="sec-15.2.0.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-exportedbindings" title="link to this section">15.2.0.3</a></span> Static Semantics: ExportedBindings</h1>
<p>See also:<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-exportedbindings">15.2.2.2</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be ExportedBindings of <i>ModuleItemList</i>.</li>
<li>Append to <i>names</i> the elements of the ExportedBindings of <i>ModuleItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ModuleItem</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ImportDeclaration</span></div>
<div class="rhs"><span class="nt">StatementListItem</span></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-exportentries">
<h1><span class="secnum" id="sec-15.2.0.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-exportentries" title="link to this section">15.2.0.4</a></span> Static Semantics: ExportEntries</h1>
<p>See also:<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-exportentries">15.2.2.3</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>entries</i> be ExportEntries of <i>ModuleItemList</i>.</li>
<li>Append to <i>entries</i> the elements of the ExportEntries of <i>ModuleItem.</i></li>
<li>Return <i>entries</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ModuleItem</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ImportDeclaration</span></div>
<div class="rhs"><span class="nt">StatementListItem</span></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-static-semantics-importedbindings">
<h1><span class="secnum" id="sec-15.2.0.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-importedbindings" title="link to this section">15.2.0.5</a></span> Static Semantics: ImportedBindings</h1>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be ImportedBindings of <i>ModuleItemList</i>.</li>
<li>Append to <i>names</i> the elements of the ImportedBindings of <i>ModuleItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ImportDeclaration</span></span></p>
<ol class="proc">
<li>Return the BoundNames of <i>ImportDeclaration</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ModuleItem</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ExportDeclaration</span></div>
<div class="rhs"><span class="nt">StatementListItem</span></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-importentries">
<h1><span class="secnum" id="sec-15.2.0.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-importentries" title="link to this section">15.2.0.6</a></span> Static Semantics: ImportEntries</h1>
<p>See also:<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-importentries">15.2.1.3</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>entries</i> be ImportEntries of <i>ModuleItemList</i>.</li>
<li>Append to <i>entries</i> the elements of the ImportEntries of <i>ModuleItem.</i></li>
<li>Return <i>entries</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ModuleItem</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ExportDeclaration</span></div>
<div class="rhs"><span class="nt">StatementListItem</span></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-isstrict">
<h1><span class="secnum" id="sec-15.2.0.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-isstrict" title="link to this section">15.2.0.7</a></span> Static Semantics: IsStrict</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-isstrict">14.1.13</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-isstrict">15.1.2</a>.</p>
<div class="gp prod"><span class="nt">ModuleBody</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span></div>
<ol class="proc">
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-static-semantics-knownexportentries">
<h1><span class="secnum" id="sec-15.2.0.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-knownexportentries" title="link to this section">15.2.0.8</a></span> Static Semantics: KnownExportEntries</h1>
<div class="gp prod"><span class="nt">ModuleBody</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span></div>
<ol class="proc">
<li>Let <i>allExports</i> be ExportEntries of <i>ModuleItemList</i>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing all the entries of
<i>allEntries</i> whose [[ImportName]] field is not <span style="font-family: sans-serif">all</span>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-modulerequests">
<h1><span class="secnum" id="sec-15.2.0.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-modulerequests" title="link to this section">15.2.0.9</a></span> Static Semantics: ModuleRequests</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-modulerequests">15.2.1.5</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-modulerequests">15.2.2.5</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Return ModuleRequests of <i>ModuleItem</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>moduleNames</i> be ModuleRequests of <i>ModuleItemList</i>.</li>
<li>Let <i>additionalNames</i> be ModuleRequests of <i>ModuleItem.</i></li>
<li>Append to <i>moduleNames</i> each element of <i>additionalNames</i> that is not already an element of
<i>moduleNames.</i></li>
<li>Return <i>moduleNames</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-lexicallydeclarednames">
<h1><span class="secnum" id="sec-15.2.0.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicallydeclarednames" title="link to this section">15.2.0.10</a></span> Static Semantics: LexicallyDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicallydeclarednames">13.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicallydeclarednames">13.11.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-lexicaldeclarations">14.1.14</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-lexicaldeclarations">14.2.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-isfunctiondefinition">14.4.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-lexicallydeclarednames">14.5.10</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be LexicallyDeclaredNames of <i>ModuleItemList</i>.</li>
<li>Append to <i>names</i> the elements of the LexicallyDeclaredNames of <i>ModuleItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ImportDeclaration</span></span></p>
<ol class="proc">
<li>Return the BoundNames of <i>ImportDeclaration</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ExportDeclaration</span></div>
<ol class="proc">
<li>If <i>ExportDeclaration</i> is <code>export</code> <i>VariableStatement</i><code>;</code> then return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return the BoundNames of <i>ExportDeclaration</i>..</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">StatementListItem</span></div>
<ol class="proc">
<li>Return LexicallyDeclaredNames of <i>StatementListItem</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> At the top level of a <i>Module</i>, function declarations are treated like lexical
declarations rather than like var declarations.</p>
</div>
</section>
<section id="sec-module-static-semantics-static-semantics-lexicaldeclarations">
<h1><span class="secnum" id="sec-15.2.0.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-lexicaldeclarations" title="link to this section">15.2.0.11</a></span> Static Semantics: LexicalDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-lexicaldeclarations">13.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-lexicaldeclarations">13.11.2</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be LexicalDeclarations of <i>ModuleItemList</i>.</li>
<li>Append to <i>declarations</i> the elements of the LexicalDeclarations of <i>ModuleItem.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ImportDeclaration</span></span></p>
<ol class="proc">
<li>If the BoundNames of <i>ImportDeclarations</i> is empty, then return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>ImportDeclaration</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ExportDeclaration</span></div>
<ol class="proc">
<li>If <i>ExportDeclaration</i> is <code>export</code> <i>Declaration</i><code>;</code> then return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>Declaration</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-static-semantics-unknownexportentries">
<h1><span class="secnum" id="sec-15.2.0.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-unknownexportentries" title="link to this section">15.2.0.12</a></span> Static Semantics: UnknownExportEntries</h1>
<div class="gp prod"><span class="nt">ModuleBody</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span></div>
<ol class="proc">
<li>Let <i>allExports</i> be ExportEntries of <i>ModuleItemList</i>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing all the entries of
<i>allEntries</i> whose [[ImportName]] field is <span style="font-family: sans-serif">all</span>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-vardeclarednames">
<h1><span class="secnum" id="sec-15.2.0.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-vardeclarednames" title="link to this section">15.2.0.13</a></span> Static Semantics: VarDeclaredNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-statement-semantics-static-semantics-vardeclarednames">13.0.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-vardeclarednames">13.1.8</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-if-statement-static-semantics-vardeclarednames">13.5.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-do-while-statement-static-semantics-vardeclarednames">13.6.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-while-statement-static-semantics-vardeclarednames">13.6.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-statement-static-semantics-vardeclarednames">13.6.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">13.6.4.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement-static-semantics-vardeclarednames">13.10.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-switch-statement-static-semantics-vardeclarednames">13.11.4</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-labelled-statements-static-semantics-vardeclarednames">13.12.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement-static-semantics-vardeclarednames">13.14.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-referencessuper">14.1.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-vardeclarednames">14.4.12</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-vardeclarednames">14.5.16</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-vardeclarednames">15.1.5</a>..</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>names</i> be VarDeclaredNames of <i>ModuleItemList</i>.</li>
<li>Append to <i>names</i> the elements of the VarDeclaredNames of <i>ModuleItem.</i></li>
<li>Return <i>names</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ImportDeclaration</span></span></p>
<ol class="proc">
<li>Return an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ExportDeclaration</span></div>
<ol class="proc">
<li>If <i>ExportDeclaration</i> is <code>export</code> <i>VariableStatement</i><code>;</code> then return BoundNames of
<i>ExportDeclaration</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-module-static-semantics-static-semantics-varscopeddeclarations">
<h1><span class="secnum" id="sec-15.2.0.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-varscopeddeclarations" title="link to this section">15.2.0.14</a></span> Static Semantics: VarScopedDeclarations</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block-static-semantics-varscopeddeclarations">13.1.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-varscopeddeclarations">15.1.6</a>.</p>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="grhsannot">[empty]</span></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItemList</span> <span class="geq">:</span> <span class="nt">ModuleItemList</span> <span class="nt">ModuleItem</span></div>
<ol class="proc">
<li>Let <i>declarations</i> be VarScopedDeclarations of <i>ModuleItemList</i>.</li>
<li>Append to <i>declarations</i> the elements of the VarScopedDeclarations of <i>ModuleItem.</i></li>
<li>Return <i>declarations</i>.</li>
</ol>
<p><span class="prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ImportDeclaration</span></span></p>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ExportDeclaration</span></div>
<ol class="proc">
<li>If <i>ExportDeclaration</i> is <code>export</code> <i>VariableStatement</i><code>;</code> then return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>VariableStatement</i>.</li>
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-moduledeclarationinstantiation">
<h1><span class="secnum" id="sec-15.2.0.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-moduledeclarationinstantiation" title="link to this section">15.2.0.15</a></span> Runtime Semantics: ModuleDeclarationInstantiation</h1>
<p style="background-color: #FFC000">TO DO</p>
<ol class="proc">
<li>Let <i>declarations</i> be the LexicalDeclarations of <i>code</i>.</li>
<li>Let <i>functionsToInitialize</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each element <i>d</i> in <i>declarations</i> do
<ol class="block">
<li>For each element <i>dn</i> of the BoundNames of <i>d</i> do
<ol class="block">
<li>If IsConstantDeclaration of <i>d</i> is <b>true</b>, then
<ol class="block">
<li>Call <i>env</i>’s CreateImmutableBinding concrete method passing <i>dn</i> as the argument.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env</i>’s CreateMutableBinding concrete method
passing <i>dn</i> and <b>false</b> as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>d</i> is a <i>GeneratorDeclaration</i> production or a <i>FunctionDeclaration</i> production, then
<ol class="block">
<li>Append <i>d</i> to <i>functionsToInitialize</i>.</li>
</ol>
</li>
</ol>
</li>
<li>For each production <i>f</i> in <i>functionsToInitialize</i>, in list order do
<ol class="block">
<li>Let <i>fn</i> be the sole element of the BoundNames of <i>f.</i></li>
<li>Let <i>fo</i> be the result of performing InstantiateFunctionObject for <i>f</i> with argument
<i>env</i>.</li>
<li>Call <i>env</i>’s InitializeBinding concrete method passing <i>fn</i>, and <i>fo</i> as the
arguments.</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-imports">
<div class="front">
<h1><span class="secnum" id="sec-15.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports" title="link to this section">15.2.1</a></span>
Imports</h1>
<div class="gp">
<div class="lhs"><span class="nt">ImportDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ModuleImport</span></div>
<div class="rhs"><code class="t">import</code> <span class="nt">ImportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">import</code> <span class="nt">ModuleSpecifier</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ModuleImport</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">module</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">ImportedBinding</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FromClause</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">from</code> <span class="nt">ModuleSpecifier</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ImportClause</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ImportedBinding</span></div>
<div class="rhs"><span class="nt">ImportedBinding</span> <code class="t">,</code> <span class="nt">NamedImports</span></div>
<div class="rhs"><span class="nt">NamedImports</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NamedImports</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">ImportsList</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">ImportsList</span> <code class="t">,</code> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ImportsList</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ImportSpecifier</span></div>
<div class="rhs"><span class="nt">ImportsList</span> <code class="t">,</code> <span class="nt">ImportSpecifier</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ImportSpecifier</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ImportedBinding</span></div>
<div class="rhs"><span class="nt">IdentifierName</span> <code class="t">as</code> <span class="nt">ImportedBinding</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ModuleSpecifier</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ImportedBinding</span> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">BindingIdentifier</span></div>
</div>
</div>
<section id="sec-imports-static-semantics-early-errors">
<h1><span class="secnum" id="sec-15.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-early-errors" title="link to this section">15.2.1.1</a></span> Static Semantics: Early Errors</h1>
<div class="gp prod"><span class="nt">ModuleItem</span> <span class="geq">:</span> <span class="nt">ImportDeclaration</span></div>
<ul>
<li>
<p>It is a Syntax Error if the BoundNames of <span class="nt">ImportDeclaration</span> contains any duplicate
entries.</p>
</li>
</ul>
</section>
<section id="sec-imports-static-semantics-boundnames">
<h1><span class="secnum" id="sec-15.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames" title="link to this section">15.2.1.2</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames">15.2.2.1</a>.</p>
<div class="gp prod"><span class="nt">ImportDeclaration</span> <span class="geq">:</span> <code class="t">import</code> <span class="nt">ImportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>ImportClause</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ImportDeclaration</span> <span class="geq">:</span> <code class="t">import</code> <span class="nt">ModuleSpecifier</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleImport</span> <span class="geq">:</span> <code class="t">module</code> <span class="nt">ImportedBinding</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return the BoundNames of <i>ImportedBinding</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ImportClause</span> <span class="geq">:</span> <span class="nt">ImportedBinding</span> <code class="t">,</code> <span class="nt">NamedImports</span></div>
<ol class="proc">
<li>Let <i>names</i> be the BoundNames of <i>ImportedBinding</i>.</li>
<li>Append to <i>names</i> the elements of the BoundNames of <i>NamedImports</i>.</li>
<li>Return names.</li>
</ol>
<div class="gp prod"><span class="nt">ImportsList</span> <span class="geq">:</span> <span class="nt">ImportsList</span> <code class="t">,</code> <span class="nt">ImportSpecifier</span></div>
<ol class="proc">
<li>Let <i>names</i> be the BoundNames of <i>ImportsList</i>.</li>
<li>Append to <i>names</i> the elements of the BoundNames of <i>ImportSpecifier</i>.</li>
<li>Return names.</li>
</ol>
<div class="gp prod"><span class="nt">ImportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierName</span> <code class="t">as</code> <span class="nt">ImportedBinding</span></div>
<ol class="proc">
<li>Return the BoundNames of <i>ImportedBinding</i>.</li>
</ol>
</section>
<section id="sec-imports-static-semantics-importentries">
<h1><span class="secnum" id="sec-15.2.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-importentries" title="link to this section">15.2.1.3</a></span> Static Semantics: ImportEntries</h1>
<p>See also:<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-importentries">15.2.0.6</a>.</p>
<div class="gp prod"><span class="nt">ImportDeclaration</span> <span class="geq">:</span> <code class="t">import</code> <span class="nt">ImportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>module</i> be the sole element of ModuleRequests of <i>FromClause</i>.</li>
<li>Return ImportEntriesForModule of <i>ImportClause</i> with argument <i>module</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ImportDeclaration</span> <span class="geq">:</span> <code class="t">import</code> <span class="nt">ModuleSpecifier</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleImport</span> <span class="geq">:</span> <code class="t">module</code> <span class="nt">ImportedBinding</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>module</i> be ModuleRequests of <i>FromClause</i>.</li>
<li>Let <i>localName</i> be the StringValue of <i>ImportedBinding</i>.</li>
<li>Let <i>entry</i> be the Record {[[ModuleRequest]]: <i>module</i>, [[ImportName]]: <code>"default"</code>,
[[LocalName]]: <i>localName</i> }.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>entry</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-importentriesformodule">
<h1><span class="secnum" id="sec-15.2.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-importentriesformodule" title="link to this section">15.2.1.4</a></span> Static Semantics: ImportEntriesForModule</h1>
<p>With parameter <var>module</var>.</p>
<div class="gp prod"><span class="nt">ImportClause</span> <span class="geq">:</span> <span class="nt">ImportedBinding</span> <code class="t">,</code> <span class="nt">NamedImports</span></div>
<ol class="proc">
<li>Let <i>localName</i> be the StringValue of <i>ImportedBinding</i>.</li>
<li>Let <i>defaultEntry</i> be the Record {[[ModuleRequest]]: <i>module</i>, [[ImportName]]: <code>"default"</code>,
[[LocalName]]: <i>localName</i> }.</li>
<li>Let <i>entries</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>defaultEntry.</i></li>
<li>Append to <i>entries</i> the elements of the ImportEntriesForModule of <i>NamedImports</i> with argument
<i>module</i>.</li>
<li>Return <i>entries</i>.</li>
</ol>
<div class="gp prod"><span class="nt">NamedImports</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ImportsList</span> <span class="geq">:</span> <span class="nt">ImportsList</span> <code class="t">,</code> <span class="nt">ImportSpecifier</span></div>
<ol class="proc">
<li>Let <i>specs</i> be the ImportEntriesForModule of <i>ImportsList</i> with argument <i>module</i>.</li>
<li>Append to <i>specs</i> the elements of the ImportEntitiesForModule of <i>ImportSpecifier</i> with argument
<i>module</i>.</li>
<li>Return <i>specs</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ImportSpecifier</span> <span class="geq">:</span> <span class="nt">ImportedBinding</span></div>
<ol class="proc">
<li>Let <i>localName</i> be the StringValue of <i>ImportedBinding</i>.</li>
<li>Let <i>entry</i> be the Record {[[ModuleRequest]]: <i>module</i>, [[ImportName]]: <i>localName</i> , [[LocalName]]:
<i>localName</i> }.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>entry</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ImportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierName</span> <code class="t">as</code> <span class="nt">ImportedBinding</span></div>
<ol class="proc">
<li>Let <i>importName</i> be the StringValue of <i>IdentifierName</i>.</li>
<li>Let <i>localName</i> be the StringValue of <i>ImportedBinding</i>.</li>
<li>Let <i>entry</i> be the Record {[[ModuleRequest]]: <i>module</i>, [[ImportName]]: <i>importName</i>, [[LocalName]]:
<i>localName</i> }.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>entry</i>.</li>
</ol>
</section>
<section id="sec-imports-static-semantics-modulerequests">
<h1><span class="secnum" id="sec-15.2.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-modulerequests" title="link to this section">15.2.1.5</a></span> Static Semantics: ModuleRequests</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-modulerequests">15.2.0.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-modulerequests">15.2.2.5</a>.</p>
<div class="gp prod"><span class="nt">ImportDeclaration</span> <span class="geq">:</span> <code class="t">import</code> <span class="nt">ImportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return ModuleRequests of <i>FromClause</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleImport</span> <span class="geq">:</span> <code class="t">module</code> <span class="nt">ImportedBinding</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return ModuleRequests of <i>FromClause</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ModuleSpecifier</span> <span class="geq">:</span> <span class="nt">StringLiteral</span></div>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the StringValue of
<i>StringLiteral</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-module-objects">
<h1><span class="secnum" id="sec-15.2.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-objects" title="link to this section">15.2.1.6</a></span> Runtime Semantics: Module Objects</h1>
<div class="gp prod"><span class="nt">ModuleImport</span> <span class="geq">:</span> <code class="t">module</code> <span class="nt">ImportedBinding</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<p>An <span class="nt">ModuleImport</span> imports a module and introduces a single binding within the containing module
environment. The value of such a binding as a Module object.</p>
<p>A Module object is an exotic object whose own properties corresponding corresponding to the ExportedBindings of the
module identifed by the <span class="nt">ModuleImport</span> <span class="nt">FromClause</span>. Each property name is
the StringValue of the corresponding exported binding. These are the only properties of an Module object. Each one is a
read-only property with attributes {[[Configurable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">true</span>}. Module objects are not extensible.</p>
<p style="background-color: #FFC000">TO DO</p>
<p style="background-color: #FFC000">Needs to decide whether a module object is an ordinary or an exotic object. Whether
properties are accessor or defined via [[Get]], etc.</p>
</section>
</section>
<section id="sec-exports">
<div class="front">
<h1><span class="secnum" id="sec-15.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports" title="link to this section">15.2.2</a></span>
Exports</h1>
<div class="gp">
<div class="lhs"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">export</code> <code class="t">*</code> <span class="nt">FromClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span><sub>[NoReference]</sub> <span class="nt">FromClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">VariableStatement</span></div>
<div class="rhs"><code class="t">export</code> <span class="nt">Declaration</span><sub>[Default]</sub></div>
<div class="rhs"><code class="t">export</code> <code class="t">default</code> <span class="nt">AssignmentExpression</span><sub>[In]</sub> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExportClause</span><sub>[NoReference]</sub> <span class="geq">:</span></div>
<div class="rhs"><code class="t">{</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">ExportsList</span><sub>[?NoReference]</sub> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">ExportsList</span><sub>[?NoReference]</sub> <code class="t">,</code> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExportsList</span><sub>[NoReference]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="nt">ExportSpecifier</span> <span class="grhsannot">[?NoReference]</span></div>
<div class="rhs"><span class="nt">ExportsList</span><sub>[?NoReference]</sub> <code class="t">,</code> <span class="nt">ExportSpecifier</span><sub>[?NoReference]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExportSpecifier</span><sub>[NoReference]</sub> <span class="geq">:</span></div>
<div class="rhs"><span class="grhsannot">[~NoReference]</span> <span class="nt">IdentifierReference</span></div>
<div class="rhs"><span class="grhsannot">[~NoReference]</span> <span class="nt">IdentifierReference</span> <code class="t">as</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="grhsannot">[+NoReference]</span> <span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="grhsannot">[+NoReference]</span> <span class="nt">IdentifierName</span> <code class="t">as</code> <span class="nt">IdentifierName</span></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> <i>ExportSpecifier</i> is used to export bindings from the enclosing module
<i>Module</i>. <i>ExportSpecifier</i><sub><span style="font-family: sans-serif">[</span>NoReference<span style="font-family: sans-serif">]</span></sub> is used to export bindings from a referenced <i>Module</i>. In that case
<i>IdentifierReference</i> restrictions are not applied to the naming of the items too be exported because they are not
used to create local bindings.</p>
</div>
</div>
<section id="sec-exports-static-semantics-boundnames">
<h1><span class="secnum" id="sec-15.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-boundnames" title="link to this section">15.2.2.1</a></span> Static Semantics: BoundNames</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-let-and-const-declarations-static-semantics-boundnames">13.2.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement-static-semantics-boundnames">13.2.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-runtime-semantics-bindinginitialization">12.1.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-for-in-and-for-of-statements-static-semantics-boundnames">13.6.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-boundnames">14.1.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-boundnames">14.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-static-semantics-boundnames">14.4.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-class-definitions-static-semantics-boundnames">14.5.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-boundnames">15.2.1.2</a>.</p>
<div class="gp">
<div class="lhs"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">export</code> <code class="t">*</code> <span class="nt">FromClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span> <code class="t">;</code></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<p><span style="font-family: Times New Roman"><span class="prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></span></span> <code>export</code> <span class="nt">VariableStatement</span> <code>;</code></p>
<ol class="proc">
<li>Return the BoundNames of <i>VariableStatement</i>.</li>
</ol>
<p><span style="font-family: Times New Roman"><span class="prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></span></span> <code>export</code> <span class="nt">Declaration</span><code>;</code></p>
<ol class="proc">
<li>Return the BoundNames of <i>Declaration</i>.</li>
</ol>
<p><span style="font-family: Times New Roman"><span class="prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></span></span> <code>export default</code> <span class="nt">AssignmentExpression</span><code>;</code></p>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <code>"default"</code>.</li>
</ol>
</section>
<section id="sec-exports-static-semantics-exportedbindings">
<h1><span class="secnum" id="sec-15.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-exportedbindings" title="link to this section">15.2.2.2</a></span> Static Semantics: ExportedBindings</h1>
<p>See also:<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-declarednames">15.2.0.2</a>.</p>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <code class="t">*</code> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span> <code class="t">;</code></div>
</div>
<ol class="proc">
<li>Return the ExportedBindings of this <i>ExportClause</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">export</code> <span class="nt">VariableStatement</span></div>
<div class="rhs"><code class="t">export</code> <span class="nt">Declaration</span><sub>[Default]</sub></div>
</div>
<ol class="proc">
<li>Return the BoundNames of this <i>ExportDeclaration</i>.</li>
</ol>
<p><span style="font-family: Times New Roman"><span class="prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></span></span> <code>export default</code> <span class="nt">AssignmentExpression</span><code>;</code></p>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <code>"default"</code>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportClause</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportsList</span> <span class="geq">:</span> <span class="nt">ExportsList</span> <code class="t">,</code> <span class="nt">ExportSpecifier</span></div>
<ol class="proc">
<li>Let <i>names</i> be the ExportedBindings of <i>ExportsList</i>.</li>
<li>Append to <i>names</i> the elements of the ExportedBindings of <i>ExportSpecifier</i>.</li>
<li>Return <i>names</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <span class="nt">ExportClause</span> <span class="nt">FromClause</span><sub>opt</sub> <code class="t">;</code></div>
<ol class="proc">
<li>Return the ExportedBindings of <i>ExportClause</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the StringValue of
<i>IdentifierReference</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span> <code class="t">as</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the StringValue of
<i>IdentifierName</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the StringValue of
<i>IdentifierName</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierName</span> <code class="t">as</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the StringValue of the second
<i>IdentifierName</i>.</li>
</ol>
</section>
<section id="sec-exports-static-semantics-exportentries">
<h1><span class="secnum" id="sec-15.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-exportentries" title="link to this section">15.2.2.3</a></span> Static Semantics: ExportEntries</h1>
<p>See also:<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-exportentries">15.2.0.4</a>.</p>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <code class="t">*</code> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>module</i> be the sole element of ModuleRequests of <i>FromClause</i>.</li>
<li>Let <i>entry</i> be the Record {[[ModuleRequest]]: <i>module</i>, [[ImportName]]: <span style="font-family:
sans-serif">all</span>, [[LocalName]]: <b>null</b>, [[ExportName]]: <b>null</b> }.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>entry</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <span class="nt">ExportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>module</i> be the sole element of ModuleRequests of <i>FromClause</i>.</li>
<li>Return ExportEntriesForModule of <i>ExportClause</i> with argument <i>module</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <span class="nt">ExportClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>module</i> be the sole element of ModuleRequests of <i>FromClause</i>.</li>
<li>Return ExportEntriesForModule of <i>ExportClause</i> with argument <b>null</b>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <span class="nt">VariableStatement</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>entries</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>names</i> be the BoundNames of <i>VariableStatement</i>.</li>
<li>Repeat for each <i>name</i> in <i>names,</i>
<ol class="block">
<li>Append to <i>entries</i> the Record {[[ModuleRequest]]: <b>null</b>, [[ImportName]]: <b>null</b>, [[LocalName]]:
<i>name</i>, [[ExportName]]: <i>name</i> }.</li>
</ol>
</li>
<li>Return <i>entries</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <span class="nt">Declaration</span> <code class="t">;</code></div>
<ol class="proc">
<li>Let <i>entries</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>names</i> be the BoundNames of <i>Declaration</i>.</li>
<li>Repeat for each <i>name</i> in <i>names,</i>
<ol class="block">
<li>Append to <i>entries</i> the Record {[[ModuleRequest]]: <b>null</b>, [[ImportName]]: <b>null</b>, [[LocalName]]:
<i>name</i>, [[ExportName]]: <i>name</i> }.</li>
</ol>
</li>
<li>Return <i>entries</i>.</li>
</ol>
<p><span style="font-family: Times New Roman"><span class="prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></span></span> <code>export default</code> <span class="nt">AssignmentExpression</span><code>;</code></p>
<ol class="proc">
<li>Let <i>entry</i> be the Record {[[ModuleRequest]]: <b>null</b>, [[ImportName]]: <b>null</b>, [[LocalName]]:
<code>"default"</code>, [[ExportName]]: <code>"default"</code>}.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>entry</i>.</li>
</ol>
</section>
<section id="sec-static-semantics-exportentriesformodule">
<h1><span class="secnum" id="sec-15.2.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-exportentriesformodule" title="link to this section">15.2.2.4</a></span> Static Semantics: ExportEntriesForModule</h1>
<p>With parameter <var>module</var>.</p>
<div class="gp prod"><span class="nt">ExportClause</span> <span class="geq">:</span> <code class="t">{</code> <code class="t">}</code></div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportsList</span> <span class="geq">:</span> <span class="nt">ExportsList</span> <code class="t">,</code> <span class="nt">ExportSpecifier</span></div>
<ol class="proc">
<li>Let <i>specs</i> be the ExportEntriesForModule of <i>ExportsList</i> with argument <i>module</i>.</li>
<li>Append to <i>specs</i> the elements of the ExportEntriesForModule of <i>ExportSpecifier</i> with argument
<i>module</i>.</li>
<li>Return <i>specs</i>.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span></div>
<ol class="proc">
<li>Let <i>localName</i> be the StringValue of <i>IdentifierReference</i>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the Record {[[ModuleRequest]]:
<i>module</i>, [[ImportName]]: <b>null</b>, [[LocalName]]: <i>localName</i>, [[ExportName]]: <i>localName</i>
}.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span> <code class="t">as</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Let <i>localName</i> be the StringValue of <i>IdentifierReference</i>.</li>
<li>Let <i>exportName</i> be the StringValue of <i>IdentifierName</i>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the Record {[[ModuleRequest]]:
<i>module</i>, [[ImportName]]: <b>null</b>, {[[LocalName]]: <i>localName</i>, [[ExportName]]: <i>exportName</i>
}.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Let <i>sourceName</i> be the StringValue of <i>IdentifierName</i>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the Record {[[ModuleRequest]]:
<i>module</i>, [[ImportName]]: <i>sourceName</i>, [[LocalName]]: <b>null</b>, [[ExportName]]: <i>sourceName</i>
}.</li>
</ol>
<div class="gp prod"><span class="nt">ExportSpecifier</span> <span class="geq">:</span> <span class="nt">IdentifierReference</span> <code class="t">as</code> <span class="nt">IdentifierName</span></div>
<ol class="proc">
<li>Let <i>sourceName</i> be the StringValue of the first <i>IdentifierName</i>.</li>
<li>Let <i>exportName</i> be the StringValue of the second <i>IdentifierName</i>.</li>
<li>Return a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the Record {[[ModuleRequest]]:
<i>module</i>, [[ImportName]]: <i>sourceName</i>, [[LocalName]]: <b>null</b>, [[ExportName]]: <i>exportName</i>
}.</li>
</ol>
</section>
<section id="sec-exports-static-semantics-modulerequests">
<h1><span class="secnum" id="sec-15.2.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports-static-semantics-modulerequests" title="link to this section">15.2.2.5</a></span> Static Semantics: ModuleRequests</h1>
<p>See also: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-static-semantics-static-semantics-modulerequests">15.2.0.9</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports-static-semantics-modulerequests">15.2.1.5</a>.</p>
<div class="gp prod"><span class="nt">ExportDeclaration</span> <span class="geq">:</span> <code class="t">export</code> <span class="nt">ExportClause</span> <span class="nt">FromClause</span> <code class="t">;</code></div>
<ol class="proc">
<li>Return the ModuleRequests of <i>FromClause</i>.</li>
</ol>
<div class="gp">
<div class="lhs"><span class="nt">ExportDeclaration</span> <span class="geq">:</span></div>
<div class="rhs"><code class="t">export</code> <span class="nt">ExportClause</span> <code class="t">;</code></div>
<div class="rhs"><code class="t">export</code> <span class="nt">VariableStatement</span></div>
<div class="rhs"><code class="t">export</code> <span class="nt">Declaration</span></div>
<div class="rhs"><code class="t">export</code> <code class="t">default</code> <span class="nt">AssignmentExpression</span> <code class="t">;</code></div>
</div>
<ol class="proc">
<li>Return a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</section>
</section>
<section id="sec-runtime-semantics-loader-state">
<div class="front">
<h1><span class="secnum" id="sec-15.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-loader-state" title="link to this section">15.2.3</a></span> Runtime Semantics: Loader State</h1>
</div>
<section id="sec-loader-records-and-loader-objects">
<div class="front">
<h1><span class="secnum" id="sec-15.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-records-and-loader-objects" title="link to this section">15.2.3.1</a></span> Loader Records and Loader Objects</h1>
<p>Loader Records contain the state of a of distinct module loading context. Each Loader Record has the fields defined
in <b>Table 34</b>. Loader objects (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-objects">26.3</a>) are ECMAScript objects that permit
ECMAScript code to define and manage module loading contexts.</p>
<p><b>Table 34 — Loader Record Fields</b></p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Realm]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> Record</td>
<td>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> associated with the loader. All scripts and modules evaluated by this loader run in the scope of the global object associated with this <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</td>
</tr>
<tr>
<td>[[Modules]]</td>
<td>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of</p>
<p>Record {[[Name]], [[Module]]} where [[Name]] is a String and [[Module]] is a Module Record</p>
</td>
<td>Normalized names bound to fully linked Module records. The list can contain modules whose code has not yet been evaluated. However, except for the case of cyclic imports, such modules are not exposed to user code.</td>
</tr>
<tr>
<td>[[Loads]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of Load Record</td>
<td>Outstanding asynchronous module load requests that have been made to this loader.</td>
</tr>
<tr>
<td>[[LoaderObj]</td>
<td>Object or Undefined</td>
<td>The Loader object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-objects">26.3</a>) that reflects this Loader Record.</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-createloaderrecord">
<h1><span class="secnum" id="sec-15.2.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloaderrecord" title="link to this section">15.2.3.1.1</a></span> CreateLoaderRecord(realm, object) Abstract Operation</h1>
<p>The abstract operation CreateLoaderRecord creates and returns a new Loader Record. The argument <var>realm</var> is
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> record that will be associated with Loader. The argument <var>object</var> is
the either <code>undefined</code> or the Loader object that will reflect this Loader record.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be a new Loader Record.</li>
<li>Set <i>loader</i>.[[Realm]] to <i>realm</i>.</li>
<li>Set <i>loader</i>.[[ Modules]] to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Set <i>loader</i>.[[Loads]] to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Set <i>loader</i>.[[LoaderObj]] to <i>object</i>.</li>
<li>Return <i>loader</i>.</li>
</ol>
</section>
</section>
<section id="sec-load-records-and-loadrequest-objects">
<div class="front">
<h1><span class="secnum" id="sec-15.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-load-records-and-loadrequest-objects" title="link to this section">15.2.3.2</a></span> Load Records and LoadRequest Objects</h1>
<p>The Load Record represents an attempt to locate, fetch, translate, and parse a single module.</p>
<p>Each Load Record has the fields defined in <b>Table 35</b>:</p>
<p><b>Table 35 — Load Record Fields</b></p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Status]]</td>
<td>One of: <code>"loading"</code>, <code>"loaded"</code>, <code>"linked"</code>, <code>"failed"</code>.</td>
<td>The current state of this Load request.</td>
</tr>
<tr>
<td>[[Name]]</td>
<td>String | <span class="value">undefined</span></td>
<td>The normalized name of the module being loaded, or <b>undefined</b> if loading an anonymous module.</td>
</tr>
<tr>
<td>[[LinkSets]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of LinkSet Record</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of all LinkSets that require this Load request to succeed. There is a many-to-many relation between Load records and LinkSets. A single <code>import()</code> call can have a large dependency tree, involving many Load records. Many <code>import()</code> calls, if they depend on the same module, can be waiting for a single Load to complete.</td>
</tr>
<tr>
<td>[[Metadata]]</td>
<td>Object</td>
<td>An object passed to each loader hook which hooks may use for any purpose.</td>
</tr>
<tr>
<td>[[Address]]</td>
<td>Object | <span class="value">undefined</span></td>
<td>The result of the locate hook.</td>
</tr>
<tr>
<td>[[Source]]</td>
<td>String | <span class="value">undefined</span></td>
<td>The result of the translate hook.</td>
</tr>
<tr>
<td>[[Kind]]</td>
<td>One of: <span class="value">undefined</span>, dynamic, declarative</td>
<td>Once the Load reaches the <code>"loaded"</code> state, either declarative or dynamic. If the instantiate hook returned <span class="value">undefined</span>, the module is declarative, and load.[[Body]] contains a Module parse. Otherwise, the instantiate hook returned a ModuleFactory object and [[Execute]] contains the .execute callable object.</td>
</tr>
<tr>
<td>[[Body]]</td>
<td><span class="value">undefined</span> or a parse result</td>
<td>If [[Kind]] is <b>declarative</b>, the parse of a <span class="nt">Module</span> production. Otherwise <span class="value">undefined</span>.</td>
</tr>
<tr>
<td>[[Execute]]</td>
<td></td>
<td>If [[Kind]] is <b>dynamic</b>, the value of <code>factory.execute</code>. Otherwise <span class="value">undefined</span>.</td>
</tr>
<tr>
<td>[[Dependencies]]</td>
<td>Undefined or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of Records</td>
<td>If [[Status]] is not <code>"loading"</code>, a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of pairs. Each pair consists of two strings: a module name as it appears in a module, import, or export from declaration in load.[[Body]], and the corresponding normalized module name.</td>
</tr>
<tr>
<td>[[Exception]]</td>
<td></td>
<td>If [[Status]] is "failed", the exception value that was thrown, causing the load to fail. Otherwise, null.</td>
</tr>
<tr>
<td>[[Module]]</td>
<td></td>
<td>The Module object produced by this load, or <span class="value">undefined</span>.</td>
</tr>
</tbody></table>
</figure>
<p>A LoadRequest object is an ordinary Object, inheriting from <code>Object.prototype</code> with own data properties
whose values corresponding certain fields of a corresonding Load Record. A LoadRequest object is created when the value
of those fields need to be passed to an ECMAScript function. Every LoadRequest object has <code>name</code>, and
<code>metadata</code> properties corresponding to the [[Name]] and [[Metadata]] fields of a Load Record. A LoadRequest
object may also have <code>address</code> and <code>source</code> properties corresponding to the [[Address]] and
[[Source]] fields of a Load record.</p>
</div>
<section id="sec-createload">
<h1><span class="secnum" id="sec-15.2.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createload" title="link to this section">15.2.3.2.1</a></span> CreateLoad(name) Abstract Operation</h1>
<p>The abstract operation CreateLoad creates and returns a new Load Record. The argument <var>name</var> is either
<code>undefined</code>, indicating an anonymous module, or a normalized module <span style="font-family: Times New
Roman">name</span>.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>load</i> be a new Load Record.</li>
<li>Set <i>load</i>.[[Status]] to <code>"loading"</code>.</li>
<li>Set <i>load</i>.[[Name]] to <i>name</i>.</li>
<li>Set <i>load</i>.[[LinkSets]] to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Set <i>load</i>.[[Metadata]] to <i>metadata</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%).</li>
<li>Set all other fields of <i>load</i> to <b>undefined</b>.</li>
<li>Return <i>load</i>.</li>
</ol>
</section>
<section id="sec-createloadrequestobject">
<h1><span class="secnum" id="sec-15.2.3.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloadrequestobject" title="link to this section">15.2.3.2.2</a></span> CreateLoadRequestObject(name, metadata, address, source) Abstract
Operation</h1>
<p>The abstract operation CreateLoadRequestObject performed with arguments <var>name</var>, <var>metadata</var>, and
optional arguments <var>address</var> and <var>source</var> returns a new LoadRequest Object. It performs the following
steps:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%, ()).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The following operations will never result in abrupt
completions.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a> (<i>obj</i>, <code>"name"</code>,
<i>name</i>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a> (<i>obj</i>, <code>"metadata"</code>,
<i>metadata</i>).</li>
<li>If <i>address</i> was passed, then perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a> (<i>obj</i>,
<code>"address"</code>, <i>address</i>).</li>
<li>If <i>source</i> was passed, then perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a> (<i>obj</i>,
<code>"source"</code>, <i>source</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-runtime-semantics-module-loading">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-loading" title="link to this section">15.2.4</a></span> Runtime Semantics: Module Loading</h1>
</div>
<section id="sec-loadmodule">
<h1><span class="secnum" id="sec-15.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loadmodule" title="link to this section">15.2.4.1</a></span>
LoadModule(loader, name, options) Abstract Operation</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>loader</i> is a Loader record.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Let <i>address</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"address"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>address</i>).</li>
<li>If <i>address</i> is <b>undefined</b>, let <i>step</i> be <code>"locate"</code>.</li>
<li>Else, let <i>step</i> be <code>"fetch"</code>.</li>
<li>Let <i>metadata</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseofstartloadpartwaythrough">PromiseOfStartLoadPartwayThrough</a>( <i>step</i>,
<i>loader</i>, <i>name</i>, <i>metadata</i>, <i>source</i>, <i>address</i>).</li>
</ol>
</section>
<section id="sec-requestload">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-requestload" title="link to this section">15.2.4.2</a></span>
RequestLoad(loader, request, refererName, refererAddress) Abstract Operation</h1>
<p>The RequestLoad abstract operation normalizes the given module name, <var>request</var>, and returns a Promise object
that resolves to the value of a Load object for the given module.</p>
<p>The <var>loader</var> argument is a Loader record.</p>
<p><var>request</var> is the (non-normalized) name of the module to be imported, as it appears in the import-declaration
or as the argument to <code>loader.load()</code> or <code>loader.import()</code>.</p>
<p><var>refererName</var> and <var>refererAddress</var> provide information about the context of the
<code>import()</code> call or import-declaration. This information is passed to all the <var>loader</var> hooks.</p>
<p>If the requested module is already in the <var>loader</var>'s module registry, RequestLoad returns a Promise object
for a Load with the [[Status]] field set to <code>"linked"</code>. If the requested module is loading or loaded but not
yet linked, RequestLoad returns a Promise object for an existing Load object from <var>loader</var>.[[Loads]].
Otherwise, RequestLoad starts loading the module and returns a Promise object for a new Load Record.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>F</i> be a new anonymous function as defined by CallNormalize.</li>
<li>Set <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loader</i>.</li>
<li>Set <i>F</i>’s [[Request]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>request</i>.</li>
<li>Set <i>F</i>’s [[RefererName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to <i>refererName</i>.</li>
<li>Set <i>F</i>’s [[RefererAddress]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>refererAddress</i>.</li>
<li>Let <i>p</i> be PromiseNew(<i>F</i>).</li>
<li>Let <i>G</i> be a new built-in function as defined by GetOrCreateLoad.</li>
<li>Set <i>G</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loader</i>.</li>
<li>Return PromiseThen(<i>p</i>, <i>G</i>).</li>
</ol>
</div>
<section id="sec-callnormalize-resolve-reject-functions">
<h1><span class="secnum" id="sec-15.2.4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-callnormalize-resolve-reject-functions" title="link to this section">15.2.4.2.1</a></span> CallNormalize(resolve, reject) Functions</h1>
<p>A CallNormalize function is an anonymous built-in function that calls a <var>loader</var>'s normalize hook.</p>
<p>Each CallNormalize function has internal slots [[Loader]], [[Request]], [[RefererName]], and [[RefererAddress]].</p>
<p>When a CallNormalize function <var>F</var> is called with arguments <var>resolve</var> and <var>reject</var>, the
following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the value of <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>request</i> be <i>F</i>’s [[Request]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>refererName</i> be the value of <i>F</i>’s [[RefererName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>refererAddress</i> be the value of <i>F</i>’s [[RefererAddress]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>loaderObj</i> be <i>loader</i>.[[LoaderObj]].</li>
<li>Let <i>normalizeHook</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>loaderObj</i>, <code>"normalize"</code>).</li>
<li>Let <i>name</i> be the result of calling the [[Call]] internal method of <i>normalizeHook</i> passing
<i>loaderObj</i> and (<i>request</i>, <i>refererName</i>, <i>refererAddress</i>) as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>resolve</i> passing <b>undefined</b> and
(<i>name</i>) as arguments.</li>
</ol>
</section>
<section id="sec-getorcreateload-name-functions">
<h1><span class="secnum" id="sec-15.2.4.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getorcreateload-name-functions" title="link to this section">15.2.4.2.2</a></span> GetOrCreateLoad(name) Functions</h1>
<p>A GetOrCreateLoad function is an anonymous function that gets or creates a Load Record for a given module
<var>name</var>.</p>
<p>Each GetOrCreateLoad function has a [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</p>
<p>When a GetOrCreateLoad function <var>F</var> is called with argument <var>name</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Let <i>modules</i> be the value of of <i>loaderRecord.</i>[[ Modules]],</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>loader</i>.[[ Modules], do
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>name</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>existingModule</i> be the [[value]] field of that Record.</li>
<li>Let <i>load</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createload">CreateLoad</a>(<i>name</i>).</li>
<li>Set <i>load</i>.[[Status]] to <code>"linked"</code>.</li>
<li>Set <i>load</i>.[[Module]] to <i>existingModule</i>.</li>
<li>Return <i>load</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Repeat for each Record <i>load</i> that is an element of <i>loader</i>.[[Loads]], do
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>load</i>.[[Name]], <i>name</i>) is <b>true</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i>.status is either <code>"loading"</code> or
<code>"loaded"</code>.</li>
<li>Return <i>load</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>load</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createload">CreateLoad</a>(<i>name</i>).</li>
<li>Append <i>load</i> to the the end of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>loader</i>.[[Loads]].</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtolocate">ProceedToLocate</a>(<i>loader</i>, <i>load</i>).</li>
<li>Return <i>load</i>.</li>
</ol>
</section>
</section>
<section id="sec-proceedtolocate">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtolocate" title="link to this section">15.2.4.3</a></span> ProceedToLocate(loader, load, p) Abstract Operation</h1>
<p>The ProceedToLocate abstract operation continues the asynchronous loading process at the <code>locate</code>
hook.</p>
<p>ProceedToLocate performs the following steps:</p>
<ol class="proc">
<li>Let <i>p</i> be PromiseOf(<b>undefined</b>).</li>
<li>Let <i>F</i> be a new built-in function object as defined in CallLocate.</li>
<li>Set <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loader</i>.</li>
<li>Set <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>load</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtofetch">ProceedToFetch</a>(<i>loader</i>, <i>load</i>, <i>p</i>).</li>
</ol>
</div>
<section id="sec-calllocate-functions">
<h1><span class="secnum" id="sec-15.2.4.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-calllocate-functions" title="link to this section">15.2.4.3.1</a></span> CallLocate Functions</h1>
<p>A CallLocate function is an anonymous built-in function that calls the <code>locate</code> loader hook. Each
CallLocate function has [[Loader]] and [[Load]] internal slots.</p>
<p>When a CallLocate function <var>F</var> is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the value of <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>loaderObj</i> be <i>loader</i>.[[LoaderObj]].</li>
<li>Let <i>hook</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>loaderObj</i>, <code>"locate"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hook</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>hook</i>) is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloadrequestobject">CreateLoadRequestObject</a>(<i>load</i>.[[Name]],
<i>load</i>.[[Metadata]]).</li>
<li>Return the result of calling the [[Call]] internal method of <i>hook</i> with <i>loader</i> and (<i>obj</i>) as
arguments.</li>
</ol>
</section>
</section>
<section id="sec-proceedtofetch">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtofetch" title="link to this section">15.2.4.4</a></span> ProceedToFetch(loader, load, p) Abstract Operation</h1>
<p>The ProceedToFetch abstract operation continues the asynchronous loading process at the <code>fetch</code> hook by
performing the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be a new built-in function object as defined in CallFetch.</li>
<li>Set <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loader</i>.</li>
<li>Set <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>load</i>.</li>
<li>Set <i>F</i>’s [[AddressPromise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>p</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtotranslate">ProceedToTranslate</a>(<i>loader</i>, <i>load</i>, <i>p</i>).</li>
</ol>
</div>
<section id="sec-callfetch-address-functions">
<h1><span class="secnum" id="sec-15.2.4.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-callfetch-address-functions" title="link to this section">15.2.4.4.1</a></span> CallFetch(address) Functions</h1>
<p>A CallFetch function is an anonymous built-in function that calls the <code>fetch</code> loader hook. Each CallFetch
function has [[Loader]] and [[Load]] internal slots.</p>
<p>When a CallFetch function <var>F</var> is called with argument <var>address</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the value of <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>load</i>.[[LinkSets]] is an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>, return
<b>undefined</b>.</li>
<li>Set <i>load</i>.[[Address]] to <i>address</i>.</li>
<li>Let <i>loaderObj</i> be <i>loader</i>.[[LoaderObj]].</li>
<li>Let <i>hook</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>loaderObj</i>, <code>"fetch"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hook</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>hook</i>) is false, throw a <b>TypeError</b> exception.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloadrequestobject">CreateLoadRequestObject</a>(<i>load</i>.[[Name]],
<i>load</i>.[[Metadata]], <i>address</i>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>hook</i> with <i>loader</i> and (<i>obj</i>) as
arguments.</li>
</ol>
</section>
</section>
<section id="sec-proceedtotranslate">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtotranslate" title="link to this section">15.2.4.5</a></span> ProceedToTranslate(loader, load, p) Abstract Operation</h1>
<p>The ProceedToTranslate abstract operation continues the asynchronous loading process at the <code>translate</code>
hook hook by performing performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be a new function object as defined in CallTranslate.</li>
<li>Set <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loader</i>.</li>
<li>Set <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>load</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Let <i>F</i> be a new function object as defined in CallInstantiate.</li>
<li>Set <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loader</i>.</li>
<li>Set <i>F</i>’s [[Load]] to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
<i>load</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Let <i>F</i> be a new function object as defined in InstantiateSucceeded.</li>
<li>Set <i>F</i>’s [[Loader]] to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
<i>loader</i>.</li>
<li>Set <i>F</i>’s [[Load]] to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
<i>load</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Let <i>F</i> be a new function object as defined in LoadFailed.</li>
<li>Set <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>load</i>.</li>
<li>Return PromiseCatch(<i>p</i>, <i>F</i>).</li>
</ol>
</div>
<section id="sec-calltranslate-functions">
<h1><span class="secnum" id="sec-15.2.4.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-calltranslate-functions" title="link to this section">15.2.4.5.1</a></span> CallTranslate Functions</h1>
<p>A CallTranslate function is an anonymous built-in function that calls the <code>translate</code> loader hook. Each
CallTranslate function has [[Loader]] and [[Load]] internal slots.</p>
<p>When a CallTranslate function <var>F</var> is called with argument <var>source</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the value of <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>load</i>.[[LinkSets]] is an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>, return
<b>undefined</b>.</li>
<li>Let <i>hook</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>loader</i>, <code>"translate"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hook</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>hook</i>) is false, throw a <b>TypeError</b> exception.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloadrequestobject">CreateLoadRequestObject</a>(<i>load</i>.[[Name,
<i>load</i>.[[Metadata]], <code>"</code>, <i>load</i>.[[Address]], <i>source</i>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>hook</i> with <i>loader</i> and (<i>obj</i>) as
arguments.</li>
</ol>
</section>
<section id="sec-callinstantiate-functions">
<h1><span class="secnum" id="sec-15.2.4.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-callinstantiate-functions" title="link to this section">15.2.4.5.2</a></span> CallInstantiate Functions</h1>
<p>A CallInstantiate function is an anonymous built-in function that calls the <code>instantiate</code>
<var>loader</var> <var>hook</var>. Each CallInstantiate function has [[Loader]] and [[Load]] internal slots.</p>
<p>When a CallInstantiate function <var>F</var> is called with argument <var>source</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the value of <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>load</i>.[[LinkSets]] is an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>, return
<b>undefined</b>.</li>
<li>Set <i>load</i>.[[Source]] to <i>source</i>.</li>
<li>Let <i>loaderObj</i> be <i>loader</i>.[[LoaderObj]].</li>
<li>Let <i>hook</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>loaderObj</i>, <code>"instantiate"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hook</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>hook</i>) is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloadrequestobject">CreateLoadRequestObject</a>(<i>load</i>.[[Name]],
<i>load</i>.[[Metadata]], <i>load</i>.[[Address]], <i>source</i>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>hook</i> with <i>loader</i> and (<i>obj</i>) as
arguments.</li>
</ol>
</section>
<section id="sec-instantiatesucceeded-instantiateresult-functions">
<h1><span class="secnum" id="sec-15.2.4.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instantiatesucceeded-instantiateresult-functions" title="link to this section">15.2.4.5.3</a></span> InstantiateSucceeded(instantiateResult) Functions</h1>
<p>An InstantiateSucceeded function is an anonymous function that handles the result of the <code>instantiate</code>
hook.</p>
<p>Each InstantiateSucceeded function has [[Loader]] and [[Load]] internal slots.</p>
<p>When an InstantiateSucceeded function <var>F</var> is called with argument <var>instantiateResult</var>, the
following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the value of <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>load</i>.[[LinkSets]] is an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>, return
<b>undefined</b>.</li>
<li>If <i>instantiateResult</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>body</i> be the result of parsing <i>load</i>.[[Source]], interpreted as UTF-16 encoded Unicode text as
described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">clause 10.1.1</a>, using <i>Module</i> as the
goal symbol. Throw a <b>SyntaxError</b> exception if the parse fails or if any static semantics errors are
detected.</li>
<li>Set <i>load</i>.[[Body]] to <i>body</i>.</li>
<li>Set <i>load</i>.[[Kind]] to <span style="font-family: sans-serif">declarative</span>.</li>
<li>Let <i>depsList</i> be the ModuleRequests of <i>body</i>.</li>
</ol>
</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>instantiateResult</i>) is Object, then
<ol class="block">
<li>Let <i>deps</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>instantiateResult</i>, <code>"deps"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deps</i>).</li>
<li>If <i>deps</i> is undefined, then let <i>depsList</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Else,
<ol class="block">
<li>Let <i>depsList</i> be IterableToArray(<i>deps</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>depsList</i>).</li>
</ol>
</li>
<li>Let <i>execute</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>instantiateResult</i>, <code>"execute"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>execute</i>).</li>
<li>Set <i>load</i>.[[Execute]] to <i>execute</i>.</li>
<li>Set <i>load</i>.[[Kind]] to <span style="font-family: sans-serif">dynamic</span>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-processloaddependencies">ProcessLoadDependencies</a>(<i>load</i>, <i>loader</i>,
<i>depsList</i>).</li>
</ol>
</section>
<section id="sec-loadfailed-functions">
<h1><span class="secnum" id="sec-15.2.4.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loadfailed-functions" title="link to this section">15.2.4.5.4</a></span> LoadFailed Functions</h1>
<p>A LoadFailed function is an anonymous function that marks a Load Record as having failed. All LinkSets that depend on
the Load also fail.</p>
<p>Each LoadFailed function has a [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</p>
<p>When a LoadFailed function <var>F</var> is called with argument <var>exc</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i>.[[Status]] is <code>"loading"</code>.</li>
<li>Set <i>load</i>.[[Status]] to `"failed".</li>
<li>Set <i>load</i>.[[Exception]] to <i>exc</i>.</li>
<li>Let <i>linkSets</i> be a copy of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>load</i>.[[LinkSets]].</li>
<li>For each <i>linkSet</i> in <i>linkSets</i>, in the order in which the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkset-records">LinkSet
Records</a> were created,
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linksetfailed">LinkSetFailed</a>(<i>linkSet</i>, <i>exc</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i>.[[LinkSets]] is empty.</li>
</ol>
</section>
</section>
<section id="sec-processloaddependencies">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-processloaddependencies" title="link to this section">15.2.4.6</a></span> ProcessLoadDependencies(load, loader, depsList) Abstract
Operation</h1>
<p>The ProcessLoadDependencies abstract operation is called after one module has nearly finished loading. It starts new
loads as needed to <var>load</var> the module's dependencies.</p>
<p>ProcessLoadDependencies also arranges for LoadSucceeded to be called.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>refererName</i> be <i>load</i>.[[Name]].</li>
<li>Set <i>load</i>. [[Dependencies]] to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>loadPromises</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>request</i> in <i>depsList</i>, do
<ol class="block">
<li>Let <i>p</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-requestload">RequestLoad</a>(<i>loader</i>, <i>request</i>, <i>refererName</i>,
<i>load</i>.[[Address]]).</li>
<li>Let <i>F</i> be a new built-in function as defined by AddDependencyLoad.</li>
<li>Set the [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>load</i>.</li>
<li>Set the [[Request]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>request</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Append <i>p</i> as the last element of <i>loadPromises</i>.</li>
</ol>
</li>
<li>Let <i>p</i> be PromiseAll(<i>loadPromises</i>).</li>
<li>Let <i>F</i> be a new built-in function as defined by LoadSucceeded.</li>
<li>Set the [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>F</i> to
<i>load</i>.</li>
<li>Return PromiseThen(<i>p</i>, <i>F</i>).</li>
</ol>
</div>
<section id="sec-adddependencyload-depload-functions">
<h1><span class="secnum" id="sec-15.2.4.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-adddependencyload-depload-functions" title="link to this section">15.2.4.6.1</a></span> AddDependencyLoad(depLoad) Functions</h1>
<p>An AddDependencyLoad function is an anonymous function that adds a Load Record for a dependency to any LinkSets
associated with the parent Load.</p>
<p>Each AddDependencyLoad function has [[ParentLoad]] and [[Request]] internal slots.</p>
<p>When an AddDependencyLoad function <var>F</var> is called with argument <var>depLoad</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>parentLoad</i> be the value of <i>F</i>’s [[ParentLoad]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>request</i> be the value of <i>F</i>’s [[Request]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: There is no Record in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>parentLoad</i>.[[Dependencies]] whose [[key]] field is
equal to <i>request</i>.</li>
<li>Append the Record {[[key]]: <i>request</i>, [[value]]: <i>depLoad</i>.[[Name]]} to the end of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>parentLoad</i>.[[Dependencies]].</li>
<li>If <i>depLoad</i>.[[Status]] is not <code>"linked"</code>, then
<ol class="block">
<li>Let <i>linkSets</i> be a copy of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>parentLoad</i>.[[LinkSets]].</li>
<li>For each <i>linkSet</i> in <i>linkSets</i>, do
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addloadtolinkset">AddLoadToLinkSet</a>(<i>linkSet</i>, <i>depLoad</i>).</li>
</ol>
</li>
</ol>
</li>
</ol>
</section>
<section id="sec-loadsucceeded-functions">
<h1><span class="secnum" id="sec-15.2.4.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loadsucceeded-functions" title="link to this section">15.2.4.6.2</a></span> LoadSucceeded Functions</h1>
<p>A LoadSucceeded function is an anonymous function that transitions a Load Record from <code>"loading"</code> to
<code>"loaded"</code> and notifies all associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkset-records">LinkSet Records</a> of the change. This
function concludes the loader pipeline. It is called after all a newly loaded module's dependencies are successfully
processed.</p>
<p>Each LoadSucceeded function has a [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</p>
<p>When a LoadSucceeded function <var>F</var> is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>load</i> be the value of <i>F</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i>.[[Status]] is <code>"loading"</code>.</li>
<li>Set <i>load</i>.[[Status]] to <code>"loaded"</code>.</li>
<li>Let <i>linkSets</i> be a copy of <i>load</i>.[[LinkSets]].</li>
<li>For each <i>linkSet</i> in <i>linkSets</i> in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> order, do
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-updatelinksetonload">UpdateLinkSetOnLoad</a>(<i>linkSet</i>, <i>load</i>).</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-promiseofstartloadpartwaythrough">
<div class="front">
<h1><span class="secnum" id="sec-15.2.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseofstartloadpartwaythrough" title="link to this section">15.2.4.7</a></span> PromiseOfStartLoadPartwayThrough (step, loader, name, metadata,
source, address)</h1>
<ol class="proc">
<li>Let <i>F</i> be a new anonymous function object as defined in AsyncStartLoadPartwayThrough.</li>
<li>Let <i>state</i> be the Record { [[Step]]: <code>"translate"</code>, [[Loader]]: <i>loader</i>, [[ModuleName]]:
<i>name</i>, [[ModuleMetadata]]: <i>metadata</i>, [[ModuleSource]]: <i>source</i>, [[ModuleAddress]]:
<i>address</i>}.</li>
<li>Set <i>F</i>’s [[StepState]] ]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to <i>state</i>.</li>
<li>Return PromiseNew(<i>F</i>).</li>
</ol>
</div>
<section id="sec-asyncstartloadpartwaythrough-functions">
<h1><span class="secnum" id="sec-15.2.4.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-asyncstartloadpartwaythrough-functions" title="link to this section">15.2.4.7.1</a></span> AsyncStartLoadPartwayThrough Functions</h1>
<p>An AsyncStartLoadPartwayThrough function is an anonymous function that is used as a Promise executor. When called it
creates a new Load Record and populates it with some information provided by the caller, so that loading can proceed
from either the <code>locate</code> hook, the <code>fetch</code> hook, or the <code>translate</code> hook. This
functionality is used to implement builtin methods like <code>Loader.prototype.load</code>, which permits the user to
specify both the normalized module <var>name</var> and the <var>address</var>.</p>
<p>Each AsyncStartLoadPartwayThrough function has internal slots [[StepState]].</p>
<p>When an AsyncStartLoadPartwayThrough function <var>F</var> is called with arguments <var>resolve</var> and
<var>reject</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>state</i> be the value of <i>F</i>’s [[StepState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>loader</i> be <i>state</i>.[[Loader]].</li>
<li>Let <i>name</i> be <i>state</i>.[[ModuleName]].</li>
<li>Let <i>step</i> be <i>state</i>.[[Step]].</li>
<li>Let <i>source</i> be <i>state</i>.[[ModuleSource]].</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>loader</i>.[[ Modules], do
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>name</i>) is <b>true</b>, then throw a
<b>TypeError</b> exception.</li>
</ol>
</li>
<li>Repeat for element of <i>load</i> or <i>loader</i>.[[ Modules], do
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>loads</i>.[[Name]], <i>name</i>) is <b>true</b>, then throw a
<b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>load</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createload">CreateLoad</a>(<i>name</i>).</li>
<li>Set <i>load</i>.[[Metadata]] to <i>state</i>.[[ModuleMetadata]].</li>
<li>Let <i>linkSet</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlinkset">CreateLinkSet</a>(<i>loader,</i> <i>load</i>).</li>
<li>Append <i>load</i> to the end of <i>loader</i>.[[Loads]].</li>
<li>Call the [[Call]] internal method of <i>resolve</i> with arguments <b>undefined</b> and
(<i>linkSet</i>.[[Done]]).</li>
<li>If <i>step</i> is <code>"locate"</code>,
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtolocate">ProceedToLocate</a>(<i>loader</i>, <i>load</i>).</li>
</ol>
</li>
<li>Else if <i>step</i> is <code>"fetch"</code>,
<ol class="block">
<li>Let <i>addressPromise</i> be PromiseOf(<i>state</i>.[[ModuleAddress]]).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtofetch">ProceedToFetch</a>(<i>loader</i>, <i>load</i>, <i>addressPromise</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>step</i> is <code>"translate"</code>.</li>
<li>Set <i>load</i>.[[Address]] to <i>state</i>.[[ModuleAddress]].</li>
<li>Let <i>sourcePromise</i> be PromiseOf(<i>state</i>.[[ModuleSource]]).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtotranslate">ProceedToTranslate</a>(<i>loader</i>, <i>load</i>,
<i>sourcePromise</i>).</li>
</ol>
</li>
</ol>
</section>
</section>
</section>
<section id="sec-runtime-semantics-module-linking">
<div class="front">
<h1><span class="secnum" id="sec-15.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-linking" title="link to this section">15.2.5</a></span> Runtime Semantics: Module Linking</h1>
</div>
<section id="sec-modulelinkage-record">
<div class="front">
<h1><span class="secnum" id="sec-15.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-modulelinkage-record" title="link to this section">15.2.5.1</a></span> ModuleLinkage Record</h1>
<p>A ModuleLinkage Record contains the state needed to link a specific module.</p>
<p>Each LinkSet Record has the fields defined in <b>Table 36</b>.</p>
<p><b>Table 36 — ModuleLinkage Record Fields</b></p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Body]]</td>
<td>a parse result</td>
<td>The parse of a <span class="nt">Module</span> production</td>
</tr>
<tr>
<td>[[BoundNames]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[KnownExportEntries]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[KnownExportEntries]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[ExportDefinitions]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[Exports]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[Dependenies]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[UnlinkedDependencies]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[ImportedEntries]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[ImportedDefinitions]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[LinkErrors]]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>[[Environment]]</td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-createmodulelinkagerecord">
<h1><span class="secnum" id="sec-15.2.5.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmodulelinkagerecord" title="link to this section">15.2.5.1.1</a></span> CreateModuleLinkageRecord (loader, body) Abstract Operation</h1>
<p>The abstract operation CreateModuleLinkageRecord with arguments <var>loader</var> and <var>body</var> performs the
following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>body</i> is a <i>Modulebody</i> parse.</li>
<li>Let <i>M</i> be a new object with [[Prototype]] <b>null</b>.</li>
<li>Set <i>M</i>.[[Body]] to <i>body</i>.</li>
<li>Set <i>M</i>.[[BoundNames]] to DeclaredNames of <i>body</i>.</li>
<li>Set <i>M</i>.[[KnownExportEntries]] to KnownExportEntries of <i>body</i>.</li>
<li>Set <i>M</i>.[[UnknownExportEntries]] to UnknownExportEntries of <i>body</i>.</li>
<li>Set <i>M</i>.[[ExportDefinitions]] to <b>undefined</b>.</li>
<li>Set <i>M</i>.[[Exports]] to <b>undefined</b>.</li>
<li>Set <i>M</i>.[[Dependencies]] to <b>undefined</b>.</li>
<li>Set <i>M</i>.[[UnlinkedDependencies]] to <b>undefined</b>.</li>
<li>Set <i>M</i>.[[ImportEntries]] to ImportEntries of <i>body</i>.</li>
<li>Set <i>M</i>.[[ImportDefinitions]] to <b>undefined</b>.</li>
<li>Set <i>M</i>.[[LinkErrors]] to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>realm</i> be <i>loader</i>.[[Realm]].</li>
<li>Let <i>globalEnv</i> be <i>realm</i>.[[<i>globalEnv</i>]].</li>
<li>Let <i>env</i> be NewModuleEnvironment(<i>globalEnv</i>).</li>
<li>Set <i>M</i>.[[Environment]] to <i>env</i>.</li>
<li>Return <i>M</i>.</li>
</ol>
</section>
<section id="sec-lookupexport">
<h1><span class="secnum" id="sec-15.2.5.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lookupexport" title="link to this section">15.2.5.1.2</a></span> LookupExport ( M, exportName )</h1>
<p>The abstract operation LookupExport with arguments <var>M</var> and <var>exportName</var> performs the following:</p>
<ol class="proc">
<li>If <i>M</i>.[[Exports]] does not contain a record <i>export</i> such that <i>export</i>.[[ExportName]] is equal to
<i>exportName</i>, then return <b>undefined</b>.</li>
<li>Let <i>export</i> be the record in <i>M</i>.[[Exports]] such that <i>export</i>.[[ExportName]] is equal to
<i>exportName</i>.</li>
<li>Return <i>export</i>.[[Binding]].</li>
</ol>
</section>
<section id="sec-lookupmoduledependency">
<h1><span class="secnum" id="sec-15.2.5.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lookupmoduledependency" title="link to this section">15.2.5.1.3</a></span> LookupModuleDependency ( M, requestName )</h1>
<p>The abstract operation LookupModuleDependency with arguments <var>M</var> and <var>requestName</var> performs the
following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>M</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-modulelinkage-record">ModuleLinkage
Record</a>.</li>
<li>If <i>requestName</i> is <b>null</b> then return <i>M</i>.</li>
<li>Let <i>pair</i> be the record in <i>M</i>.[[Dependencies]] such that <i>pair</i>.[[Key]] is equal to
<i>requestName</i>.</li>
<li>Return <i>pair</i>.[[Module]].</li>
</ol>
</section>
</section>
<section id="sec-linkset-records">
<div class="front">
<h1><span class="secnum" id="sec-15.2.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkset-records" title="link to this section">15.2.5.2</a></span> LinkSet Records</h1>
<p>A LinkSet Record represents a call to <code>loader.define()</code>, <code>.load()</code>, <code>.module()</code>, or
<code>.import()</code>.</p>
<p>Each LinkSet Record has the fields defined in <b>Table 37</b>.</p>
<p><b>Table 37 — LinkSet Record Fields</b></p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value Type</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Loader]]</td>
<td>Loader Record</td>
<td>The Loader record that created this LinkSet.</td>
</tr>
<tr>
<td>[[Loads]]</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of Load Record</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of the Load Records that must finish loading before the modules can be linked and evaluated.</td>
</tr>
<tr>
<td>[[Done]]</td>
<td>Promise Object</td>
<td>The Promise that becomes fulfilled when all dependencies are loaded and linked together.</td>
</tr>
<tr>
<td>[[Resolve]]</td>
<td>Function Object</td>
<td>Function used to resolve [[Done]].</td>
</tr>
<tr>
<td>[[Reject]]</td>
<td>Function Object</td>
<td>Function used to reject [[Done]].</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-createlinkset">
<h1><span class="secnum" id="sec-15.2.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlinkset" title="link to this section">15.2.5.2.1</a></span> CreateLinkSet(loader, startingLoad) Abstract Operation</h1>
<p>The CreateLinkSet abstract operation creates a new LinkSet record by performing the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>loader</i> is a Loader Record.</li>
<li>If <i>loader</i> does not have all of the internal properties of a Loader Instance, throw a TypeError
exception.</li>
<li>Let <i>promiseCapability</i> be PromiseBuiltinCapability().</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>linkSet</i> be LinkSet {[[Loader]]: <i>loader</i>, [[Loads]]: ( ), [[Done]]:
<i>promiseCapability</i>.[[Promise]], [[Resolve]]: <i>promiseCapability</i>.[[Resolve]], [[Reject]]:
<i>promiseCapability</i>.[[Reject]] }.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addloadtolinkset">AddLoadToLinkSet</a>(<i>linkSet</i>, <i>startingLoad</i>).</li>
<li>Return <i>linkSet</i>.</li>
</ol>
</section>
<section id="sec-addloadtolinkset">
<h1><span class="secnum" id="sec-15.2.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addloadtolinkset" title="link to this section">15.2.5.2.2</a></span> AddLoadToLinkSet(linkSet, load) Abstract Operation</h1>
<p>The AddLoadToLinkSet abstract operation associates a LinkSet Record with a Load Record and each of its currently
known dependencies, indicating that the LinkSet cannot be linked until those Loads have finished successfully.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i>.[[Status]] is either <code>"loading"</code> or
<code>"loaded"</code>.</li>
<li>Let <i>loader</i> be <i>linkSet</i>.[[Loader]].</li>
<li>If <i>load</i> is not already an element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>linkSet</i>.[[Loads]],
<ol class="block">
<li>Append <i>load</i> to the end of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>linkSet</i>.[[Loads]].</li>
<li>Append <i>linkSet</i> to the end of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>load</i>.[[LinkSets]].</li>
<li>If <i>load</i>.[[Status]] is <code>"loaded"</code>, then
<ol class="block">
<li>Repeat for each <i>r</i> that is a Record {[[Name]], [[NormalizedName]]} in <i>load</i>.[[Dependencies]],
<ol class="block">
<li>If there is no element of <i>loader</i>.[[ Modules]] whose [[key]] field is equal to <i>name</i>,
<ol class="block">
<li>If there is an element of <i>loader</i>.[[Loads]] whose [[Name]] field is equal to <i>name</i>,
<ol class="block">
<li>Let <i>depLoad</i> be that Load Record.</li>
<li>Perform AddLoadToLinkSet(<i>linkSet</i>, <i>depLoad</i>).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</section>
<section id="sec-updatelinksetonload">
<h1><span class="secnum" id="sec-15.2.5.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-updatelinksetonload" title="link to this section">15.2.5.2.3</a></span> UpdateLinkSetOnLoad(linkSet, load) Abstract Operation</h1>
<p>The UpdateLinkSetOnLoad abstract operation is called immediately after a Load successfully finishes, after starting
Loads for any dependencies that were not already loading, loaded, or in the module registry.</p>
<p>This operation determines whether <var>linkSet</var> is ready to link, and if so, calls <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-link">Link</a>.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i> is an element of <i>linkSet</i>.[[Loads]].</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>load</i>.[[Status]] is either <code>"loaded"</code> or
<code>"linked"</code>.</li>
<li>Repeat for each <i>element</i> in <i>linkSet</i>.[[Loads]],
<ol class="block">
<li>If <i>element</i>.[[Status]] is <code>"loading"</code>, then return.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: All Loads in <i>linkSet</i>.[[Loads]] have finished loading.</li>
<li>Let <i>startingLoad</i> be the first element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>linkSet</i>.[[Loads]].</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-link">Link</a>(<i>linkSet</i>.[[Loads]], <i>linkSet</i>.[[Loader]]).</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linksetfailed">LinkSetFailed</a>(<i>linkSet</i>, <i>status</i>.[[value]]).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>linkSet</i>.[[Loads]] is an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Call the [[Call]] internal method of <i>linkSet</i>.[[Resolve]] passing <b>undefined</b> and (<i>startingLoad</i>)
as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The call performed by step 9 completed normally.</li>
</ol>
</section>
<section id="sec-linksetfailed">
<h1><span class="secnum" id="sec-15.2.5.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linksetfailed" title="link to this section">15.2.5.2.4</a></span> LinkSetFailed(linkSet, exc) Abstract Operation</h1>
<p>The LinkSetFailed abstract operation is called when a LinkSet fails. It detaches the given LinkSet Record from all
Load Records and rejects the <var>linkSet</var>.[[Done]] Promise.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be <i>linkSet</i>.[[Loader]].</li>
<li>Let <i>loads</i> be a copy of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>linkSet</i>.[[Loads]].</li>
<li>For each <i>load</i> in <i>loads</i>,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>linkSet</i> is an element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>load</i>.[[LinkSets]].</li>
<li>Remove <i>linkSet</i> from the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>load</i>.[[LinkSets]].</li>
<li>If <i>load</i>.[[LinkSets]] is empty and <i>load</i> is an element of <i>loader</i>.[[Loads]], then
<ol class="block">
<li>Remove <i>load</i> from the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>loader</i>.[[Loads]].</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of calling [[Call]] internal method of <i>linkSet</i>.[[Reject]] passing <b>undefined</b> and
(<i>exc</i>) as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The call performed by step 4 completed normally.</li>
</ol>
</section>
<section id="sec-finishload">
<h1><span class="secnum" id="sec-15.2.5.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-finishload" title="link to this section">15.2.5.2.5</a></span> FinishLoad(loader, load) Abstract Operation</h1>
<p>The FinishLoad Abstract Operation removes a completed Load Record from all LinkSets and commits the newly loaded
Module to the registry. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>name</i> be <i>load</i>.[[Name]].</li>
<li>If <i>name</i> is not <b>undefined</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: There is no Record {[[key]], [[value]]} <i>p</i> that is an
element of <i>loader</i>.[[ Modules]], such that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]],
<i>load</i>.[[Name]]) is <b>true</b>.</li>
<li>Append the Record {[[key]]: <i>load</i>.[[Name]], [[value]]: <i>load</i>.[[Module]]} as the last element of
<i>loader</i>.[[ Modules]].</li>
</ol>
</li>
<li>If <i>load</i> is an element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>loader</i>.[[Loads]], then
<ol class="block">
<li>Remove <i>load</i> from the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>loader</i>.[[Loads]].</li>
</ol>
</li>
<li>For each <i>linkSet</i> in <i>load</i>.[[LinkSets]],
<ol class="block">
<li>Remove <i>load</i> from <i>linkSet</i>.[[Loads]].</li>
</ol>
</li>
<li>Remove all elements from the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>load</i>.[[LinkSets]].</li>
</ol>
</section>
</section>
<section id="sec-module-linking-groups">
<div class="front">
<h1><span class="secnum" id="sec-15.2.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-module-linking-groups" title="link to this section">15.2.5.3</a></span> Module Linking Groups</h1>
<p>A load record <span style="font-family: Times New Roman"><i>load</i><sub>1</sub></span> has a <b><i>linkage
dependency</i></b> on a load record <span style="font-family: Times New Roman"><i>load</i><sub>2</sub></span> if <span style="font-family: Times New Roman"><i>load</i><sub>2</sub></span> is contained in <span style="font-family: Times New
Roman"><i>load</i><sub>1</sub>.[[UnlinkedDependencies]]</span> or there exists a load record <var>load</var> in <span style="font-family: Times New Roman"><i>load</i><sub>1</sub>.[[UnlinkedDependencies]]</span> such that <var>load</var>
has a linkage dependency on <span style="font-family: Times New Roman"><i>load</i><sub>2</sub></span>.</p>
<p>The <b><i>linkage graph</i></b> of a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>, <i><span style="font-family: Times New Roman">list</span>,</i> of load records is the set of load records <var>load</var> such
that some load record in <var>list</var> has a linkage dependency on <var>load</var>.</p>
<p>A <b><i>dependency chain</i></b> from <span style="font-family: Times New Roman"><i>load</i><sub>1</sub></span> to
<span style="font-family: Times New Roman"><i>load</i><sub>2</sub></span> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of load records demonstrating the transitive linkage dependency
from <span style="font-family: Times New Roman"><i>load</i><sub>1</sub></span> to <span style="font-family: Times New
Roman"><i>load</i><sub>2</sub></span>.</p>
<p>A <b><i>dependency cycle</i></b> is a dependency chain whose first and last elements’ [[Name]] fields have the
same value.</p>
<p>A dependency chain is <b><i>cyclic</i></b> if it contains a subsequence that is a dependency cycle. A dependency
chain is <b><i>acyclic</i></b> if it is not cyclic.</p>
<p>A dependency chain is <b><i>mixed</i></b> if there are two elements with distinct values for their [[Kind]] fields. A
<b><i>dependency group transition</i></b> of kind <i>kind</i> is a two-element subsequence <span style="font-family:
Times New Roman"><i>load</i><sub>1</sub></span>, <span style="font-family: Times New
Roman"><i>load</i><sub>2</sub></span> of a dependency chain such that <span style="font-family: Times New
Roman"><i>load</i><sub>1</sub>.[[Kind]]</span> is not equal to <i>kind</i> and <span style="font-family: Times New
Roman"><i>load</i><sub>2</sub>.[[Kind]]</span> is equal to <i>kind</i>.</p>
<p>The <b><i>dependency group count</i></b> of a dependency chain with first element <span style="font-family: Times New
Roman"><i>load</i><sub>1</sub></span> is the number of distinct dependency group transitions of kind <span style="font-family: Times New Roman"><i>load</i><sub>1</sub>.[[Kind]]</span>.</p>
</div>
<section id="sec-linkagegroups">
<h1><span class="secnum" id="sec-15.2.5.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkagegroups" title="link to this section">15.2.5.3.1</a></span> LinkageGroups ( start )</h1>
<p>The abstract operation LinkageGroups with argument <var>start</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>start</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkset-records">LinkSet
Records</a>.</li>
<li>Let <i>G</i> be the linkage graph of <i>start</i>.</li>
<li>If there are any mixed dependency cycles in <i>G</i>, throw a new Syntax Error.</li>
<li>For each <i>load</i> in <i>G</i>, do
<ol class="block">
<li>Let <i>n</i> be the largest dependency group count of all acyclic dependency chains in <i>G</i> starting from
<i>load</i>.</li>
<li>Set <i>load</i>.[[GroupIndex]] to <i>n</i>.</li>
</ol>
</li>
<li>Let <i>declarativeGroupCount</i> be the largest [[GroupIndex]] of any <i>load</i> in <i>G</i> such that
<i>load</i>.[[Kind]] is <span style="font-family: sans-serif">declarative</span>.</li>
<li>Let <i>declarativeGroups</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of length
<i>declarativeGroupCount</i> where each element is a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>dynamicGroupCount</i> be the largest [[GroupIndex]] of any <i>load</i> in <i>G</i> such that
<i>load</i>.[[Kind]] is <span style="font-family: sans-serif">dynamic</span>.</li>
<li>Let <i>dynamicGroups</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of length
<i>dynamicGroupCount</i> where each element is a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>visited</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>load</i> in <i>start</i>, do
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-buildlinkagegroups">BuildLinkageGroups</a>(<i>load</i>, <i>declarativeGroups</i>,
<i>dynamicGroups</i>, and <i>visited</i>).</li>
</ol>
</li>
<li>If any <i>load</i> in the first element of <i>declarativeGroups</i> has a dependency on a load record of [[Kind]]
<span style="font-family: sans-serif">dynamic</span>, then
<ol class="block">
<li>Let <i>groups</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> constructed by interleaving
the elements of <i>dynamicGroups</i> and <i>declarativeGroups</i>, starting with the former.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>let <i>groups</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> constructed by interleaving
the elements of <i>declarativeGroups</i> and <i>dynamicGroups</i>, starting with the former.</li>
</ol>
</li>
<li>Return <i>groups</i>.</li>
</ol>
</section>
<section id="sec-buildlinkagegroups">
<h1><span class="secnum" id="sec-15.2.5.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-buildlinkagegroups" title="link to this section">15.2.5.3.2</a></span> BuildLinkageGroups ( load, declarativeGroups, dynamicGroups,
visited )</h1>
<p>The abstract operation BuildLinkageGroups with arguments <var>load</var>, <var>declarativeGroups</var>, and
<var>dynamicGroups</var> performs the following steps:</p>
<ol class="proc">
<li>If <i>visited</i> contains an element whose [[Name]] is equal to <i>load</i>.[[Name]], then return.</li>
<li>Add <i>load</i> to <i>visited</i>.</li>
<li>For each <i>dep</i> of <i>load</i>.[[UnlinkedDependencies]], do
<ol class="block">
<li>Call the BuildLinkageGroups abstract operation passing <i>dep</i>, <i>declarativeGroups</i>,
<i>dynamicGroups</i>, and <i>visited</i> as arguments.</li>
</ol>
</li>
<li>Let <i>i</i> be <i>load</i>.[[GroupIndex]].</li>
<li>If <i>load</i>.[[Kind]] is <span style="font-family: sans-serif">declarative</span> let <i>groups</i> be
<i>declarativeGroups</i>; otherwise let <i>groups</i> be <i>dynamicGroups</i>.</li>
<li>Let <i>group</i> be the <i>i</i>th element of <i>groups</i>.</li>
<li>Add <i>load</i> to <i>group</i>.</li>
</ol>
</section>
</section>
<section id="sec-link">
<h1><span class="secnum" id="sec-15.2.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-link" title="link to this section">15.2.5.4</a></span> Link (
start, loader )</h1>
<p>The abstract operation Link with argument <var>start</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>groups</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkagegroups">LinkageGroups</a>(<i>start</i>).</li>
<li>For each <i>group</i> in <i>groups</i>:
<ol class="block">
<li>If the [[Kind]] of each element of <i>group</i> is <span style="font-family: sans-serif">declarative</span>,
then perfrom <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkdeclarativemodules">LinkDeclarativeModules</a>(<i>group</i>, <i>loader</i>).</li>
<li>Else, perfrom <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkdynamicmodules">LinkDynamicModules</a>(<i>group</i>, <i>loader</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-linkdeclarativemodules">
<div class="front">
<h1><span class="secnum" id="sec-15.2.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkdeclarativemodules" title="link to this section">15.2.5.5</a></span> LinkDeclarativeModules ( loads, loader )</h1>
<p>The abstract operation LinkDeclarativeModules with arguments <var>loads</var> and <var>loader</var> performs the
following steps:</p>
<ol class="proc">
<li>Let <i>unlinked</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>load</i> in <i>loads</i>, do
<ol class="block">
<li>If <i>load</i>.[[Status]] is not <b>linked</b>, then
<ol class="block">
<li>Let <i>module</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmodulelinkagerecord">CreateModuleLinkageRecord</a>
(<i>loader</i>, <i>load</i>.[[Body]]).</li>
<li>Let <i>pair</i> be the record {[[Module]]: <i>module</i>, [[Load]]: <i>load</i>}.</li>
<li>Add <i>pair</i> to <i>unlinked</i>.</li>
</ol>
</li>
</ol>
</li>
<li>For each <i>pair</i> in <i>unlinked</i>, do
<ol class="block">
<li>Let <i>resolvedDeps</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>unlinkedDeps</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each element <i>dep</i> in <i>pair</i>.[[Load]].[[Dependencies]], do
<ol class="block">
<li>Let <i>requestName</i> be <i>dep</i>.[[Key]].</li>
<li>Let <i>normalizedName</i> be <i>dep</i>.[[Value]].</li>
<li>If <i>loads</i> contains a record <i>load</i> such that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>load</i>.[[Name]], <i>normalizedName</i>) is <b>true</b>, then
<ol class="block">
<li>If <i>load</i>.[[Status]] is <b>linked</b>, then
<ol class="block">
<li>Let <i>resolvedDep</i> be the record {[[Key]]: <i>requestName</i>, [[Value]]:
<i>load</i>.[[Module]]}.</li>
<li>Add <i>resolvedDep</i> to <i>resolvedDeps</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>otherPair</i> be the record in <i>unlinked</i> such that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>otherPair</i>.[[Load]].[[Name]], <i>normalizedName</i>) is
<b>true</b>.</li>
<li>Add the record {[[Key]]: <i>requestName</i>, [[Value]]: <i>otherPair</i>.[[Module]]} to
<i>resolvedDeps</i>.</li>
<li>Add <i>otherPair</i>.[[Load]] to <i>unlinkedDeps</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>module</i> be LoaderRegistryLookup(<i>loader</i>, <i>normalizedName</i>).</li>
<li>If <i>module</i> is <b>null</b> then
<ol class="block">
<li>Let <i>error</i> be a new <b>ReferenceError</b> exception.</li>
<li>Add <i>error</i> to <i>pair</i>.[[Module]].[[LinkErrors]].</li>
</ol>
</li>
<li>Else, add the record {[[Key]]: <i>requestName</i>, [[Value]]: <i>module</i>} to
<i>resolvedDeps.</i></li>
</ol>
</li>
</ol>
</li>
<li>Set <i>pair</i>.[[Module]].[[Dependencies]] to <i>resolvedDeps</i>.</li>
<li>Set <i>pair</i>.[[Module]].[[UnlinkedDependencies]] to <i>unlinkedDeps</i>.</li>
</ol>
</li>
<li>For each <i>pair</i> in <i>unlinked</i>, do
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexportentries">ResolveExportEntries</a>(<i>pair</i>.[[Module]], a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexports">ResolveExports</a>(<i>pair</i>.[[Module]]).</li>
</ol>
</li>
<li>For each <i>pair</i> in <i>unlinked</i>, do
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveimportentries">ResolveImportEntries</a>(<i>pair</i>.[[Module]]).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkimports">LinkImports</a>(<i>pair</i>.[[Module]]).</li>
</ol>
</li>
<li>If there exists a <i>pair</i> in <i>unlinked</i> such that <i>pair</i>.[[Module]].[[LinkErrors]] is not empty,
choose one of the link errors and throw it.</li>
<li>For each <i>pair</i> in <i>unlinked</i>, do
<ol class="block">
<li>Set <i>pair</i>.[[Load]].[[Module]] to <i>pair</i>.[[Module]].</li>
<li>Set <i>pair</i>.[[Load]].[[Status]] to <b>linked</b>.</li>
<li>Let <i>r</i> beFinishLoad(<i>loader</i>, <i>pair</i>.[[Load]]).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>r</i>).</li>
</ol>
</li>
</ol>
</div>
<section id="sec-linkimports">
<h1><span class="secnum" id="sec-15.2.5.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkimports" title="link to this section">15.2.5.5.1</a></span> LinkImports ( M )</h1>
<p>The abstract operation LinkImports with argument <var>M</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>envRec</i> be <i>M</i>.[[Environment]].</li>
<li>Let <i>defs</i> be <i>M</i>.[[ImportDefinitions]].</li>
<li>For each <i>def</i> in <i>defs</i>, do
<ol class="block">
<li>If <i>def</i>.[[ImportName]] is <b>module</b>, then the following steps are taken:
<ol class="block">
<li>Call the CreateImmutableBinding concrete method of <i>envRec</i> passing <i>def</i>.[[LocalName]] as the
argument.</li>
<li>Call the InitializeImmutableBinding concrete method of <i>envRec</i> passing <i>def</i>.[[LocalName]] and
<i>def</i>.[[Module]] as the arguments.</li>
</ol>
</li>
<li>Otherwise, the following steps are taken:
<ol class="block">
<li>Let <i>binding</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexport">ResolveExport</a>(<i>def</i>.[[Module]],
<i>def</i>.[[ImportName]]).</li>
<li>If <i>binding</i> is <b>undefined</b>, then the following steps are taken:
<ol class="block">
<li>Let <i>error</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error.</li>
<li>Add <i>error</i> to <i>M</i>.[[LinkErrors]].</li>
</ol>
</li>
<li>Otherwise, call the CreateImportBinding concrete method of <i>envRec</i> passing <i>def</i>.[[LocalName]]
and <i>binding</i> as the arguments.</li>
</ol>
</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="sec-linkdynamicmodules">
<h1><span class="secnum" id="sec-15.2.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-linkdynamicmodules" title="link to this section">15.2.5.6</a></span> LinkDynamicModules ( loads, loader )</h1>
<p>The abstract operation LinkDynamicModules with arguments <var>loads</var> and <var>loader</var> performs the following
steps:</p>
<ol class="proc">
<li>For each <i>load</i> in <i>loads</i>, do
<ol class="block">
<li>Let <i>factory</i> be <i>load</i>.[[Factory]].</li>
<li>Let <i>module</i> be the result of calling <i>factory</i> with no arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>module</i>).</li>
<li>If <i>module</i> does not have all the internal data properties of a Module Instance Object, then throw a
<b>TypeError</b> exception.</li>
<li>Set <i>load</i>.[[Module]] to <i>module</i>.</li>
<li>Set <i>load</i>.[[Status]] to <b>linked</b>.</li>
<li>Let <i>r</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-finishload">FinishLoad</a>(<i>loader</i>, <i>load</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>r</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-resolveexportentries">
<h1><span class="secnum" id="sec-15.2.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexportentries" title="link to this section">15.2.5.7</a></span> ResolveExportEntries ( M, visited )</h1>
<p>The abstract operation ResolveExportEntries with arguments <var>M</var> and <var>visited</var> performs the following
steps:</p>
<ol class="proc">
<li>If <i>M</i>.[[ExportDefinitions]] is not <b>undefined</b>, then return <i>M</i>.[[ExportDefinitions]].</li>
<li>Let <i>defs</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>boundNames</i> be <i>M</i>.[[BoundNames]].</li>
<li>For each <i>entry</i> in <i>M</i>.[[KnownExportEntries]], do
<ol class="block">
<li>Let <i>modReq</i> be <i>entry</i>.[[ModuleRequest]].</li>
<li>Let <i>otherMod</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lookupmoduledependency">LookupModuleDependency</a>(<i>M</i>,
<i>modReq</i>).</li>
<li>If <i>entry</i>.[[Module]] is <b>null</b> and <i>entry</i>.[[LocalName]] is not <b>null</b> and
<i>boundNames</i> does not contain <i>entry</i>.[[LocalName]], then the following steps are taken:
<ol class="block">
<li>Let <i>error</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error.</li>
<li>Add <i>error</i> to <i>M</i>.[[LinkErrors]].</li>
</ol>
</li>
<li>Add the record {[[Module]]: <i>otherMod</i>, [[ImportName]]: <i>entry</i>.[[ImportName]], [[LocalName]]:
<i>entry</i>.[[LocalName]], [[ExportName]]: <i>entry</i>.[[ExportName]], [[Explicit]]: <b>true</b>} to
<i>defs</i>.</li>
</ol>
</li>
<li>For each <i>modReq</i> in <i>M</i>.[[UnknownExportEntries]], do
<ol class="block">
<li>Let <i>otherMod</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lookupmoduledependency">LookupModuleDependency</a>( <i>M</i>,
<i>modReq</i>).</li>
<li>If <i>otherMod</i> is in <i>visited</i>, then the following steps are taken:
<ol class="block">
<li>Let <i>error</i> be a new Syntax Error.</li>
<li>Add <i>error</i> to <i>M</i>.[[LinkErrors]].</li>
</ol>
</li>
<li>Otherwise the following steps are taken:
<ol class="block">
<li>Add <i>otherMod</i> to <i>visited</i>.</li>
<li>Let <i>otherDefs</i> be ResolveExportEntries(<i>otherMod</i>, <i>visited</i> ).</li>
<li>For each <i>def</i> of <i>otherDefs</i>, do
<ol class="block">
<li>Add the record {[[Module]]: <i>otherMod</i>, [[ImportName]]: <i>def</i>.[[ExportName]], [[LocalName]]:
<b>null</b>, [[ExportName]]: <i>def</i>.[[ExportName]], [[Explicit]]: <b>false</b>} to <i>defs</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Set <i>M</i>.[[ExportDefinitions]] to <i>defs</i>.</li>
<li>Return <i>defs</i>.</li>
</ol>
</section>
<section id="sec-resolveexports">
<h1><span class="secnum" id="sec-15.2.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexports" title="link to this section">15.2.5.8</a></span>
ResolveExports ( M )</h1>
<p>The abstract operation ResolveExports with argument <var>M</var> performs the following steps:</p>
<ol class="proc">
<li>For each <i>def</i> in <i>M</i>.[[ExportDefinitions]], do
<ol class="block">
<li>Call the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexport">ResolveExport</a> abstract operation with arguments <i>M</i>,
<i>def</i>.[[ExportName]], and a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-resolveexport">
<h1><span class="secnum" id="sec-15.2.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveexport" title="link to this section">15.2.5.9</a></span>
ResolveExport ( M, exportName, visited )</h1>
<p>The abstract operation ResolveExport with arguments <var>M</var>, <var>exportName</var>, and <var>importName</var>
performs the following steps:</p>
<ol class="proc">
<li>Let <i>exports</i> be <i>M</i>.[[Exports]].</li>
<li>If <i>exports</i> has a record <i>export</i> such that <i>export</i>.[[ExportName]] is equal to <i>exportName</i>,
return <i>export</i>.[[Binding]].</li>
<li>Let <i>ref</i> be {[[Module]]: <i>M</i>, [[ExportName]]: <i>exportName</i>}.</li>
<li>If <i>visited</i> contains a record equal to <i>ref</i> then the following steps are taken:
<ol class="block">
<li>Let <i>error</i> be a new Syntax Error.</li>
<li>Add <i>error</i> to <i>M</i>.[[LinkErrors]].</li>
<li>Return <i>error</i>.</li>
</ol>
</li>
<li>Let <i>defs</i> be <i>M</i>.[[ExportDefinitions]].</li>
<li>Let <i>overlappingDefs</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of records <i>def</i>
in <i>defs</i> such that <i>def</i>.[[ExportName]] is equal to <i>exportName</i>.</li>
<li>If <i>overlappingDefs</i> is empty, then the following steps are taken:
<ol class="block">
<li>Let <i>error</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> Error.</li>
<li>Add <i>error</i> to <i>M</i>.[[LinkErrors]].</li>
<li>Return <i>error</i>.</li>
</ol>
</li>
<li>If <i>overlappingDefs</i> has more than one record <i>def</i> such that <i>def</i>.[[Explicit]] is <b>true</b>, or
if it has length greater than 1 but contains no records <i>def</i> such that <i>def</i>.[[Explicit]] is <b>true</b>,
then the following steps are taken:
<ol class="block">
<li>Let <i>error</i> be a new Syntax Error.</li>
<li>Add <i>error</i> to <i>M</i>.[[LinkErrors]].</li>
<li>Return <i>error</i>.</li>
</ol>
</li>
<li>Let <i>def</i> be the unique record in <i>overlappingDefs</i> such that <i>def</i>.[[Explicit]] is <b>true</b>, or
if there is no such record let <i>def</i> be the unique record in <i>overlappingDefs</i>.</li>
<li>If <i>def</i>.[[LocalName]] is not <b>null</b>, then the following steps are taken:
<ol class="block">
<li>Let <i>binding</i> be the record {[[Module]]: <i>M</i>, [[LocalName]]: <i>def</i>.[[LocalName]]}.</li>
<li>Let <i>export</i> be the record {[[ExportName]]: <i>exportName</i>, [[Binding]]: <i>binding</i>}.</li>
<li>Add <i>export</i> to <i>exports</i>.</li>
<li>Return <i>binding</i>.</li>
</ol>
</li>
<li>Add <i>ref</i> to <i>visited</i>.</li>
<li>Let <i>binding</i> be ResolveExport(<i>def</i>.[[Module]], <i>def</i>.[[ImportName]]).</li>
<li>Return <i>binding</i>.</li>
</ol>
</section>
<section id="sec-resolveimportentries">
<h1><span class="secnum" id="sec-15.2.5.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-resolveimportentries" title="link to this section">15.2.5.10</a></span> ResolveImportEntries ( M )</h1>
<p>The abstract operation ResolveImportEntries is called with argument <var>M</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>entries</i> be <i>M</i>.[[ImportEntries]].</li>
<li>Let <i>defs</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each <i>entry</i> in <i>entries</i>, do
<ol class="block">
<li>Let <i>modReq</i> be <i>entry</i>.[[ModuleRequest]].</li>
<li>Let <i>otherMod</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lookupmoduledependency">LookupModuleDependency</a>(<i>M</i>,
<i>modReq</i>).</li>
<li>Add the record {[[Module]]: <i>otherMod</i>, [[ImportName]]: <i>entry</i>.[[ImportName]], [[LocalName]]:
<i>entry</i>.[[LocalName]]} to <i>defs</i>.</li>
</ol>
</li>
<li>Return <i>defs</i>.</li>
</ol>
</section>
</section>
<section id="sec-runtime-semantics-module-evaluation">
<div class="front">
<h1><span class="secnum" id="sec-15.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-module-evaluation" title="link to this section">15.2.6</a></span> Runtime Semantics: Module Evaluation</h1>
<p>Module bodies are evaluated on demand, as late as possible. The loader uses the function <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ensureevaluated">EnsureEvaluated</a></code>, defined below, to run scripts. The loader always calls <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ensureevaluated">EnsureEvaluated</a></code> before returning a Module object to user code.</p>
<p>There is one way a module can be exposed to script before its body has been evaluated. In the case of an import cycle,
whichever module is evaluated first can observe the others before they are evaluated. Simply put, we have to start
somewhere: one of the modules in the cycle must run before the others.</p>
</div>
<section id="sec-evaluateloadedmodule-load-functions">
<h1><span class="secnum" id="sec-15.2.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-evaluateloadedmodule-load-functions" title="link to this section">15.2.6.1</a></span> EvaluateLoadedModule(load) Functions</h1>
<p>An EvaluateLoadedModule function is an anonymous built-in function that is used by <b>Loader<span style="font-family:
monospace">.prototype.<i>module</i></span></b> and Loader<code>.prototype.import</code> to ensure that a <var>module</var>
has been evaluated before it is passed to script code.</p>
<p>Each EvaluateLoadedModule function has a [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</p>
<p>When a EvaluateLoadedModule function <var>F</var> is called with argument <var>load</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be <i>F</i>.[[Loader]].</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: load.[[Status]] is <code>"linked"</code>.</li>
<li>Let <i>module</i> be load.[[Module]].</li>
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ensureevaluated">EnsureEvaluated</a>(<i>module</i>, (), <i>loader</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>Return <i>module</i>.</li>
</ol>
</section>
<section id="sec-ensureevaluated">
<h1><span class="secnum" id="sec-15.2.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ensureevaluated" title="link to this section">15.2.6.2</a></span>
EnsureEvaluated(mod, seen, loader) Abstract Operation</h1>
<p>The abstract operation EnsureEvaluated walks the dependency graph of the module <var>mod</var>, evaluating any module
bodies that have not already been evaluated (including, finally, <var>mod</var> itself). Modules are evaluated in
depth-first, left-to-right, post order, stopping at cycles.</p>
<p><var>mod</var> and its dependencies must already be linked.</p>
<p>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <var>seen</var> is used to detect cycles. <var>mod</var>
must not already be in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <var>seen</var>.</p>
<p>On success, <var>mod</var> and all its dependencies, transitively, will have started to evaluate exactly once.</p>
<p>EnsureEvaluated performs the following steps:</p>
<ol class="proc">
<li>If <i>mod</i>.[[Evaluated]] is <b>true</b>, return <b>undefined</b>.</li>
<li>Append <i>mod</i> as the last element of <i>seen</i>.</li>
<li>Create the module environment for <i>mod</i></li>
<li>Let <i>deps</i> be <i>mod</i>.[[Dependencies]].</li>
<li>For each <i>pair</i> in <i>deps</i>, in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> order,
<ol class="block">
<li>Let <i>dep</i> be <i>pair</i>.[[value]].</li>
<li>If <i>dep</i> is not an element of <i>seen</i>, then
<ol class="block">
<li>Call EnsureEvaluated with the arguments <i>dep</i>, <i>seen</i>, and <i>loader</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>mod</i>.[[Evaluated]] is <b>true</b>, return <b>undefined</b>.</li>
<li>Set <i>mod</i>.[[Evaluated]] to <b>true</b>.</li>
<li>If <i>mod</i>.[[Body]] is <b>undefined</b>, then return <b>undefined</b>.</li>
<li>Let status be ModuleDeclarationInstantiation(<i>mod</i>.[[Body]], <i>mod</i>.[[Environment]]).</li>
<li>Let <i>initContext</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">ECMAScript code execution context</a>.</li>
<li>Set <i>initContext</i>'s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> to <i>loader</i>.[[Realm]].</li>
<li>Set <i>initContext</i>'s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> to
<i>mod</i>.[[Environment]].</li>
<li>Set <i>initContext</i>'s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to
<i>mod</i>.[[Environment]].</li>
<li>If there is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">currently running execution context</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspend</a> it.</li>
<li>Push <i>initContext</i> on to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>initContext</i>
is now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>r</i> be the result of evaluating <i>mod</i>.[[Body]].</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>initContext</i> and remove it from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>.</li>
<li>Resume the context, if any, that is now on the top of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context
stack</a> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Return <i>r</i>.</li>
</ol>
</section>
</section>
</section>
</section>
<section id="sec-error-handling-and-language-extensions">
<h1><span class="secnum" id="sec-16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-handling-and-language-extensions" title="link to this section">16</a></span> Error Handling and Language Extensions</h1>
<p>An implementation must report most errors at the time the relevant ECMAScript language construct is evaluated. An <i>early
error</i> is an error that can be detected and reported prior to the evaluation of any construct in the <span class="nt">Script</span> containing the error. An implementation must report early errors in a <span class="nt">Script</span>
prior to the first evaluation of that <span class="nt">Script</span>. Early errors in <b>eval</b> code are reported at the time
<code>eval</code> is called but prior to evaluation of any construct within the <b>eval</b> code. All errors that are not early
errors are runtime errors.</p>
<p>An implementation must treat as an early error any instance of an early error that is specified in a static</p>
<p>An implementation shall not treat other kinds of errors as early errors even if the compiler can prove that a construct
cannot execute without error under any circumstances. An implementation may issue an early warning in such a case, but it should
not report the error until the relevant construct is actually executed.</p>
<p>An implementation shall report all errors as specified, except for the following:</p>
<ul>
<li>
<p>An implementation may extend script syntax and regular expression pattern or flag syntax. To permit this, all operations
(such as calling <code>eval</code>, using a regular expression literal, or using the <code>Function</code> or
<code>RegExp</code> constructor) that are allowed to throw <b>SyntaxError</b> are permitted to exhibit
implementation-defined behaviour instead of throwing <b>SyntaxError</b> when they encounter an implementation-defined
extension to the script syntax or regular expression pattern or flag syntax.</p>
</li>
<li>
<p>An implementation may provide additional types, values, objects, properties, and functions beyond those described in this
specification. This may cause constructs (such as looking up a variable in the global scope) to have implementation-defined
behaviour instead of throwing an error (such as <b>ReferenceError</b>).</p>
</li>
</ul>
<p>An implementation may define behaviour other than throwing <b>RangeError</b> for <code>toFixed</code>,
<code>toExponential</code>, and <code>toPrecision</code> when the <var>fractionDigits</var> or <var>precision</var> argument is
outside the specified range.</p>
</section>
<section id="sec-ecmascript-standard-built-in-objects">
<h1><span class="secnum" id="sec-17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects" title="link to this section">17</a></span> ECMAScript Standard Built-in Objects</h1>
<p>There are certain built-in objects available whenever an ECMAScript <span class="nt">Script</span> begins execution. One, the
global object, is part of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a> of the executing program. Others are
accessible as initial properties of the global object or indirectly as properties of accessible built-in objects.</p>
<p>Unless specified otherwise, a built-in object that is callable as a function is a Built-in Function object with the
characteristics described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects">9.3</a>. Unless specified otherwise, the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of a built-in object initially has the value
<b>true</b>. Every built-in object has a [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
whose value is the code <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> for which the object was initially created.</p>
<p>Many built-in objects are functions: they can be invoked with arguments. Some of them furthermore are constructors: they are
functions intended for use with the <code>new</code> operator. For each built-in function, this specification describes the
arguments required by that function and properties of the Function object. For each built-in constructor, this specification
furthermore describes properties of the prototype object of that constructor and properties of specific object instances
returned by a <code>new</code> expression that invokes that constructor.</p>
<p>Unless otherwise specified in the description of a particular function, if a built-in function or constructor is given fewer
arguments than the function is specified to require, the function or constructor shall behave exactly as if it had been given
sufficient additional arguments, each such argument being the <b>undefined</b> value. Such missing arguments are considered to
be “not present” and may be identified in that manner by specification algorithms.</p>
<p>Unless otherwise specified in the description of a particular function, if a built-in function or constructor described is
given more arguments than the function is specified to allow, the extra arguments are evaluated by the call and then ignored by
the function. However, an implementation may define implementation specific behaviour relating to such arguments as long as the
behaviour is not the throwing of a <b>TypeError</b> exception that is predicated simply on the presence of an extra
argument.</p>
<div class="note">
<p><span class="nh">NOTE</span> Implementations that add additional capabilities to the set of built-in functions are
encouraged to do so by adding new functions rather than adding new parameters to existing functions.</p>
</div>
<p>Unless otherwise specified every built-in function and every built-in constructor has the Function prototype object, which is
the initial value of the expression <code>Function.prototype</code> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>), as the value of its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>Unless otherwise specified every built-in prototype object has the Object prototype object, which is the initial value of the
expression <code>Object.prototype</code> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>), as the value of
its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, except the Object prototype
object itself.</p>
<p>Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless
otherwise specified in the description of a particular function.</p>
<p>Unless otherwise specified, every built-in function defined in clauses 18 through 26 are created as if by calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbuiltinfunction">CreateBuiltinFunction</a> abstract operation (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects-call-thisargument-argumentslist">9.3.1</a>).</p>
<p>Every built-in Function object, including constructors, has a <code>length</code> property whose value is an integer. Unless
otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the
function description, including optional parameters.</p>
<div class="note">
<p><span class="nh">NOTE</span> For example, the Function object that is the initial value of the <span style="font-family:
monospace">slice</span> property of the String prototype object is described under the subclause heading “<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.slice">String.prototype.slice</a> (start, end)” which shows the two named arguments start
and end; therefore the value of the <span style="font-family: monospace">length</span> property of that Function object is
<span style="font-family: monospace">2</span>.</p>
</div>
<p>Unless otherwise specified, the <code>length</code> property of a built-in Function object has the attributes
{&nbsp;[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]: <b>true</b> }.</p>
<p>Every built-in Function object, including constructors, that is not identified as an anonymous function has a
<code>name</code> property whose value is a String. Unless otherwise specified, this value is the name that is given to the
function in this specification. For functions that are specified as properties of objects, the name value is the property name
string used to access the function. Functions that are specified as get or set accessor functions of built-in properties have
"<code>get</code> " or "<code>set</code> " prepended to the property name string. The value of the <code>name</code> property
is explicitly specified for each built-in functions whose <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> is a symbols value.</p>
<p>Unless otherwise specified, the <code>name</code> property of a built-in Function object has the attributes
{&nbsp;[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]: <b>true</b> }.</p>
<p>Every other data property described in clauses 18 through 26 has the attributes { [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>false</b>, [[Configurable]]: <b>true</b> } unless otherwise specified.</p>
<p>Every accessor property described in clauses 18 through 26 has the attributes {[[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>true</b> } unless otherwise specified. If only a get accessor function is described, the set accessor
function is the default value, <b>undefined</b>. If only a set accessor is function is described the get accessor is the
default value, <b>undefined</b>.</p>
</section>
<section id="sec-global-object">
<div class="front">
<h1><span class="secnum" id="sec-18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-object" title="link to this section">18</a></span> The Global
Object</h1>
<p>The unique <i>global object</i> is created before control enters any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution
context</a>.</p>
<p>The global object does not have a [[Construct]] internal method; it is not possible to use the global object as a
constructor with the <code>new</code> operator.</p>
<p>The global object does not have a [[Call]] internal method; it is not possible to invoke the global object as a
function.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the global
object is implementation-dependent.</p>
<p>In addition to the properties defined in this specification the global object may have additional host defined properties.
This may include a property whose value is the global object itself; for example, in the HTML document object model the
<code>window</code> property of the global object is the global object itself.</p>
</div>
<section id="sec-value-properties-of-the-global-object">
<div class="front">
<h1><span class="secnum" id="sec-18.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-global-object" title="link to this section">18.1</a></span> Value Properties of the Global Object</h1>
</div>
<section id="sec-value-properties-of-the-global-object-infinity">
<h1><span class="secnum" id="sec-18.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-global-object-infinity" title="link to this section">18.1.1</a></span> Infinity</h1>
<p>The value of <code>Infinity</code> is <b>+∞</b> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">see
6.1.6</a>). This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-value-properties-of-the-global-object-nan">
<h1><span class="secnum" id="sec-18.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-global-object-nan" title="link to this section">18.1.2</a></span> NaN</h1>
<p>The value of <code>NaN</code> is <b>NaN</b> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">see 6.1.6</a>). This
property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b>
}.</p>
</section>
<section id="sec-undefined">
<h1><span class="secnum" id="sec-18.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-undefined" title="link to this section">18.1.3</a></span>
undefined</h1>
<p>The value of <code>undefined</code> is <b>undefined</b> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type">see
6.1.1</a>). This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
</section>
<section id="sec-function-properties-of-the-global-object">
<div class="front">
<h1><span class="secnum" id="sec-18.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-properties-of-the-global-object" title="link to this section">18.2</a></span> Function Properties of the Global Object</h1>
</div>
<section id="sec-eval-x">
<div class="front">
<h1><span class="secnum" id="sec-18.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-eval-x" title="link to this section">18.2.1</a></span> eval
(x)</h1>
<p>When the <code>eval</code> function is called with one argument <var>x</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is not String, return <i>x</i>.</li>
<li>Let <i>script</i> be the ECMAScript code that is the result of parsing <i>x</i>, interpreted as UTF-16 encoded
Unicode text as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a><i>,</i> for the goal symbol
<i>Script</i>. If the parse fails or any early errors are detected, throw a <b>SyntaxError</b> exception (but <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-handling-and-language-extensions">see also clause 16</a>).</li>
<li>If <i>script</i> Contains <i>ScriptBody</i> is <b>false</b>, return <b>undefined</b>.</li>
<li>Let <i>strictScript</i> be IsStrict of <i>script</i>.</li>
<li>If this is a direct call to eval (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-direct-call-to-eval">18.2.1.1</a>), let <i>direct</i> be
<b>true</b>, otherwise let <i>direct</i> be <b>false</b>.</li>
<li>If <i>direct</i> is <b>true</b> and the code that made the direct call to eval is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>, then let <i>strictCaller</i> be <b>true</b><i>.</i> Otherwise, let
<i>strictCaller</i> be <b>false</b><i>.</i></li>
<li>Let <i>ctx</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>. If <i>direct</i> is
<b>true</b> <i>ctx</i> will be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> that performed the direct
eval. If <i>direct</i> is <b>false</b> <i>ctx</i> will be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution
context</a> for the invocation of the eval function.</li>
<li>Let <i>evalRealm</i> be <i>ctx’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>If <i>direct</i> is <b>false</b> and <i>strictScript</i> is <b>false</b>, then
<ol class="block">
<li>Return the result of Script Evaluation for <i>script</i> with arguments <i>evalRealm</i> and <b>true</b>.</li>
</ol>
</li>
<li>If <i>direct</i> is <b>true</b>, <i>strictScript</i> is <b>false</b>, <i>strictCaller</i> is <b>false</b>, and
<i>ctx’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> is the same as
<i>evalRealm</i>.[[globalEnv]], then
<ol class="block">
<li>Return the result of Script Evaluation for <i>script</i> with arguments <i>evalRealm</i> and <b>true</b>.</li>
</ol>
</li>
<li>If <i>direct</i> is <b>true</b>, then
<ol class="block">
<li>If the code that made the direct call to eval is function code and ValidInFunction of <i>script</i> is
<b>false</b>, then throw a <b>SyntaxError</b> exception.</li>
<li>If the code that made the direct call to eval is module code and ValidInModule of <i>script</i> is <b>false</b>,
then throw a <b>SyntaxError</b> exception.</li>
</ol>
</li>
<li>If <i>direct</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>lexEnv</i> be <i>ctx’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a>.</li>
<li>Let <i>varEnv</i> be <i>ctx’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>lexEnv</i> be <i>evalRealm</i>.[[globalEnv]].</li>
<li>Let <i>varEnv</i> be <i>evalRealm</i>.[[globalEnv]].</li>
</ol>
</li>
<li>If <i>strictScript</i> is <b>true</b> or if <i>direct</i> is <b>true</b> and <i>strictCaller</i> is <b>true</b> ,
then
<ol class="block">
<li>Let <i>strictVarEnv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a>(<i>lexEnv</i>).</li>
<li>Let <i>lexEnv</i> be <i>strictVarEnv</i>.</li>
<li>Let <i>varEnv</i> be <i>strictVarEnv</i>.</li>
</ol>
</li>
<li>Let <i>status</i> be the result of performing Eval Declaration Instantiation as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-eval-declaration-instantiation">18.2.1.2</a> with <i>script</i>, <i>varEnv</i>, and <i>lexEnv</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>evalCxt</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">ECMAScript code execution context</a>.</li>
<li>Set the <i>evalCxt’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> to <i>evalRealm</i>.</li>
<li>Set the <i>evalCxt’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> to <i>varEnv</i>.</li>
<li>Set the <i>evalCxt’s</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">LexicalEnvironment</a> to <i>lexEnv</i>.</li>
<li>If there is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">currently running execution context</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspend</a> it.</li>
<li>Push <i>evalCxt</i> on to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>evalCxt</i> is now
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Let <i>result</i> be the result of evaluating <i>script</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>evalCxt</i> and remove it from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>.</li>
<li>Resume the context that is now on the top of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The eval code cannot instantiate variable or function bindings in the variable
environment of the calling context that invoked the eval if either the code of the calling context or the eval code is
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>. Instead such bindings are instantiated in a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">VariableEnvironment</a> that is only accessible to the eval code.</p>
</div>
</div>
<section id="sec-direct-call-to-eval">
<h1><span class="secnum" id="sec-18.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-direct-call-to-eval" title="link to this section">18.2.1.1</a></span> Direct Call to Eval</h1>
<p>A direct call to the eval function is one that is expressed as a <span class="nt">CallExpression</span> that meets all
of the following conditions:</p>
<ul>
<li>
<p>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> that is the result of evaluating the MemberExpression
in the CallExpression has an environment record as its base value and its reference name is "eval".</p>
</li>
<li>
<p>If the base value of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> has true acalls its
withEnvironment value, then its binding object is an object that uses the ordinary definition of the [[Call]] internal
method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects-call-thisargument-argumentslist">9.3.1</a>)</p>
</li>
<li>
<p>The result of calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a> with that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a> as the argument is the standard built-in function defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-eval-x">18.2.1</a>.</p>
</li>
</ul>
</section>
<section id="sec-eval-declaration-instantiation">
<h1><span class="secnum" id="sec-18.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-eval-declaration-instantiation" title="link to this section">18.2.1.2</a></span> Eval Declaration Instantiation</h1>
</section>
</section>
<section id="sec-isfinite-number">
<h1><span class="secnum" id="sec-18.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isfinite-number" title="link to this section">18.2.2</a></span>
isFinite (number)</h1>
<p>Returns <b>false</b> if the argument coerces to <b>NaN</b>, <b>+∞</b>, or <b>−∞</b>, and otherwise
returns <b>true</b>.</p>
<ol class="proc">
<li>Let <i>num</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>number</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>num</i>).</li>
<li>If <i>num</i> is <b>NaN</b>, <b>+∞</b>, or <b>−∞</b>, return <b>false</b>.</li>
<li>Otherwise, return <b>true</b>.</li>
</ol>
</section>
<section id="sec-isnan-number">
<h1><span class="secnum" id="sec-18.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isnan-number" title="link to this section">18.2.3</a></span> isNaN
(number)</h1>
<p>Returns <b>true</b> if the argument coerces to <b>NaN</b>, and otherwise returns <b>false</b>.</p>
<ol class="proc">
<li>Let <i>num</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>number</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>num</i>).</li>
<li>If <i>num</i> is <b>NaN</b>, return <b>true</b>.</li>
<li>Otherwise, return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> A reliable way for ECMAScript code to test if a value <span style="font-family:
monospace">X</span> is a <b>NaN</b> is an expression of the form <span style="font-family: monospace">X !== X</span>. The
result will be <b>true</b> if and only if <span style="font-family: monospace">X</span> is a <b>NaN</b>.</p>
</div>
</section>
<section id="sec-parsefloat-string">
<h1><span class="secnum" id="sec-18.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-parsefloat-string" title="link to this section">18.2.4</a></span>
parseFloat (string)</h1>
<p>The <code>parseFloat</code> function produces a Number value dictated by interpretation of the contents of the
<var>string</var> argument as a decimal literal.</p>
<p>When the <code>parseFloat</code> function is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>inputString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>inputString</i>).</li>
<li>Let <i>trimmedString</i> be a substring of <i>inputString</i> consisting of the leftmost character that is not a
<i>StrWhiteSpaceChar</i> and all characters to the right of that character. (In other words, remove leading white
space.) If <i>inputString</i> does not contain any such characters, let <i>trimmedString</i> be the empty string.</li>
<li>If neither <i>trimmedString</i> nor any prefix of <i>trimmedString</i> satisfies the syntax of a
<i>StrDecimalLiteral</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber-applied-to-the-string-type">see 7.1.3.1</a>), return <b>NaN</b>.</li>
<li>Let <i>numberString</i> be the longest prefix of <i>trimmedString</i>, which might be <i>trimmedString</i> itself,
that satisfies the syntax of a <i>StrDecimalLiteral</i>.</li>
<li>Return the Number value for the MV of <i>numberString</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> <code>parseFloat</code> may interpret only a leading portion of <i>string</i> as a Number
value; it ignores any characters that cannot be interpreted as part of the notation of an decimal literal, and no
indication is given that any such characters were ignored.</p>
</div>
</section>
<section id="sec-parseint-string-radix">
<h1><span class="secnum" id="sec-18.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-parseint-string-radix" title="link to this section">18.2.5</a></span>
parseInt (string , radix)</h1>
<p>The <code>parseInt</code> function produces an integer value dictated by interpretation of the contents of the
<var>string</var> argument according to the specified <var>radix</var>. Leading white space in <var>string</var> is ignored.
If <var>radix</var> is <b>undefined</b> or 0, it is assumed to be <span style="font-family: Times New Roman">10</span>
except when the number begins with the character pairs <code>0x</code> or <code>0X</code>, in which case a radix of 16 is
assumed. If <var>radix</var> is <span style="font-family: Times New Roman">16,</span> the number may also optionally begin
with the character pairs <code>0x</code> or <code>0X</code>.</p>
<p>When the <code>parseInt</code> function is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>inputString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>string</i>).</li>
<li>Let <i>S</i> be a newly created substring of <i>inputString</i> consisting of the first character that is not a
<i>StrWhiteSpaceChar</i> and all characters following that character. (In other words, remove leading white space.) If
<i>inputString</i> does not contain any such characters, let <i>S</i> be the empty string.</li>
<li>Let <i>sign</i> be 1.</li>
<li>If <i>S</i> is not empty and the first character of <i>S</i> is a minus sign <b>-</b>, let <i>sign</i> be
−1.</li>
<li>If <i>S</i> is not empty and the first character of <i>S</i> is a plus sign <b>+</b> or a minus sign <b>-</b>, then
remove the first character from <i>S</i>.</li>
<li>Let <i>R</i> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a>(<i>radix</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>R</i>).</li>
<li>Let <i>stripPrefix</i> be <b>true</b>.</li>
<li>If <i>R</i> ≠ 0, then
<ol class="block">
<li>If <i>R</i> &lt; 2 or <i>R</i> &gt; 36, then return <b>NaN</b>.</li>
<li>If <i>R</i> ≠ 16, let <i>stripPrefix</i> be <b>false</b>.</li>
</ol>
</li>
<li>Else <i>R</i> = 0,
<ol class="block">
<li>Let <i>R</i> = 10.</li>
</ol>
</li>
<li>If <i>stripPrefix</i> is <b>true</b>, then
<ol class="block">
<li>If the length of <i>S</i> is at least 2 and the first two characters of <i>S</i> are either
“<b>0x</b>” or “<b>0X</b>”, then remove the first two characters from <i>S</i> and let
<i>R</i> = 16.</li>
</ol>
</li>
<li>If <i>S</i> contains any character that is not a radix-<i>R</i> digit, then let <i>Z</i> be the substring of <i>S</i>
consisting of all characters before the first such character; otherwise, let <i>Z</i> be <i>S</i>.</li>
<li>If <i>Z</i> is empty, return <b>NaN</b>.</li>
<li>Let <i>mathInt</i> be the mathematical integer value that is represented by <i>Z</i> in radix-<i>R</i> notation, using
the letters <b>A</b>-<b>Z</b> and <b>a</b>-<b>z</b> for digits with values 10 through 35. (However, if <i>R</i> is 10
and <i>Z</i> contains more than 20 significant digits, every significant digit after the 20th may be replaced by a
<b>0</b> digit, at the option of the implementation; and if <i>R</i> is not 2, 4, 8, 10, 16, or 32, then
<i>mathInt</i> may be an implementation-dependent approximation to the mathematical integer value that is represented
by <i>Z</i> in radix-<i>R</i> notation.)</li>
<li>Let <i>number</i> be the Number value for <i>mathInt</i>.</li>
<li>Return <i>sign</i> × <i>number</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> <code>parseInt</code> may interpret only a leading portion of <i>string</i> as an integer
value; it ignores any characters that cannot be interpreted as part of the notation of an integer, and no indication is
given that any such characters were ignored.</p>
</div>
</section>
<section id="sec-uri-handling-function">
<div class="front">
<h1><span class="secnum" id="sec-18.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uri-handling-function" title="link to this section">18.2.6</a></span> URI Handling Function</h1>
<p>Uniform Resource Identifiers, or URIs, are Strings that identify resources (e.g. web pages or files) and transport
protocols by which to access them (e.g. HTTP or FTP) on the Internet. The ECMAScript language itself does not provide any
support for using URIs except for functions that encode and decode URIs as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decodeuri-encodeduri">18.2.6.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decodeuricomponent-encodeduricomponent">18.2.6.3</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encodeuri-uri">18.2.6.4</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encodeuri-uri">18.2.6.4</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> Many implementations of ECMAScript provide additional functions and methods that
manipulate web pages; these functions are beyond the scope of this standard.</p>
</div>
</div>
<section id="sec-uri-syntax-and-semantics">
<div class="front">
<h1><span class="secnum" id="sec-18.2.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uri-syntax-and-semantics" title="link to this section">18.2.6.1</a></span> URI Syntax and Semantics</h1>
<p>A URI is composed of a sequence of components separated by component separators. The general form is:</p>
<div class="gp prod"><span class="nt">Scheme</span> <span class="geq">:</span> <span class="nt">First</span> <code class="t">/</code> <span class="nt">Second</span> <code class="t">;</code> <span class="nt">Third</span> <code class="t">?</code> <span class="nt">Fourth</span></div>
<p>where the italicised names represent components and “<code>:</code>”, “<code>/</code>”,
“<code>;</code>” and “<code>?</code>” are reserved characters used as separators. The
<code>encodeURI</code> and <code>decodeURI</code> functions are intended to work with complete URIs; they assume that
any reserved characters in the URI are intended to have special meaning and so are not encoded. The
<code>encodeURIComponent</code> and <code>decodeURIComponent</code> functions are intended to work with the individual
component parts of a URI; they assume that any reserved characters represent text and so must be encoded so that they
are not interpreted as reserved characters when the component is part of a complete URI.</p>
<p>The following lexical grammar specifies the form of encoded URIs.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">uri</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">uriCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriCharacters</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">uriCharacter</span> <span class="nt">uriCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriCharacter</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">uriReserved</span></div>
<div class="rhs"><span class="nt">uriUnescaped</span></div>
<div class="rhs"><span class="nt">uriEscaped</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriReserved</span> <span class="geq">:::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">;</code> <code class="t">/</code> <code class="t">?</code> <code class="t">:</code> <code class="t">@</code> <code class="t">&amp;</code> <code class="t">=</code> <code class="t">+</code> <code class="t">$</code> <code class="t">,</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriUnescaped</span> <span class="geq">:::</span></div>
<div class="rhs"><span class="nt">uriAlpha</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">uriMark</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriEscaped</span> <span class="geq">:::</span></div>
<div class="rhs"><code class="t">%</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriAlpha</span> <span class="geq">:::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">g</code> <code class="t">h</code> <code class="t">i</code> <code class="t">j</code> <code class="t">k</code> <code class="t">l</code> <code class="t">m</code> <code class="t">n</code> <code class="t">o</code> <code class="t">p</code> <code class="t">q</code> <code class="t">r</code> <code class="t">s</code> <code class="t">t</code> <code class="t">u</code> <code class="t">v</code> <code class="t">w</code> <code class="t">x</code> <code class="t">y</code> <code class="t">z</code></div>
<div class="rhs"><code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code> <code class="t">G</code> <code class="t">H</code> <code class="t">I</code> <code class="t">J</code> <code class="t">K</code> <code class="t">L</code> <code class="t">M</code> <code class="t">N</code> <code class="t">O</code> <code class="t">P</code> <code class="t">Q</code> <code class="t">R</code> <code class="t">S</code> <code class="t">T</code> <code class="t">U</code> <code class="t">V</code> <code class="t">W</code> <code class="t">X</code> <code class="t">Y</code> <code class="t">Z</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">uriMark</span> <span class="geq">:::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">-</code> <code class="t">_</code> <code class="t">.</code> <code class="t">!</code> <code class="t">~</code> <code class="t">*</code> <code class="t">'</code> <code class="t">(</code> <code class="t">)</code></div>
</div>
<div class="note">
<p><span class="nh">NOTE</span> The above syntax is based upon RFC 2396 and does not reflect changes introduced by the
more recent RFC 3986.</p>
</div>
<p><b>Runtime Semantics</b></p>
<p>When a character to be included in a URI is not listed above or is not intended to have the special meaning sometimes
given to the reserved characters, that character must be encoded. The character is transformed into its UTF-8 encoding,
with surrogate pairs first converted from UTF-16 to the corresponding code point value. (Note that for code units in the
range [0,127] this results in a single octet with the same value.) The resulting sequence of octets is then transformed
into a String with each octet represented by an escape sequence of the form “<span style="font-family:
monospace"><b>%</b>xx</span>”.</p>
</div>
<section id="sec-encode">
<h1><span class="secnum" id="sec-18.2.6.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encode" title="link to this section">18.2.6.1.1</a></span>
Runtime Semantics: Encode Abstract Operation</h1>
<p>The encoding and escaping process is described by the abstract operation Encode taking two String arguments
<var>string</var> and <var>unescapedSet</var>.</p>
<ol class="proc">
<li>Let <i>strLen</i> be the number of characters in <i>string</i>.</li>
<li>Let <i>R</i> be the empty String.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat
<ol class="block">
<li>If <i>k</i> equals <i>strLen</i>, return <i>R</i>.</li>
<li>Let <i>C</i> be the character at position <i>k</i> within <i>string</i>.</li>
<li>If <i>C</i> is in <i>unescapedSet</i>, then
<ol class="block">
<li>Let <i>S</i> be a String containing only the character <i>C</i>.</li>
<li>Let <i>R</i> be a new String value computed by concatenating the previous value of <i>R</i> and
<i>S</i>.</li>
</ol>
</li>
<li>Else <i>C</i> is not in <i>unescapedSet</i>,
<ol class="block">
<li>If the code unit value of <i>C</i> is not less than 0xDC00 and not greater than 0xDFFF, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>If the code unit value of <i>C</i> is less than 0xD800 or greater than 0xDBFF, then
<ol class="block">
<li>Let <i>V</i> be the code unit value of <i>C</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Increase <i>k</i> by 1.</li>
<li>If <i>k</i> equals <i>strLen</i>, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>Let <i>kChar</i> be the code unit value of the character at position <i>k</i> within
<i>string</i>.</li>
<li>If <i>kChar</i> is less than 0xDC00 or greater than 0xDFFF, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>Let <i>V</i> be (((the code unit value of <i>C</i>) – 0xD800) × 0x400 + (<i>kChar</i>
– 0xDC00) + 0x10000).</li>
</ol>
</li>
<li>Let <i>Octets</i> be the array of octets resulting by applying the UTF-8 transformation to <i>V</i>, and
let <i>L</i> be the array size.</li>
<li>Let <i>j</i> be 0.</li>
<li>Repeat, while <i>j</i> &lt; <i>L</i>
<ol class="block">
<li>Let <i>jOctet</i> be the value at position <i>j</i> within <i>Octets</i>.</li>
<li>Let <i>S</i> be a String containing three characters “<b>%</b><i>XY</i>” where <i>XY</i>
are two uppercase hexadecimal digits encoding the value of <i>jOctet</i>.</li>
<li>Let <i>R</i> be a new String value computed by concatenating the previous value of <i>R</i> and
<i>S</i>.</li>
<li>Increase <i>j</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-decode">
<h1><span class="secnum" id="sec-18.2.6.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decode" title="link to this section">18.2.6.1.2</a></span>
Runtime Semantics: Decode Abstract Operation</h1>
<p>The unescaping and decoding process is described by the abstract operation Decode taking two String arguments
<var>string</var> and <var>reservedSet</var>.</p>
<ol class="proc">
<li>Let <i>strLen</i> be the number of characters in <i>string</i>.</li>
<li>Let <i>R</i> be the empty String.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat
<ol class="block">
<li>If <i>k</i> equals <i>strLen</i>, return <i>R</i>.</li>
<li>Let <i>C</i> be the character at position <i>k</i> within <i>string</i>.</li>
<li>If <i>C</i> is not ‘<b>%</b>’, then
<ol class="block">
<li>Let <i>S</i> be the String containing only the character <i>C</i>.</li>
</ol>
</li>
<li>Else <i>C</i> is ‘<b>%</b>’,
<ol class="block">
<li>Let <i>start</i> be <i>k</i>.</li>
<li>If <i>k</i> + 2 is greater than or equal to <i>strLen</i>, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>If the characters at position (<i>k</i>+1) and (<i>k</i> + 2) within <i>string</i> do not represent
hexadecimal digits, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>Let <i>B</i> be the 8-bit value represented by the two hexadecimal digits at position (<i>k</i> + 1) and
(<i>k</i> + 2).</li>
<li>Increment <i>k</i> by 2.</li>
<li>If the most significant bit in <i>B</i> is 0, then
<ol class="block">
<li>Let <i>C</i> be the character with code unit value <i>B</i>.</li>
<li>If <i>C</i> is not in <i>reservedSet</i>, then
<ol class="block">
<li>Let <i>S</i> be the String containing only the character <i>C</i>.</li>
</ol>
</li>
<li>Else <i>C</i> is in <i>reservedSet</i>,
<ol class="block">
<li>Let <i>S</i> be the substring of <i>string</i> from position <i>start</i> to position <i>k</i>
included.</li>
</ol>
</li>
</ol>
</li>
<li>Else the most significant bit in <i>B</i> is 1,
<ol class="block">
<li>Let <i>n</i> be the smallest non-negative number such that (<i>B</i> &lt;&lt; <i>n</i>) &amp; 0x80 is
equal to 0.</li>
<li>If <i>n</i> equals 1 or <i>n</i> is greater than 4, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>Let <i>Octets</i> be an array of 8-bit integers of size <i>n</i>.</li>
<li>Put <i>B</i> into <i>Octets</i> at position 0.</li>
<li>If <i>k</i> + (3 × (<i>n</i> – 1)) is greater than or equal to <i>strLen</i>, throw a
<b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b>
exception.</li>
<li>Let <i>j</i> be 1.</li>
<li>Repeat, while <i>j</i> &lt; <i>n</i>
<ol class="block">
<li>Increment <i>k</i> by 1.</li>
<li>If the character at position <i>k</i> within <i>string</i> is not <code>"%″</code>, throw a
<b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b>
exception.</li>
<li>If the characters at position (<i>k</i> +1) and (<i>k</i> + 2) within <i>string</i> do not
represent hexadecimal digits, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>Let <i>B</i> be the 8-bit value represented by the two hexadecimal digits at position (<i>k</i> +
1) and (<i>k</i> + 2).</li>
<li>If the two most significant bits in <i>B</i> are not 10, throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>Increment <i>k</i> by 2.</li>
<li>Put <i>B</i> into <i>Octets</i> at position <i>j</i>.</li>
<li>Increment <i>j</i> by 1.</li>
</ol>
</li>
<li>Let <i>V</i> be the value obtained by applying the UTF-8 transformation to <i>Octets</i>, that is,
from an array of octets into a 21-bit value. If <i>Octets</i> does not contain a valid UTF-8 encoding
of a Unicode code point throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> exception.</li>
<li>If <i>V</i> &lt; 0x10000, then
<ol class="block">
<li>Let <i>C</i> be the character with code unit value <i>V</i>.</li>
<li>If <i>C</i> is not in <i>reservedSet</i>, then
<ol class="block">
<li>Let <i>S</i> be the String containing only the character <i>C</i>.</li>
</ol>
</li>
<li>Else <i>C</i> is in <i>reservedSet</i>,
<ol class="block">
<li>Let <i>S</i> be the substring of <i>string</i> from position <i>start</i> to position <i>k</i>
included.</li>
</ol>
</li>
</ol>
</li>
<li>Else <i>V</i> ≥ 0x10000,
<ol class="block">
<li>Let <i>L</i> be (((<i>V</i> – 0x10000) &amp; 0x3FF) + 0xDC00).</li>
<li>Let <i>H</i> be ((((<i>V</i> – 0x10000) &gt;&gt; 10) &amp; 0x3FF) + 0xD800).</li>
<li>Let <i>S</i> be the String containing the two characters with code unit values <i>H</i> and
<i>L</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>R</i> be a new String value computed by concatenating the previous value of <i>R</i> and <i>S</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This syntax of Uniform Resource Identifiers is based upon RFC 2396 and does not
reflect the more recent RFC 3986 which replaces RFC 2396. A formal description and implementation of UTF-8 is given
in RFC 3629.</p>
</div>
<p>In UTF-8, characters are encoded using sequences of 1 to 6 octets. The only octet of a "sequence" of one has the
higher-order bit set to 0, the remaining 7 bits being used to encode the character value. In a sequence of n octets,
n&gt;1, the initial octet has the n higher-order bits set to 1, followed by a bit set to 0. The remaining bits of that
octet contain bits from the value of the character to be encoded. The following octets all have the higher-order bit set
to 1 and the following bit set to 0, leaving 6 bits in each to contain bits from the character to be encoded. The
possible UTF-8 encodings of ECMAScript characters are specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-38">Table 38</a>.</p>
<figure>
<figcaption><span id="table-38">Table 38</span> — UTF-8 Encodings</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 0px solid black; border-left: 0px solid black; border-top: 0px solid black">Code Unit Value</th>
<th style="border-bottom: 0px solid black; border-top: 0px solid black">Representation</th>
<th style="border-bottom: 0px solid black; border-top: 0px solid black">1<sup>st</sup> Octet</th>
<th style="border-bottom: 0px solid black; border-top: 0px solid black">2<sup>nd</sup> Octet</th>
<th style="border-bottom: 0px solid black; border-top: 0px solid black">3<sup>rd</sup> Octet</th>
<th style="border-bottom: 0px solid black; border-right: 0px solid black; border-top: 0px solid black">4<sup>th</sup> Octet</th>
</tr>
<tr>
<td><code>0x0000 - 0x007F</code></td>
<td><code>00000000</code> <span style="font-family: monospace"><b>0</b><i>zzzzzzz</i></span></td>
<td><span style="font-family: monospace"><b>0</b><i>zzzzzzz</i></span></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>0x0080 - 0x07FF</code></td>
<td><span style="font-family: monospace"><b>00000</b><i>yyy yyzzzzzz</i></span></td>
<td><span style="font-family: monospace"><b>110</b><i>yyyyy</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>zzzzzz</i></span></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>0x0800 - 0xD7FF</code></td>
<td><span style="font-family: monospace"><i>xxxxyyyy yyzzzzzz</i></span></td>
<td><span style="font-family: monospace"><b>1110</b><i>xxxx</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>yyyyyy</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>zzzzzz</i></span></td>
<td></td>
</tr>
<tr>
<td>
<p><code>0xD800 - 0xDBFF</code></p>
<p><i>followed by</i></p>
<p><code>0xDC00 – 0xDFFF</code></p>
</td>
<td>
<p><span style="font-family: monospace"><b>110110</b><i>vv vvwwwwxx</i></span></p>
<p><i>followed by</i></p>
<p><span style="font-family: monospace"><b>110111</b><i>yy yyzzzzzz</i></span></p>
</td>
<td><span style="font-family: monospace"><b>11110</b><i>uuu</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>uuwwww</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>xxyyyy</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>zzzzzz</i></span></td>
</tr>
<tr>
<td>
<p><code>0xD800 - 0xDBFF</code></p>
<p><i>not followed by</i></p>
<p><code>0xDC00 – 0xDFFF</code></p>
</td>
<td><span style="font-family: sans-serif"><i>causes</i></span> <span style="font-family: monospace"><b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b></span></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>0xDC00 – 0xDFFF</code></td>
<td><span style="font-family: sans-serif"><i>causes</i></span> <span style="font-family: monospace"><b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b></span></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>0xE000 - 0xFFFF</code></td>
<td><span style="font-family: monospace"><i>xxxxyyyy yyzzzzzz</i></span></td>
<td><span style="font-family: monospace"><b>1110</b><i>xxxx</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>yyyyyy</i></span></td>
<td><span style="font-family: monospace"><b>10</b><i>zzzzzz</i></span></td>
<td></td>
</tr>
</tbody></table>
</figure>
<p>Where</p>
<p><i>uuuuu</i> = <span style="font-family: monospace"><i>vvvv</i></span> + 1</p>
<p>to account for the addition of 0x10000 as in Surrogates, section 3.7, of the Unicode Standard.</p>
<p>The range of code unit values 0xD800-0xDFFF is used to encode surrogate pairs; the above transformation combines a
UTF-16 surrogate pair into a UTF-32 representation and encodes the resulting 21-bit value in UTF-8. Decoding
reconstructs the surrogate pair.</p>
<p>RFC 3629 prohibits the decoding of invalid UTF-8 octet sequences. For example, the invalid sequence C0 80 must not
decode into the character U+0000. Implementations of the Decode algorithm are required to throw a <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror">URIError</a></b> when encountering such invalid
sequences.</p>
</section>
</section>
<section id="sec-decodeuri-encodeduri">
<h1><span class="secnum" id="sec-18.2.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decodeuri-encodeduri" title="link to this section">18.2.6.2</a></span> decodeURI (encodedURI)</h1>
<p>The <code>decodeURI</code> function computes a new version of a URI in which each escape sequence and UTF-8 encoding of
the sort that might be introduced by the <code>encodeURI</code> function is replaced with the character that it
represents. Escape sequences that could not have been introduced by <code>encodeURI</code> are not replaced.</p>
<p>When the <code>decodeURI</code> function is called with one argument <var>encodedURI</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>uriString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>encodedURI</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>uriString</i>).</li>
<li>Let <i>reservedURISet</i> be a String containing one instance of each character valid in <i>uriReserved</i> plus
“<code>#</code>”.</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decode">Decode</a>(<i>uriString</i>, <i>reservedURISet</i>)</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The character “<code>#</code>” is not decoded from escape sequences even
though it is not a reserved URI character.</p>
</div>
</section>
<section id="sec-decodeuricomponent-encodeduricomponent">
<h1><span class="secnum" id="sec-18.2.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decodeuricomponent-encodeduricomponent" title="link to this section">18.2.6.3</a></span> decodeURIComponent (encodedURIComponent)</h1>
<p>The <code>decodeURIComponent</code> function computes a new version of a URI in which each escape sequence and UTF-8
encoding of the sort that might be introduced by the <code>encodeURIComponent</code> function is replaced with the
character that it represents.</p>
<p>When the <code>decodeURIComponent</code> function is called with one argument <var>encodedURIComponent</var>, the
following steps are taken:</p>
<ol class="proc">
<li>Let componentString be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(encodedURIComponent).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(componentString).</li>
<li>Let reservedURIComponentSet be the empty String.</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decode">Decode</a>(componentString, reservedURIComponentSet)</li>
</ol>
</section>
<section id="sec-encodeuri-uri">
<h1><span class="secnum" id="sec-18.2.6.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encodeuri-uri" title="link to this section">18.2.6.4</a></span>
encodeURI (uri)</h1>
<p>The <code>encodeURI</code> function computes a new version of a URI in which each instance of certain characters is
replaced by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.</p>
<p>When the <code>encodeURI</code> function is called with one argument <span class="nt">uri</span>, the following steps
are taken:</p>
<ol class="proc">
<li>Let <i>uriString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>uri</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>uriString</i>).</li>
<li>Let <i>unescapedURISet</i> be a String containing one instance of each character valid in <i>uriReserved</i> and
<i>uriUnescaped</i> plus "<code>#</code>".</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encode">Encode</a>(<i>uriString</i>, unescapedURISet)</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The character <span style="font-family: sans-serif">"</span><code>#</code><span style="font-family: sans-serif">"</span> is not encoded to an escape sequence even though it is not a reserved or
unescaped URI character.</p>
</div>
</section>
<section id="sec-encodeuricomponent-uricomponent">
<h1><span class="secnum" id="sec-18.2.6.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encodeuricomponent-uricomponent" title="link to this section">18.2.6.5</a></span> encodeURIComponent (uriComponent)</h1>
<p>The <code>encodeURIComponent</code> function computes a new version of a URI in which each instance of certain
characters is replaced by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.</p>
<p>When the <code>encodeURIComponent</code> function is called with one argument <span class="nt">uriComponent</span>, the
following steps are taken:</p>
<ol class="proc">
<li>Let componentString be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(uriComponent).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(componentString).</li>
<li>Let unescapedURIComponentSet be a String containing one instance of each character valid in uriUnescaped.</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-encode">Encode</a>(componentString, unescapedURIComponentSet)</li>
</ol>
</section>
</section>
</section>
<section id="sec-constructor-properties-of-the-global-object">
<div class="front">
<h1><span class="secnum" id="sec-18.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object" title="link to this section">18.3</a></span> Constructor Properties of the Global Object</h1>
</div>
<section id="sec-constructor-properties-of-the-global-object-array">
<h1><span class="secnum" id="sec-18.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-array" title="link to this section">18.3.1</a></span> Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-constructor">22.1.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-arraybuffer">
<h1><span class="secnum" id="sec-18.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-arraybuffer" title="link to this section">18.3.2</a></span> ArrayBuffer ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-constructor">24.1.2</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-boolean">
<h1><span class="secnum" id="sec-18.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-boolean" title="link to this section">18.3.3</a></span> Boolean ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-constructor">19.3.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-dataview">
<h1><span class="secnum" id="sec-18.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-dataview" title="link to this section">18.3.4</a></span> DataView ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-constructor">24.2.2</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-date">
<h1><span class="secnum" id="sec-18.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-date" title="link to this section">18.3.5</a></span> Date ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-constructor">20.3.2</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-error">
<h1><span class="secnum" id="sec-18.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-error" title="link to this section">18.3.6</a></span> Error ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-constructor">19.5.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-evalerror">
<h1><span class="secnum" id="sec-18.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-evalerror" title="link to this section">18.3.7</a></span> EvalError ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-evalerror">19.5.5.1</a>.</p>
</section>
<section id="sec-float32array">
<h1><span class="secnum" id="sec-18.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-float32array" title="link to this section">18.3.8</a></span>
Float32Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-float64array">
<h1><span class="secnum" id="sec-18.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-float64array" title="link to this section">18.3.9</a></span>
Float64Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-function">
<h1><span class="secnum" id="sec-18.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-function" title="link to this section">18.3.10</a></span> Function ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-constructor">19.2.1</a>.</p>
</section>
<section id="sec-int8array">
<h1><span class="secnum" id="sec-18.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int8array" title="link to this section">18.3.11</a></span> Int8Array
( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-int16array">
<h1><span class="secnum" id="sec-18.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int16array" title="link to this section">18.3.12</a></span>
Int16Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-int32array">
<h1><span class="secnum" id="sec-18.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int32array" title="link to this section">18.3.13</a></span>
Int32Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-map">
<h1><span class="secnum" id="sec-18.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map" title="link to this section">18.3.14</a></span> Map ( . . .
)</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-constructor">23.1.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-number">
<h1><span class="secnum" id="sec-18.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-number" title="link to this section">18.3.15</a></span> Number ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-constructor">20.1.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-object">
<h1><span class="secnum" id="sec-18.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-object" title="link to this section">18.3.16</a></span> Object ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-constructor">19.1.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-rangeerror">
<h1><span class="secnum" id="sec-18.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-rangeerror" title="link to this section">18.3.17</a></span> RangeError ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-rangeerror">19.5.5.2</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-referenceerror">
<h1><span class="secnum" id="sec-18.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-referenceerror" title="link to this section">18.3.18</a></span> ReferenceError ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-referenceerror">19.5.5.3</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-regexp">
<h1><span class="secnum" id="sec-18.3.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-regexp" title="link to this section">18.3.19</a></span> RegExp ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-constructor">21.2.4</a>.</p>
</section>
<section id="sec-set">
<h1><span class="secnum" id="sec-18.3.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set" title="link to this section">18.3.20</a></span> Set ( . . .
)</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-constructor">23.2.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-string">
<h1><span class="secnum" id="sec-18.3.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-string" title="link to this section">18.3.21</a></span> String ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-constructor">21.1.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-symbol">
<h1><span class="secnum" id="sec-18.3.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-symbol" title="link to this section">18.3.22</a></span> Symbol ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor">19.4.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-syntaxerror">
<h1><span class="secnum" id="sec-18.3.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-syntaxerror" title="link to this section">18.3.23</a></span> SyntaxError ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-syntaxerror">19.5.5.4</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-typeerror">
<h1><span class="secnum" id="sec-18.3.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-typeerror" title="link to this section">18.3.24</a></span> TypeError ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-typeerror">19.5.5.5</a>.</p>
</section>
<section id="sec-uint8array">
<h1><span class="secnum" id="sec-18.3.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint8array" title="link to this section">18.3.25</a></span>
Uint8Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-uint8clampedarray">
<h1><span class="secnum" id="sec-18.3.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint8clampedarray" title="link to this section">18.3.26</a></span>
Uint8ClampedArray ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-uint16array">
<h1><span class="secnum" id="sec-18.3.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint16array" title="link to this section">18.3.27</a></span>
Uint16Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-uint32array">
<h1><span class="secnum" id="sec-18.3.28"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint32array" title="link to this section">18.3.28</a></span>
Uint32Array ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors">22.2.4</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-urierror">
<h1><span class="secnum" id="sec-18.3.29"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-urierror" title="link to this section">18.3.29</a></span> URIError ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-urierror">19.5.5.6</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-weakmap">
<h1><span class="secnum" id="sec-18.3.30"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-weakmap" title="link to this section">18.3.30</a></span> WeakMap ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-constructor">23.3.1</a>.</p>
</section>
<section id="sec-constructor-properties-of-the-global-object-weakset">
<h1><span class="secnum" id="sec-18.3.31"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-constructor-properties-of-the-global-object-weakset" title="link to this section">18.3.31</a></span> WeakSet ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-objects">23.4</a>.</p>
</section>
</section>
<section id="sec-other-properties-of-the-global-object">
<div class="front">
<h1><span class="secnum" id="sec-18.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-properties-of-the-global-object" title="link to this section">18.4</a></span> Other Properties of the Global Object</h1>
</div>
<section id="sec-json">
<h1><span class="secnum" id="sec-18.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json" title="link to this section">18.4.1</a></span> JSON</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json-object">24.3</a>.</p>
</section>
<section id="sec-math">
<h1><span class="secnum" id="sec-18.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math" title="link to this section">18.4.2</a></span> Math</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math-object">20.2</a>.</p>
</section>
<section id="sec-other-properties-of-the-global-object-proxy">
<h1><span class="secnum" id="sec-18.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-properties-of-the-global-object-proxy" title="link to this section">18.4.3</a></span> Proxy ( . . . )</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-constructor-function">26.5.1</a>.</p>
</section>
<section id="sec-reflect">
<h1><span class="secnum" id="sec-18.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect" title="link to this section">18.4.4</a></span> Reflect</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect-object">26.1</a>.</p>
</section>
<section id="sec-system">
<h1><span class="secnum" id="sec-18.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-system" title="link to this section">18.4.5</a></span> System</h1>
<p>See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-system-object">26.4</a>.</p>
</section>
</section>
</section>
<section id="sec-fundamental-objects">
<div class="front">
<h1><span class="secnum" id="sec-19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-fundamental-objects" title="link to this section">19</a></span> Fundamental
Objects</h1>
</div>
<section id="sec-object-objects">
<div class="front">
<h1><span class="secnum" id="sec-19.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-objects" title="link to this section">19.1</a></span> Object
Objects</h1>
</div>
<section id="sec-object-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-constructor" title="link to this section">19.1.1</a></span>
The Object Constructor</h1>
<p>The Object constructor is the %Object% intrinsic object and the initial value of the <code>Object</code> property of
the global object. When <code>Object</code> is called as a function rather than as a constructor, it performs a type
conversion.</p>
<p>The <code>Object</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration.</p>
<div class="note">
<p><span class="nh">NOTE</span> Subclass constructors that inherit from the Object constructor typically should not
include a <code>super</code> call to <code>Object</code> as it performs no initialization action on its
<code>this</code> value and does not return its <code>this</code> value as its value.</p>
</div>
</div>
<section id="sec-object-value">
<h1><span class="secnum" id="sec-19.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-value" title="link to this section">19.1.1.1</a></span>
Object ( [ value ] )</h1>
<p>When <code>Object</code> function is called with optional argument <var>value</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <i>value</i> is <b>null</b>, <b>undefined</b> or not supplied, return the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a> with the intrinsic object <span style="font-family:
sans-serif">%ObjectPrototype%</span> as its argument.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>value</i>).</li>
</ol>
</section>
<section id="sec-new-object-argumentslist">
<h1><span class="secnum" id="sec-19.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-object-argumentslist" title="link to this section">19.1.1.2</a></span> new Object ( ...argumentsList )</h1>
<p>When <code>Object</code> is called as part of a new expression , it creates a new object:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Object</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of calling the [[Call]] internal method of <i>F</i>, providing <b>undefined</b> and
<i>argumentsList</i> as the arguments.</li>
</ol>
<p>The above steps defined the [[Construct]] internal method of the Object constructor. Object may not be implemented as
an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> because this definition differs from the
definition of [[Construct]] used by ECMAScript function objects.</p>
</section>
</section>
<section id="sec-properties-of-the-object-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-constructor" title="link to this section">19.1.2</a></span> Properties of the Object Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Object constructor is the standard built-in Function prototype object.</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), the Object constructor has the following
properties:</p>
</div>
<section id="sec-object.assign">
<h1><span class="secnum" id="sec-19.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign" title="link to this section">19.1.2.1</a></span>
Object.assign ( target, source )</h1>
<p>The <b>assign</b> function is used to copy the values of all of the enumerable own properties from a <var>source</var>
object to a <var>target</var> object. When the <b>assign</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>to</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>to</i>).</li>
<li>Let <i>from</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>source</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>from</i>).</li>
<li>Let <i>keys</i> be the result of calling the [[OwnPropertyKeys]] internal method of <i>source</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).</li>
<li>Let <i>gotAllNames</i> be <b>false</b>.</li>
<li>Let <i>pendingException</i> be <b>undefined</b>.</li>
<li>Repeat while <i>gotAllNames</i> is <b>false</b>,
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>keys</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>gotAllNames</i> be <b>true</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>nextKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextKey</i>).</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>from</i> with argument
<i>nextKey</i>.</li>
<li>If <i>desc</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If <i>pendingException</i> is <b>undefined</b>, then set <i>pendingException</i> to <i>desc</i>.</li>
</ol>
</li>
<li>Else if <i>desc</i> is not <b>undefined</b> and <i>desc</i>.[[Enumerable]] is <b>true</b>, then
<ol class="block">
<li>Let propValue be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(from, nextKey).</li>
<li>If propValue is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>If pendingException is <b>undefined</b>, then set pendingException to propValue.</li>
</ol>
</li>
<li>else
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>to</i>, <i>nextKey</i>,
<i>propValue</i>, <b>true</b>);</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>,
then
<ol class="block">
<li>If pendingException is <b>undefined</b>, then set pendingException to status.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>pendingException</i> is not <b>undefined</b>, then return <i>pendingException</i>.</li>
<li>Return <i>to</i>.</li>
</ol>
</section>
<section id="sec-object.create">
<h1><span class="secnum" id="sec-19.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.create" title="link to this section">19.1.2.2</a></span>
Object.create ( O [ , Properties ] )</h1>
<p>The <b>create</b> function creates a new object with a specified prototype. When the <b>create</b> function is called,
the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or Null throw a <b>TypeError</b>
exception.</li>
<li>Let <i>obj</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a> with argument
<i>O</i>.</li>
<li>If the argument <i>Properties</i> is present and not <b>undefined</b>, then
<ol class="block">
<li>Return the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectdefineproperties">ObjectDefineProperties</a>(<i>obj</i>, <i>Properties</i>).</li>
</ol>
</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
<section id="sec-object.defineproperties">
<div class="front">
<h1><span class="secnum" id="sec-19.1.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperties" title="link to this section">19.1.2.3</a></span> Object.defineProperties ( O, Properties )</h1>
<p>The <b>defineProperties</b> function is used to add own properties and/or update the attributes of existing own
properties of an object. When the <b>defineProperties</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>Return the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectdefineproperties">ObjectDefineProperties</a> with
arguments <i>O</i> and <i>Properties</i>.</li>
</ol>
</div>
<section id="sec-objectdefineproperties">
<h1><span class="secnum" id="sec-19.1.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectdefineproperties" title="link to this section">19.1.2.3.1</a></span> Runtime Semantics: ObjectDefineProperties Abstract Operation</h1>
<p>The abstract operation ObjectDefineProperties with arguments <i>O</i> and <i>Properties</i> performs the following
steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object throw a <b>TypeError</b>
exception.</li>
<li>Let <i>props</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>Properties</i>).</li>
<li>Let <i>names</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the keys of each
enumerable own property of <i>props.</i></li>
<li>Let <i>descriptors</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each element <i>P</i> of <i>names</i> in list order,
<ol class="block">
<li>Let <i>descObj</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>( <i>props</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>descObj</i>).</li>
<li>Let <i>desc</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor">ToPropertyDescriptor</a> with
<i>descObj</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>Append the pair (a two element <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>) consisting of
<i>P</i> and <i>desc</i> to the end of <i>descriptors</i>.</li>
</ol>
</li>
<li>Let <i>pendingException</i> be <b>undefined</b>.</li>
<li>For each <i>pair</i> from <i>descriptors</i> in list order,
<ol class="block">
<li>Let <i>P</i> be the first element of <i>pair</i>.</li>
<li>Let <i>desc</i> be the second element of <i>pair</i>.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O</i>,<i>P</i>, <i>desc</i>).</li>
<li>If <i>status</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> then,
<ol class="block">
<li>If <i>pendingException</i> is <b>undefined</b>, then set <i>pendingException</i> to <i>status</i>.</li>
</ol>
</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>pendingException</i>).</li>
<li>Return <i>O</i>.</li>
</ol>
<p>If an implementation defines a specific order of enumeration for the for-in statement, that same enumeration order
must be used to order the list elements in step 3 of this algorithm.</p>
<div class="note">
<p><span class="nh">NOTE</span> An exception in defining an individual property in step 7 does not terminate the
process of defining other properties. All valid property definitions are processed.</p>
</div>
</section>
</section>
<section id="sec-object.defineproperty">
<h1><span class="secnum" id="sec-19.1.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperty" title="link to this section">19.1.2.4</a></span> Object.defineProperty ( O, P, Attributes )</h1>
<p>The <b>defineProperty</b> function is used to add an own property and/or update the attributes of an existing own
property of an object. When the <b>defineProperty</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object throw a <b>TypeError</b>
exception.</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Let <i>desc</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor">ToPropertyDescriptor</a>(<i>Attributes</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>Let <i>success</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O,key</i>,
<i>desc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>success</i>).</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-object.freeze">
<h1><span class="secnum" id="sec-19.1.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.freeze" title="link to this section">19.1.2.5</a></span>
Object.freeze ( O )</h1>
<p>When the <b>freeze</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <i>O</i>.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setintegritylevel">SetIntegrityLevel</a>( <i>O</i>,
"<code>frozen</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-object.getownpropertydescriptor">
<h1><span class="secnum" id="sec-19.1.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertydescriptor" title="link to this section">19.1.2.6</a></span> Object.getOwnPropertyDescriptor ( O, P )</h1>
<p>When the <code>getOwnPropertyDescriptor</code> function is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>obj</i> with argument
<i>key</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-frompropertydescriptor">FromPropertyDescriptor</a>(<i>desc</i>).</li>
</ol>
</section>
<section id="sec-object.getownpropertynames">
<h1><span class="secnum" id="sec-19.1.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertynames" title="link to this section">19.1.2.7</a></span> Object.getOwnPropertyNames ( O )</h1>
<p>When the <b>getOwnPropertyNames</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys">GetOwnPropertyKeys</a>(<i>O</i>, String).</li>
</ol>
</section>
<section id="sec-object.getownpropertysymbols">
<div class="front">
<h1><span class="secnum" id="sec-19.1.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertysymbols" title="link to this section">19.1.2.8</a></span> Object.getOwnPropertySymbols ( O )</h1>
<p>When the <b>getOwnPropertySymbols</b> function is called with argument <var>O</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys">GetOwnPropertyKeys</a>(<i>O</i>, Symbol).</li>
</ol>
</div>
<section id="sec-getownpropertykeys">
<h1><span class="secnum" id="sec-19.1.2.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys" title="link to this section">19.1.2.8.1</a></span> GetOwnPropertyKeys ( O, Type ) Abstract Operation</h1>
<p>The abstract operation GetOwnPropertyKeys is called with arguments <var>O</var> and <span class="nt">Type</span>
where <var>O</var> is an Object and <span class="nt">Type</span> is one of the ECMAScript specification types String or
Symbol. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>keys</i> be the result of calling the [[OwnPropertyKeys]] internal method of <i>obj</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).</li>
<li>Let <i>nameList</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>gotAllNames</i> be <b>false</b>.</li>
<li>Repeat while <i>gotAllNames</i> is <b>false</b>,
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>keys</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>gotAllNames</i> be <b>true</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>nextKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextKey</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>nextKey</i>) is <i>Type</i>, then
<ol class="block">
<li>Append <i>nextKey</i> as the last element of <i>nameList</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist">CreateArrayFromList</a>(<i>nameList</i>).</li>
</ol>
</section>
</section>
<section id="sec-object.getprototypeof">
<h1><span class="secnum" id="sec-19.1.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getprototypeof" title="link to this section">19.1.2.9</a></span> Object.getPrototypeOf ( O )</h1>
<p>When the <code>getPrototypeOf</code> function is called with argument <var>O</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Return the result of calling the [[GetPrototypeOf]] internal method of <i>obj</i>.</li>
</ol>
</section>
<section id="sec-object.is">
<h1><span class="secnum" id="sec-19.1.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.is" title="link to this section">19.1.2.10</a></span>
Object.is ( value1, value2 )</h1>
<p>When the <b>is</b> function is called with arguments <var>value1</var> and <var>value2</var> the following steps are
taken:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>value1</i>, <i>value2</i>).</li>
</ol>
</section>
<section id="sec-object.isextensible">
<h1><span class="secnum" id="sec-19.1.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isextensible" title="link to this section">19.1.2.11</a></span> Object.isExtensible ( O )</h1>
<p>When the <b>isExtensible</b> function is called with argument <var>O</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<i>O</i>).</li>
</ol>
</section>
<section id="sec-object.isfrozen">
<h1><span class="secnum" id="sec-19.1.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isfrozen" title="link to this section">19.1.2.12</a></span> Object.isFrozen ( O )</h1>
<p>When the <b>isFrozen</b> function is called with argument <var>O</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <b>true</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testintegritylevel">TestIntegrityLevel</a>(<i>O</i>, "<code>frozen</code>").</li>
</ol>
</section>
<section id="sec-object.issealed">
<h1><span class="secnum" id="sec-19.1.2.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.issealed" title="link to this section">19.1.2.13</a></span> Object.isSealed ( O )</h1>
<p>When the <b>isSealed</b> function is called with argument <var>O</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <b>true</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testintegritylevel">TestIntegrityLevel</a>(<i>O</i>, "<code>sealed</code>").</li>
</ol>
</section>
<section id="sec-object.keys">
<h1><span class="secnum" id="sec-19.1.2.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys" title="link to this section">19.1.2.14</a></span>
Object.keys ( O )</h1>
<p>When the <b>keys</b> function is called with argument <var>O</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>keys</i> be the result of calling the [[OwnPropertyKeys]] internal method of <i>obj</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).</li>
<li>Let <i>nameList</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>gotAllNames</i> be <b>false</b>.</li>
<li>Repeat while <i>gotAllNames</i> is <b>false</b>,
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>keys</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then let <i>gotAllNames</i> be <b>true</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>nextKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextKey</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>nextKey</i>) is String, then
<ol class="block">
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with
argument <i>nextKey</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>If <i>desc</i> is not <b>undefined</b> and <i>desc</i>.[[Enumerable]] is <b>true</b>, then
<ol class="block">
<li>Append <i>nextKey</i> as the last element of <i>nameList</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayfromlist">CreateArrayFromList</a>(<i>nameList</i>).</li>
</ol>
<p>If an implementation defines a specific order of enumeration for the for-in statement, the same order must be used for
the elements of the array returned in step 8.</p>
</section>
<section id="sec-object.preventextensions">
<h1><span class="secnum" id="sec-19.1.2.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.preventextensions" title="link to this section">19.1.2.15</a></span> Object.preventExtensions ( O )</h1>
<p>When the <b>preventExtensions</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <i>O</i>.</li>
<li>Let <i>status</i> be the result of calling the [[PreventExtensions]] internal method of <i>O</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-object.prototype">
<h1><span class="secnum" id="sec-19.1.2.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype" title="link to this section">19.1.2.16</a></span> Object.prototype</h1>
<p>The initial value of <code>Object.prototype</code> is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>This property has the attributes {[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-object.seal">
<h1><span class="secnum" id="sec-19.1.2.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.seal" title="link to this section">19.1.2.17</a></span>
Object.seal ( O )</h1>
<p>When the <b>seal</b> function is called, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, return <i>O</i>.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setintegritylevel">SetIntegrityLevel</a>( <i>O</i>,
"<code>sealed</code>").</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-object.setprototypeof">
<h1><span class="secnum" id="sec-19.1.2.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.setprototypeof" title="link to this section">19.1.2.18</a></span> Object.setPrototypeOf ( O, proto )</h1>
<p>When the <code>setPrototypeOf</code> function is called with arguments <span style="font-family: Times New
Roman"><i>O</i> and</span> proto, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<i>O</i>)<i>.</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>proto</i>) is neither Object nor Null, then throw a
<b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, then return <i>O</i>.</li>
<li>Let <i>status</i> be the result of calling the [[SetPrototypeOf]] internal method of <i>O</i> with argument
<i>proto</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
</section>
<section id="sec-properties-of-the-object-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-19.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object" title="link to this section">19.1.3</a></span> Properties of the Object Prototype Object</h1>
<p>The Object prototype object is an ordinary object.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Object prototype object is <b>null</b> and the initial value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>true</b>.</p>
</div>
<section id="sec-object.prototype.constructor">
<h1><span class="secnum" id="sec-19.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.constructor" title="link to this section">19.1.3.1</a></span> Object.prototype.constructor</h1>
<p>The initial value of <code>Object.prototype.constructor</code> is the standard built-in <code>Object</code>
constructor.</p>
</section>
<section id="sec-object.prototype.hasownproperty">
<h1><span class="secnum" id="sec-19.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.hasownproperty" title="link to this section">19.1.3.2</a></span> Object.prototype.hasOwnProperty ( V )</h1>
<p>When the <code>hasOwnProperty</code> method is called with argument <var>V</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>P</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>V</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>O</i>, <i>P</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The ordering of steps 1 and 3 is chosen to ensure that any exception that would have
been thrown by step 1 in previous editions of this specification will continue to be thrown even if the <b>this</b>
value is <b>undefined</b> or <b>null</b>.</p>
</div>
</section>
<section id="sec-object.prototype.isprototypeof">
<h1><span class="secnum" id="sec-19.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.isprototypeof" title="link to this section">19.1.3.3</a></span> Object.prototype.isPrototypeOf ( V )</h1>
<p>When the <code>isPrototypeOf</code> method is called with argument <var>V</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <i>V</i> is not an object, return <b>false</b>.</li>
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Repeat
<ol class="block">
<li>Let <i>V</i> be the result of calling the [[GetPrototypeOf]] internal method of <i>V</i> with no arguments.</li>
<li>if <i>V</i> is <b>null</b>, return <b>false</b></li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>O</i>, <i>V</i>) is <b>true</b>, then return <b>true</b>.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The ordering of steps 1 and 2 preserves the behaviour specified by previous editions of
this specification for the case where V is not an object and the <b>this</b> value is <b>undefined</b> or null.</p>
</div>
</section>
<section id="sec-object.prototype.propertyisenumerable">
<h1><span class="secnum" id="sec-19.1.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.propertyisenumerable" title="link to this section">19.1.3.4</a></span> Object.prototype.propertyIsEnumerable ( V )</h1>
<p>When the <code>propertyIsEnumerable</code> method is called with argument <var>V</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>P</i> be ToPropoertyKey(<i>V</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> passing <i>P</i> as the
argument.</li>
<li>If <i>desc</i> is <b>undefined</b>, return <b>false</b>.</li>
<li>Return the value of <i>desc</i>.[[Enumerable]].</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> This method does not consider objects in the prototype chain.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The ordering of steps 1 and 2 is chosen to ensure that any exception that would have
been thrown by step 1 in previous editions of this specification will continue to be thrown even if the <b>this</b>
value is <b>undefined</b> or <b>null</b>.</p>
</div>
</section>
<section id="sec-object.prototype.tolocalestring">
<h1><span class="secnum" id="sec-19.1.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tolocalestring" title="link to this section">19.1.3.5</a></span> Object.prototype.toLocaleString ( )</h1>
<p>When the <b>toLocaleString</b> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>O</i>, <code>"toString"</code>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> This function is provided to give all Objects a generic <code>toLocaleString</code>
interface, even though not all may use it. Currently, <code>Array</code>, <code>Number</code>, and <code>Date</code>
provide their own locale-sensitive <code>toLocaleString</code> methods.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The first parameter to this function is likely to be used in a future version of this
standard; it is recommended that implementations do not use this parameter position for anything else.</p>
</div>
</section>
<section id="sec-object.prototype.tostring">
<h1><span class="secnum" id="sec-19.1.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring" title="link to this section">19.1.3.6</a></span> Object.prototype.toString ( )</h1>
<p>When the <code>toString</code> method is called, the following steps are taken:</p>
<ol class="proc">
<li>If the <b>this</b> value is <b>undefined</b>, return <code>"[object Undefined]"</code>.</li>
<li>If the <b>this</b> value is <b>null</b>, return <code>"[object Null]"</code>.</li>
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li>If <i>O</i> is an exotic Array object, then let <i>builtinTag</i> be <code>"Array"</code>.</li>
<li>Else, if <i>O</i> is an exotic String object, then let <i>builtinTag</i> be <code>"String"</code>.</li>
<li>Else, if <i>O</i> is an exotic Proxy object, then let <i>builtinTag</i> be <code>"Proxy"</code>.</li>
<li>Else, if <i>O</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects">exotic arguments object</a>, then let
<i>builtinTag</i> be <code>"Arguments"</code>.</li>
<li>Else, if <i>O</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, a built-in
function object, or a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">bound function</a> exotic object, then let
<i>builtinTag</i> be <code>"Function"</code>.</li>
<li>Else, if <i>O</i> has an [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>,
then let <i>builtinTag</i> be <code>"Error"</code>.</li>
<li>Else, if <i>O</i> has a [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>,
then let <i>builtinTag</i> be <code>"Boolean"</code>.</li>
<li>Else, if <i>O</i> has a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>,
then let <i>builtinTag</i> be <code>"Number"</code>.</li>
<li>Else, if <i>O</i> has a [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>,
then let <i>builtinTag</i> be <code>"Date"</code>.</li>
<li>Else, if <i>O</i> has a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then let <i>builtinTag</i> be <code>"RegExp"</code>.</li>
<li>Else, let <i>builtinTag</i> be <code>"Object"</code>.</li>
<li>Let <i>hasTag</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, @@toStringTag).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasTag</i>).</li>
<li>If <i>hasTag</i> is <b>false</b>, then let <i>tag</i> be <i>builtinTag</i>.</li>
<li>Else,
<ol class="block">
<li>Let <i>tag</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, @@toStringTag).</li>
<li>If <i>tag</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, let <i>tag</i> be
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<code>"???"</code>).</li>
<li>Let <i>tag</i> be <i>tag</i>.[[value]].</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>tag</i>) is not String, let <i>tag</i> be
<code>"???"</code>.</li>
<li>If <i>tag</i> is any of <code>"Arguments"</code>, <code>"Array"</code>, <code>"Boolean"</code>,
<code>"Date"</code>, <code>"Error"</code>, <code>"Function"</code>, <code>"Number"</code>,
<code>"RegExp"</code>, or <code>"String"</code> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>tag</i>,
<i>builtinTag</i>) is <b>false</b>, then let <i>tag</i> be the string value <code>"~"</code> concatenated with
the current value of <i>tag</i>.</li>
</ol>
</li>
<li>Return the String value that is the result of concatenating the three Strings "[object ", tag, and "]".</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Historically, this function was occasionally used to access the string value of the
[[Class]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> 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 the ability to use it as a reliable test for those specific kinds of built-in objects but it does not provide
a reliable type testing mechanism for other kinds of built-in or program defined objects.</p>
</div>
</section>
<section id="sec-object.prototype.valueof">
<h1><span class="secnum" id="sec-19.1.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.valueof" title="link to this section">19.1.3.7</a></span> Object.prototype.valueOf ( )</h1>
<p>When the <b>valueOf</b> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
</section>
<section id="sec-properties-of-object-instances">
<h1><span class="secnum" id="sec-19.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-object-instances" title="link to this section">19.1.4</a></span> Properties of Object Instances</h1>
<p>Object instances have no special properties beyond those inherited from the Object prototype object.</p>
</section>
</section>
<section id="sec-function-objects">
<div class="front">
<h1><span class="secnum" id="sec-19.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-objects" title="link to this section">19.2</a></span> Function
Objects</h1>
</div>
<section id="sec-function-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-constructor" title="link to this section">19.2.1</a></span> The Function Constructor</h1>
<p>The Function constructor is the %Function% intrinsic object and the initial value of the <code>Function</code> property
of the global object. When <code>Function</code> is called as a function rather than as a constructor, it creates and
initializes a new Function object. Thus the function call <span style="font-family:
monospace"><b>Function(</b>…<b>)</b></span> is equivalent to the object creation expression <span style="font-family: monospace"><b>new Function(</b>…<b>)</b></span> with the same arguments. However, if the
<b>this</b> value passed in the call is an Object with a [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined</span>, it initializes the <b>this</b> value using the argument values. This permits
<code>Function</code> to be used both as factory method and to perform constructor instance initialisation.</p>
<p><code>Function</code> may be subclassed and subclass constructors may perform a <code>super</code> invocation of the
<code>Function</code> constructor to initialize subclass instances. However, all syntactic forms for defining function
objects create instances of <code>Function</code>. There is no syntactic means to create instances of
<code>Function</code> subclasses except for the built-in Generator Function subclass.</p>
</div>
<section id="sec-function-p1-p2-pn-body">
<h1><span class="secnum" id="sec-19.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-p1-p2-pn-body" title="link to this section">19.2.1.1</a></span> Function ( p1, p2, … , pn, body )</h1>
<p>The last argument specifies the body (executable code) of a function; any preceding arguments specify formal
parameters.</p>
<p>When the <code>Function</code> function is called with some arguments <var>p1</var>, <var>p2</var>, … ,
<var>pn</var>, <var>body</var> (where <var>n</var> might be <span style="font-family: Times New Roman">0</span>, that is,
there are no “<var>p</var>” arguments, and where <var>body</var> might also not be provided), the following
steps are taken:</p>
<ol class="proc">
<li>Let <i>argCount</i> be the total number of arguments passed to this function invocation.</li>
<li>Let <i>P</i> be the empty String.</li>
<li>If <i>argCount</i> = 0, let <i>bodyText</i> be the empty String.</li>
<li>Else if <i>argCount</i> = 1, let <i>bodyText</i> be that argument.</li>
<li>Else <i>argCount</i> &gt; 1,
<ol class="block">
<li>Let <i>firstArg</i> be the first argument.</li>
<li>Let <i>P</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>firstArg</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>Let <i>k</i> be 2.</li>
<li>Repeat, while <i>k</i> &lt; <i>argCount</i>
<ol class="block">
<li>Let <i>nextArg</i> be the <i>k</i>’th argument.</li>
<li>Let <i>nextArgString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nextArg</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextArgString</i>).</li>
<li>Let <i>P</i> be the result of concatenating the previous value of <i>P</i>, the String <code>","</code> (a
comma), and <i>nextArgString</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>bodyText</i> be the <i>k</i>’th argument.</li>
</ol>
</li>
<li>Let <i>bodyText</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>bodyText</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>bodyText</i>).</li>
<li>Let <i>parameters</i> be the result of parsing <i>P</i>, interpreted as UTF-16 encoded Unicode text as described in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">clause 10.1.1</a><i>,</i> using <i>FormalParameters</i> as the goal
symbol. Throw a <b>SyntaxError</b> exception if the parse fails.</li>
<li>Let <i>body</i> be the result of parsing <i>bodyText</i>, interpreted as UTF-16 encoded Unicode text as described in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">clause 10.1.1</a><i>,</i> using <i>FunctionBody</i> as the goal
symbol. Throw a <b>SyntaxError</b> exception if the parse fails or if any static semantics errors are detected.</li>
<li>If IsSimpleParameterList of <i>parameters</i> is <b>false</b> and any element of the BoundNames of <i>parameters</i>
also occurs in the VarDeclaredNames of <i>body</i>, then throw a <b>SyntaxError</b> exception.</li>
<li>If any element of the BoundNames of <i>parameters</i> also occurs in the LexicallyDeclaredNames of <i>body</i>, then
throw a <b>SyntaxError</b> exception.</li>
<li>If <i>bodyText</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see
10.2.1</a>) then let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the Global Environment</a>.</li>
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>F</i>) is not Object or if <i>F</i> does not have a
[[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or if the value of [[Code]] is
not <b>undefined</b>, then
<ol class="block">
<li>Let <i>C</i> be the function that is currently being evaluated.</li>
<li>Let <i>proto</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>C</i>,
<code>"%FunctionPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>F</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a> with arguments
<i>C</i> and <i>strict</i>.</li>
</ol>
</li>
<li>Else, set <i>F’s</i> [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>strict</i>.</li>
<li>If the value of <i>F’s</i> [[FunctionKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is not <code>"normal"</code>, then throw a <b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> is an extensible object.</li>
<li>Perform the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioninitialize">FunctionInitialize</a> abstract operation with arguments <i>F</i>,
Normal, <i>parameters</i>, <i>body,</i> and <i>scope</i>.</li>
<li>If ReferencesSuper of <i>body</i> is <b>true</b> or ReferencesSuper of <i>parameters</i> is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>F</i>, <b>undefined</b>, <b>undefined</b>).</li>
</ol>
</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a> with argument <i>F</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>hasName</i> be HasOwnProprty(<i>F</i>, <span style="font-family: monospace">"<b>name</b>"</span>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasName</i>).</li>
<li>If <i>hasName</i> is <b>false</b>, then perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>F</i>, <span style="font-family: monospace">"<b>anonymous</b>"</span>).</li>
<li>Return <i>F</i>.</li>
</ol>
<p>A <code>prototype</code> property is automatically created for every function created using the <code>Function</code>
constructor, to provide for the possibility that the function will be used as a constructor.</p>
<div class="note">
<p><span class="nh">NOTE</span> 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>new Function("a", "b", "c", "return a+b+c")</pre>
<pre>new Function("a, b, c", "return a+b+c")</pre>
<pre>new Function("a,b", "c", "return a+b+c")</pre>
</div>
</section>
<section id="sec-new-function-argumentslist">
<h1><span class="secnum" id="sec-19.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-function-argumentslist" title="link to this section">19.2.1.2</a></span> new Function ( ...argumentsList )</h1>
<p>When <code>Function</code> is called as part of a <code>new</code> expression, it initializes the newly created
object.</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Function</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Function</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function
object</a>, its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-function-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-constructor" title="link to this section">19.2.2</a></span> Properties of the Function Constructor</h1>
<p>The Function constructor is itself a built-in Function object. The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Function constructor is
%FunctionPrototype%, the intrinsic Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>The value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Function constructor is <b>true</b>.</p>
<p>The Function constructor has the following properties:</p>
</div>
<section id="sec-function.length">
<h1><span class="secnum" id="sec-19.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.length" title="link to this section">19.2.2.1</a></span>
Function.length</h1>
<p>This is a data property with a value of 1. This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-function.prototype">
<h1><span class="secnum" id="sec-19.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype" title="link to this section">19.2.2.2</a></span> Function.prototype</h1>
<p>The value of <code>Function.prototype</code> is %FunctionPrototype%, the intrinsic Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">false</span> }.</p>
</section>
<section id="sec-function-@@create">
<h1><span class="secnum" id="sec-19.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-@@create" title="link to this section">19.2.2.3</a></span> Function[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>proto</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%FunctionPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a> with arguments
<i>proto</i> and <b>false</b>.</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The Function <code>@@create</code> function passes <b>false</b> as the <i>strict</i>
parameter to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a>. This causes the allocated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> to have the internal methods of a non-strict
function. The <code>Function</code> constructor may reset the functions [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>true</b>. It is up to the implementation
whether this also changes the internal methods.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-function-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-19.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object" title="link to this section">19.2.3</a></span> Properties of the Function Prototype Object</h1>
<p>The Function prototype object is itself a Built-in Function object. When invoked, it accepts any arguments and returns
<b>undefined</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The Function prototype object is specified to be a function object to ensure
compatibility with ECMAScript code that was created prior to the 6<sup>th</sup> Edition of this specification.</p>
</div>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Function prototype object is the intrinsic object %ObjectPrototype% (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The initial value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Function prototype object is
<b>true</b>.</p>
<p>The Function prototype object does not have a <code>prototype</code> property.</p>
<p>The value of The <code>length</code> property of the Function prototype object is <b>0</b>.</p>
<p>The value of the <code>name</code> property of the Function prototype object is the empty String.</p>
</div>
<section id="sec-function.prototype.apply">
<h1><span class="secnum" id="sec-19.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.apply" title="link to this section">19.2.3.1</a></span> Function.prototype.apply ( thisArg, argArray )</h1>
<p>When the <code>apply</code> method is called on an object <var>func</var> with arguments <var>thisArg</var> and
<var>argArray</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>func</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>argArray</i> is <b>null</b> or <b>undefined</b>, then
<ol class="block">
<li>Return the result of calling the [[Call]] internal method of <i>func</i>, providing <i>thisArg</i> as
<i>thisArgument</i> and an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of arguments as
<i>argumentsList</i>.</li>
</ol>
</li>
<li>Let <i>argList</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlistfromarraylike">CreateListFromArrayLike</a>(<i>argArray</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>argList</i> ).</li>
<li>Perform the PrepareForTailCall abstract operation.</li>
<li>Return the result of calling the [[Call]] internal method of <i>func</i>, providing <i>thisArg</i> as
<i>thisArgument</i> and <i>argList</i> as <i>argumentsList</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>apply</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The thisArg value is passed without modification as the <b>this</b> value. This is a
change from Edition 3, where an <b>undefined</b> or <b>null</b> thisArg is replaced with the global object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> is applied to all other values and that result is passed as the <b>this</b> value.
Even though the thisArg is passed without modification, non-strict mode functions still perform these transfromations
upon entry to the function.</p>
</div>
</section>
<section id="sec-function.prototype.bind">
<h1><span class="secnum" id="sec-19.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.bind" title="link to this section">19.2.3.2</a></span> Function.prototype.bind ( thisArg [ , arg1 [ , arg2, …] ]
)</h1>
<p>The bind method takes one or more arguments, <var>thisArg</var> and (optionally) <var>arg1</var>, <var>arg2</var>, etc,
and returns a new function object by performing the following steps:</p>
<ol class="proc">
<li>Let <i>Target</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>Target</i>) is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>A</i> be a new (possibly empty) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of all
of the argument values provided after <i>thisArg</i> (<i>arg1</i>, <i>arg2</i> etc), in order.</li>
<li>Let <i>F</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boundfunctioncreate">BoundFunctionCreate</a> with
arguments <i>Target</i>, <i>thisArg</i>, and <i>A</i>.</li>
<li>If <i>Target</i> has a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">[[BoundTargetFunction]]</a> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>targetLen</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>Target</i>, <code>"length"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetLen</i>).</li>
<li>Let <i>L</i> be the larger of 0 and the result of <i>targetLen</i> minus the number of elements of
<i>A</i>.</li>
</ol>
</li>
<li>Else let <i>L</i> be 0.</li>
<li>Call the [[DefineOwnProperty]] internal method of <i>F</i> with arguments <code>"length"</code> and
PropertyDescriptor {[[Value]]: <i>L</i>, [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b>}.</li>
<li>Perform the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">AddRestrictedFunctionProperties</a> abstract operation
with argument <i>F</i>.</li>
<li>Return <i>F</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>bind</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> Function objects created using <code>Function.prototype.bind</code> are exotic objects.
They also do not have a <code>prototype</code> property.</p>
</div>
</section>
<section id="sec-function.prototype.call">
<h1><span class="secnum" id="sec-19.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.call" title="link to this section">19.2.3.3</a></span> Function.prototype.call (thisArg [ , arg1 [ , arg2, … ] ]
)</h1>
<p>When the <code>call</code> method is called on an object <var>func</var> with argument <var>thisArg</var> and optional
arguments <var>arg1</var>, <var>arg2</var> etc, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>func</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>argList</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If this method was called with more than one argument then in left to right order starting with <i>arg1</i> append
each argument as the last element of <i>argList</i></li>
<li>Perform the PrepareForTailCall abstract operation.</li>
<li>Return the result of calling the [[Call]] internal method of <i>func</i>, providing <i>thisArg</i> as
<i>thisArgument</i> and <i>argList</i> as <i>argumentsList</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>call</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The thisArg value is passed without modification as the <b>this</b> value. This is a
change from Edition 3, where an <b>undefined</b> or <b>null</b> thisArg is replaced with the global object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> is applied to all other values and that result is passed as the <b>this</b> value.
Even though the thisArg is passed without modification, non-strict mode functions still perform these transfromations
upon entry to the function.</p>
</div>
</section>
<section id="sec-function.prototype.constructor">
<h1><span class="secnum" id="sec-19.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.constructor" title="link to this section">19.2.3.4</a></span> Function.prototype.constructor</h1>
<p>The initial value of <code>Function.prototype.constructor</code> is the intrinsic object %Function%.</p>
</section>
<section id="sec-function.prototype.tomethod">
<h1><span class="secnum" id="sec-19.2.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.tomethod" title="link to this section">19.2.3.5</a></span> Function.prototype.toMethod (newHome [ , methodName ] )</h1>
<p>When the <code>toMethod</code> method is called on an object <var>func</var> with argument <var>superBinding</var> and
optional argument <var>methodName</var> the following steps are taken:</p>
<ol class="proc">
<li>If <i>func</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, then
<ol class="block">
<li>NOTE <i>func</i> may be a Built-in function that is implemented as an ECMAScript function.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>newHome</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>methodName</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>methodName</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>methodName</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>methodName</i>).</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonemethod">CloneMethod</a>(<i>func</i>, <i>newHome</i>, <i>methodName</i>).</li>
</ol>
</li>
<li>If <i>func</i> is an standard exotic Built-in function object, then
<ol class="block">
<li>Return a new exotic Built-in function object that implements the same Built-in function as <i>func</i> and with
the same <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> association.</li>
</ol>
</li>
<li>If <i>func</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">Bound Function</a> exotic object, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>func</i> is any other exotic function object that supports the equivalent of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonemethod">CloneMethod</a> abstract operation, then return an appropriately cloned object.</li>
<li>Tthrow a <b>TypeError</b> exception.</li>
</ol>
<p>The <code>length</code> property of the <code>toMethod</code> method is <b>1</b>.</p>
</section>
<section id="sec-function.prototype.tostring">
<h1><span class="secnum" id="sec-19.2.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.tostring" title="link to this section">19.2.3.6</a></span> Function.prototype.toString ( )</h1>
<p>An implementation-dependent String source code representation of the <b>this</b> object is returned. This
representation has the syntax of a <span class="nt">FunctionDeclaration</span> <span style="font-family: Times New
Roman"><i>FunctionExpression</i>, <i>GeneratorDeclaration, GeneratorExpession, ClassDeclaration</i>,
<i>ClassExpression</i>, <i>ArrowFunction</i>, <i>MethodDefinition</i>, or <i>GeneratorMethod</i> depending upon the actual
characteristics of the object</span>. In particular that the use and placement of white space, line terminators, and
semicolons within the representation String is implementation-dependent.</p>
<p>If the object was defined using ECMAScript code and the returned string representation is in the form of a <span class="nt">FunctionDeclaration</span> <span style="font-family: Times New Roman"><i>FunctionExpression</i>,
<i>GeneratorDeclaration, GeneratorExpession, ClassDeclaration</i>, <i>ClassExpression</i>, or <i>ArrowFunction</i></span>
then the representation must be such that if the string is evaluated, using <code>eval</code> in a lexical context that is
equivalent to the lexical context used to create the original object, it will result in a new functionally equivalent
object. The returned source code must not mention freely any variables that were not mentioned freely by the original
function’s source code, even if these “extra” names were originally in scope. If the source code string
does meet these criteria then it must be a string for which <code>eval</code> will throw a <b>SyntaxError</b>
exception.</p>
<p>The <code>toString</code> function is not generic; it throws a <b>TypeError</b> exception if its <b>this</b> value does
not have a [[Call]] internal method. Therefore, it cannot be transferred to other kinds of objects for use as a
method.</p>
</section>
<section id="sec-function.prototype-@@create">
<h1><span class="secnum" id="sec-19.2.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype-@@create" title="link to this section">19.2.3.7</a></span> Function.prototype[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%ObjectPrototype%"</code>).</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> This is the default @@create method that is inherited by all ordinary constructor
functions that do not explicitly over-ride it.</p>
</div>
</section>
<section id="sec-function.prototype-@@hasinstance">
<h1><span class="secnum" id="sec-19.2.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype-@@hasinstance" title="link to this section">19.2.3.8</a></span> Function.prototype[@@hasInstance] ( V )</h1>
<p>When the @@hasInstance method of an object <var>F</var> is called with value <var>V</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinaryhasinstance">OrdinaryHasInstance</a>(<i>F</i>, <i>V</i>).</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.hasInstance]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <span class="value">false</span>,
[[Configurable]]: <span class="value">false</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> This is the default implementation of <code>@@hasInstance</code> that most functions
inherit. <code>@@hasInstance</code> is called by the <code>instanceof</code> operator to deterimine whether a value is
an instance of a specific constructor. An expression such as</p>
<pre>v instanceof F</pre>
<p>evaluates as</p>
<pre>F[@@hasInstance](v)</pre>
<p>A constructor function can control which objects are recognised as its instances by <code>instanceof</code> by
exposing a different <code>@@hasInstance</code> method on the function.</p>
<p>This property is non-writable and non-configurable to prevent tampering that could be used to globally expose the
target function of a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bound-function-exotic-objects">bound function</a>.</p>
</div>
</section>
</section>
<section id="sec-function-instances">
<div class="front">
<h1><span class="secnum" id="sec-19.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-instances" title="link to this section">19.2.4</a></span>
Function Instances</h1>
<p>Every function instance is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> and has the
internal slots listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a>.</p>
<p>Function instances that correspond to strict mode functions and function instances created using the <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.bind">Function.prototype.bind</a> method</b> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.bind">19.2.3.2</a>) have properties named <span class="value">caller</span> and
<code>arguments</code> that throw a <b>TypeError</b> exception. An ECMAScript implementation must not associate any
implementation specific behaviour with accesses of these properties from strict mode function code.</p>
<p>The Function instances have the following properties:</p>
</div>
<section id="sec-function-instances-length">
<h1><span class="secnum" id="sec-19.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-instances-length" title="link to this section">19.2.4.1</a></span> length</h1>
<p>The value of the <code>length</code> property is an integer 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 <code>length</code> property
depends on the function. This property has the attributes {&nbsp;[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>true</b>&nbsp;}.</p>
</section>
<section id="sec-name">
<h1><span class="secnum" id="sec-19.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-name" title="link to this section">19.2.4.2</a></span> name</h1>
<p>The value of the <code>name</code> property is an String that is descriptive of the function. The name has no semantic
significance but is typically a variable or property name that is used to refer to the function at its point of definition
in ECMAScript code. This property has the attributes {&nbsp;[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>true</b>&nbsp;}.</p>
<p>Anonymous functions objects that do not have a contextual name associated with them by this specification do not have a
<code>name</code> own property but inherit the <code>name</code> property of %FunctionPrototype%.</p>
<p class="Note">Function objects created using <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.bind">Function.prototype.bind</a></code> do not have a <code>name</code> property.</p>
</section>
<section id="sec-function-instances-prototype">
<h1><span class="secnum" id="sec-19.2.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-instances-prototype" title="link to this section">19.2.4.3</a></span> prototype</h1>
<p>Function instances that can be used as a constructor have a <code>prototype</code> property. Whenever such a function
instance is created another ordinary object is also created and is the initial value of the function’s
<code>prototype</code> property. Unless otherwise specified, the value of the prototype property is used to initialize the
[[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of a newly created ordinary
object before the Function object is invoked as a constructor for that newly created object.</p>
<p>This property has the attributes {&nbsp;[[Writable]]: <b>true</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> Function objects created using <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.bind">Function.prototype.bind</a></code>, or by evaluating a <i>MethodDefinition</i> (that
is not a <i>GeneratorMethod</i>) or an <i>ArrowFunction</i> grammar production do not have a <code>prototype</code>
property.</p>
</div>
</section>
</section>
</section>
<section id="sec-boolean-objects">
<div class="front">
<h1><span class="secnum" id="sec-19.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-objects" title="link to this section">19.3</a></span> Boolean
Objects</h1>
</div>
<section id="sec-boolean-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-constructor" title="link to this section">19.3.1</a></span>
The Boolean Constructor</h1>
<p>The Boolean constructor is the %Boolean% intrinsic object and the initial value of the <code>Boolean</code> property of
the global object. When <code>Boolean</code> is called as a function rather than as a constructor, it performs a type
conversion. However, if the <b>this</b> value passed in the call is an Object with an uninitialized [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, it initializes the <b>this</b> value using the
argument value. This permits <code>Boolean</code> to be used both to perform type conversion and to perform constructor
instance initialisation.</p>
<p>The <code>Boolean</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>Boolean</code> behaviour must include a <code>super</code> call to the <code>Boolean</code> constructor to
initialize the [[BooleanData]] state of subclass instances.</p>
</div>
<section id="sec-boolean-constructor-boolean-value">
<h1><span class="secnum" id="sec-19.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-constructor-boolean-value" title="link to this section">19.3.1.1</a></span> Boolean ( value )</h1>
<p>When <code>Boolean</code> is called with argument <var>value</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>Let <i>b</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>value</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[BooleanData]]
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[BooleanData]] is
<b>undefined</b>, then
<ol class="block">
<li>Set the value of <i>O’s</i> [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>b</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</li>
<li>Return <i>b</i>.</li>
</ol>
</section>
<section id="sec-new-boolean-argumentslist">
<h1><span class="secnum" id="sec-19.3.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-boolean-argumentslist" title="link to this section">19.3.1.2</a></span> new Boolean ( ...argumentsList )</h1>
<p>When <code>Boolean</code> is called as part of a new expression , it initializes a newly created object:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Boolean</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Boolean</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-boolean-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-boolean-constructor" title="link to this section">19.3.2</a></span> Properties of the Boolean Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Boolean constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), the Boolean constructor has the following
properties:</p>
</div>
<section id="sec-boolean.prototype">
<h1><span class="secnum" id="sec-19.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean.prototype" title="link to this section">19.3.2.1</a></span> Boolean.prototype</h1>
<p>The initial value of <code>Boolean.prototype</code> is the Boolean prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-boolean-prototype-object">19.3.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-boolean-@@create">
<h1><span class="secnum" id="sec-19.3.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean-@@create" title="link to this section">19.3.2.2</a></span> Boolean[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%BooleanPrototype%"</code>, ( [[BooleanData]]) ).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> [[BooleanData]] is initially assigned the value <b>undefined</b> as a flag to indicate
that the instance has not yet been initialized by the Boolean constructor. This flag value is never directly exposed to
ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-boolean-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-19.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-boolean-prototype-object" title="link to this section">19.3.3</a></span> Properties of the Boolean Prototype Object</h1>
<p>The Boolean prototype object is an ordinary object. It is not a Boolean instance and does not have a [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Boolean prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>The abstract operation <span style="font-family: Times New Roman">thisBooleanValue(<i>value</i>)</span> performs the
following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Boolean, return <i>value</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value)</i> is Object and <i>value</i> has a
[[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>b</i> be the value of <i>value’s</i> [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>b</i> is not <b>undefined</b>, then return <i>b</i>.</li>
</ol>
</li>
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</div>
<section id="sec-boolean.prototype.constructor">
<h1><span class="secnum" id="sec-19.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean.prototype.constructor" title="link to this section">19.3.3.1</a></span> Boolean.prototype.constructor</h1>
<p>The initial value of <code>Boolean.prototype.constructor</code> is the built-in <code>Boolean</code> constructor.</p>
</section>
<section id="sec-boolean.prototype.tostring">
<h1><span class="secnum" id="sec-19.3.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean.prototype.tostring" title="link to this section">19.3.3.2</a></span> Boolean.prototype.toString ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>b</i> be thisBooleanValue(<b>this</b> value).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>b</i>).</li>
<li>If <i>b</i> is <b>true</b>, then return <code>"true"</code>; else return <code>"false"</code>.</li>
</ol>
</section>
<section id="sec-boolean.prototype.valueof">
<h1><span class="secnum" id="sec-19.3.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-boolean.prototype.valueof" title="link to this section">19.3.3.3</a></span> Boolean.prototype.valueOf ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return thisBooleanValue(<b>this</b> value).</li>
</ol>
</section>
</section>
<section id="sec-properties-of-boolean-instances">
<h1><span class="secnum" id="sec-19.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-boolean-instances" title="link to this section">19.3.4</a></span> Properties of Boolean Instances</h1>
<p>Boolean instances are ordinary objects that inherit properties from the Boolean prototype object. Boolean instances have
a [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. The [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the Boolean value represented by this Boolean
object.</p>
</section>
</section>
<section id="sec-symbol-objects">
<div class="front">
<h1><span class="secnum" id="sec-19.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects" title="link to this section">19.4</a></span> Symbol
Objects</h1>
</div>
<section id="sec-symbol-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor" title="link to this section">19.4.1</a></span>
The Symbol Constructor</h1>
<p>The Symbol constructor is the %Symbol% intrinsic object and the initial value of the <code>Symbol</code> property of
the global object. When <code>Symbol</code> is called as a function rather than as a constructor, it returns a new Symbol
value.</p>
<p>The <code>Symbol</code> constructor is not intended to be used with the <code>new</code> operator or to be subclassed.
It may be used as the value of an <code>extends</code> clause of a class declaration but a <code>super</code> call to the
<code>Symbol</code> constructor will not initialize the state of subclass instances.</p>
</div>
<section id="sec-symbol-description">
<h1><span class="secnum" id="sec-19.4.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-description" title="link to this section">19.4.1.1</a></span> Symbol ( [ description ] )</h1>
<p>When <code>Symbol</code> is called with optional argument <var>description</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <i>description</i> is <b>undefined</b>, then let <i>descString</i> be <b>undefined</b>.</li>
<li>Else, let <i>descString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>description</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>descString</i>).</li>
<li>Return a new unique Symbol value whose [[Description]] is <i>descString</i>.</li>
</ol>
</section>
<section id="sec-new-symbol-argumentslist">
<h1><span class="secnum" id="sec-19.4.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-symbol-argumentslist" title="link to this section">19.4.1.2</a></span> new Symbol ( ...argumentsList )</h1>
<p>When <code>Symbol</code> is called as part of a new expression , it initializes a newly created object:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Symbol</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Symbol</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
<div class="note">
<p><span class="nh">NOTE</span> Symbol has ordinary [[Construct]] behaviour but the definition of its @@create method
causes <code>new Symbol</code> to throw a <b>TypeError</b> exception.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-symbol-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-symbol-constructor" title="link to this section">19.4.2</a></span> Properties of the Symbol Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Symbol constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the Symbol constructor has the following
properties:</p>
</div>
<section id="sec-symbol.create">
<h1><span class="secnum" id="sec-19.4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.create" title="link to this section">19.4.2.1</a></span>
Symbol.create</h1>
<p>The initial value of <code>Symbol.create</code> is the well known symbol @@create (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table 1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.for">
<h1><span class="secnum" id="sec-19.4.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.for" title="link to this section">19.4.2.2</a></span>
Symbol.for ( key )</h1>
<p>When <code>Symbol.for</code> is called with argument <var>key</var> it performs the following steps:</p>
<ol class="proc">
<li>Let <i>stringKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>key</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>stringKey)</i>.</li>
<li>For each element <i>e</i> of the GlobalSymbolRegistry <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>,
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>e</i>.[[key]], <i>stringKey</i>) is <b>true</b>, then return
<i>e</i>.[[symbol]].</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: GlobalSymbolRegistry does not current contain an entry for
<i>stringKey</i>.</li>
<li>Let <i>newSymbol</i> be a new unique Symbol value whose [[Description]] is <i>stringKey</i>.</li>
<li>Append the record { [[key]]: <i>stringKey</i>, [[symbol]]: <i>newSymbol</i>) to the GlobalSymbolRegistry <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return <i>newSumbol</i>.</li>
</ol>
<p>The GlobalSymbolRegistry is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is globally available.
It is shared by all Code Realms. Prior to the evaluation of any ECMAScript code it is initialized as an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>. Elements of the GlobalSymbolRegistry are Records with the
structure defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-39">Table 39</a>.</p>
<figure>
<figcaption><span id="table-39">Table 39</span> — GlobalSymbolRegistry Record Fields</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Usage</th>
</tr>
<tr>
<td>[[key]]</td>
<td>A String</td>
<td>A string key used to globally identify a Symbol.</td>
</tr>
<tr>
<td>[[symbol]]</td>
<td>A Symbol</td>
<td>A symbol that can be retrieved from any <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-symbol.hasinstance">
<h1><span class="secnum" id="sec-19.4.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.hasinstance" title="link to this section">19.4.2.3</a></span> Symbol.hasInstance</h1>
<p>The initial value of <code>Symbol.hasInstance</code> is the well known symbol @@hasInstance (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table
1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.isconcatspreadable">
<h1><span class="secnum" id="sec-19.4.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.isconcatspreadable" title="link to this section">19.4.2.4</a></span> Symbol.isConcatSpreadable</h1>
<p>The initial value of <code>Symbol.isConcatSpreadable</code> is the well known symbol @@isConcatSpreadable (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table 1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.isregexp">
<h1><span class="secnum" id="sec-19.4.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.isregexp" title="link to this section">19.4.2.5</a></span>
Symbol.isRegExp</h1>
<p>The initial value of <code>Symbol.isRegExp</code> is the well known symbol @@isRegExp (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table
1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.iterator">
<h1><span class="secnum" id="sec-19.4.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.iterator" title="link to this section">19.4.2.6</a></span>
Symbol.iterator</h1>
<p>The initial value of <code>Symbol.iterator</code> is the well known symbol @@iterator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table
1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.keyfor">
<h1><span class="secnum" id="sec-19.4.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.keyfor" title="link to this section">19.4.2.7</a></span>
Symbol.keyFor ( sym )</h1>
<p>When <code>Symbol.keyFor</code> is called with argument <var>sym</var> it performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>sym</i>) is not Symbol, then throw a <b>TypeError</b>
exception.</li>
<li>For each element <i>e</i> of the GlobalSymbolRegistry <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.for">see 19.4.2.2</a>),
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>e</i>.[[symbol]], <i>sym</i>) is <b>true</b>, then return
<i>e</i>.[[key]].</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: GlobalSymbolRegistry does not current contain an entry for
<i>sym</i>.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-symbol.prototype">
<h1><span class="secnum" id="sec-19.4.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype" title="link to this section">19.4.2.8</a></span> Symbol.prototype</h1>
<p>The initial value of <code>Symbol.prototype</code> is the Symbol prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-symbol-prototype-object">19.4.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.toprimitive">
<h1><span class="secnum" id="sec-19.4.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.toprimitive" title="link to this section">19.4.2.9</a></span> Symbol.toPrimitive</h1>
<p>The initial value of <code>Symbol.toPrimitive</code> is the well known symbol @@toPrimitive (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table
1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.tostringtag">
<h1><span class="secnum" id="sec-19.4.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.tostringtag" title="link to this section">19.4.2.10</a></span> Symbol.toStringTag</h1>
<p>The initial value of <code>Symbol.toStringTag</code> is the well known symbol @@toStringTag (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table
1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol.unscopables">
<h1><span class="secnum" id="sec-19.4.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.unscopables" title="link to this section">19.4.2.11</a></span> Symbol.unscopables</h1>
<p>The initial value of <code>Symbol.</code>unscopables is the well known symbol @@unscopables (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-1">Table
1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-symbol-@@create">
<h1><span class="secnum" id="sec-19.4.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-@@create" title="link to this section">19.4.2.12</a></span> Symbol[ @@create ] ( )</h1>
<p>The @@create method of a Symbol object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-symbol-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-19.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-symbol-prototype-object" title="link to this section">19.4.3</a></span> Properties of the Symbol Prototype Object</h1>
<p>The Symbol prototype object is an ordinary object. It is not a Symbol instance and does not have a [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Symbol prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
</div>
<section id="sec-symbol.prototype.constructor">
<h1><span class="secnum" id="sec-19.4.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype.constructor" title="link to this section">19.4.3.1</a></span> Symbol.prototype.constructor</h1>
<p>The initial value of <code>Symbol.prototype.constructor</code> is the built-in <code>Symbol</code> constructor.</p>
</section>
<section id="sec-symbol.prototype.tostring">
<h1><span class="secnum" id="sec-19.4.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype.tostring" title="link to this section">19.4.3.2</a></span> Symbol.prototype.toString ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>s</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>s</i>) is Symbol, then let <i>sym</i> be
<i>s</i>.</li>
<li>Else,
<ol class="block">
<li>If <i>s</i> does not have a [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>sym</i> be the value of <i>s’s</i> [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</li>
<li>Let <i>desc</i> be the value of <i>sym’s</i> [[Description]] attribute.</li>
<li>If <i>desc</i> is <b>undefined</b>, then let <i>desc</i> be the empty string.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>desc</i>) is String.</li>
<li>Let <i>result</i> be the result of concatenating the strings <code>"Symbol("</code>, <i>desc</i>, and
<code>")"</code>.</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
<section id="sec-symbol.prototype.valueof">
<h1><span class="secnum" id="sec-19.4.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype.valueof" title="link to this section">19.4.3.3</a></span> Symbol.prototype.valueOf ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>s</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>s</i>) is Symbol, then return <i>s</i>.</li>
<li>If <i>s</i> does not have a [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Return the value of <i>s’s</i> [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</section>
<section id="sec-symbol.prototype-@@toprimitive">
<h1><span class="secnum" id="sec-19.4.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype-@@toprimitive" title="link to this section">19.4.3.4</a></span> Symbol.prototype [ @@toPrimitive ] ( hint )</h1>
<p>This function is called by ECMAScript language operators to convert an object to a primitive value. The allowed values
for <var>hint</var> are "<code>default</code>", "<code>number</code>", and "<code>string</code>". Implicit conversion of
Symbol objects to primitive values is not allowed.</p>
<p>When the <code>@@toPrimitive</code> method is called with argument <var>hint</var>, the following steps are taken:</p>
<ol class="proc">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.toPrimitive]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-symbol.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-19.4.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol.prototype-@@tostringtag" title="link to this section">19.4.3.5</a></span> Symbol.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">Symbol</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-symbol-instances">
<h1><span class="secnum" id="sec-19.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-symbol-instances" title="link to this section">19.4.4</a></span> Properties of Symbol Instances</h1>
<p>Symbol instances are ordinary objects that inherit properties from the Symbol prototype object. Symbol instances have a
[[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. The [[SymbolData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the Symbol value represented by this Symbol
object.</p>
</section>
</section>
<section id="sec-error-objects">
<div class="front">
<h1><span class="secnum" id="sec-19.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-objects" title="link to this section">19.5</a></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>
</div>
<section id="sec-error-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-constructor" title="link to this section">19.5.1</a></span>
The Error Constructor</h1>
<p>The Error constructor is the %Error% intrinsic object and the initial value of the <code>Error</code> property of the
global object. When <code>Error</code> is called as a function rather than as a constructor, it creates and initializes a
new Error object. Thus the function call <span style="font-family: monospace"><b>Error(</b>…<b>)</b></span> is
equivalent to the object creation expression <span style="font-family: monospace"><b>new Error(</b>…<b>)</b></span>
with the same arguments. However, if the <b>this</b> value passed in the call is an Object with an uninitialized
[[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, it initializes the <b>this</b>
value using the argument value rather than creating a new object. This permits <code>Error</code> to be used both as
factory method and to perform constructor instance initialisation.</p>
<p>The <code>Error</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>Error</code> behaviour should include a <code>super</code> call to the <code>Error</code> constructor to initialize
subclass instances.</p>
</div>
<section id="sec-error-message">
<h1><span class="secnum" id="sec-19.5.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-message" title="link to this section">19.5.1.1</a></span>
Error ( message )</h1>
<p>When the <code>Error</code> function is called with argument <i>message</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>func</i> be this <code>Error</code> function object.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> does not have an
[[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has an [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[ErrorData]] is not
<b>undefined</b>, then
<ol class="block">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>func</i>,
<code>"%ErrorPrototype%"</code>,<br>( [[ErrorData]]) ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>)
is Object.</li>
<li>Set the value of <i>O’s</i> [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to any value other than <b>undefined</b>.</li>
<li>If <i>message</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>msg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>message</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>msg</i>).</li>
<li>Let <i>msgDesc</i> be the PropertyDescriptor{[[Value]]: <i>msg</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>false</b>, [[Configurable]]: <b>true</b>}.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O</i>,
"<code>message</code>", <i>msgDesc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-new-error-argumentslist">
<h1><span class="secnum" id="sec-19.5.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-error-argumentslist" title="link to this section">19.5.1.2</a></span> new Error ( ...argumentsList )</h1>
<p>When <code>Error</code> called as part of a new expression with argument list <i>argumentsList</i> it performs the
following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Error</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Error</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-error-constructor">
<div class="front">
<h1><span class="secnum" id="sec-19.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-error-constructor" title="link to this section">19.5.2</a></span> Properties of the Error Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Error
constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), the Error constructor has the following
properties:</p>
</div>
<section id="sec-error.prototype">
<h1><span class="secnum" id="sec-19.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype" title="link to this section">19.5.2.1</a></span>
Error.prototype</h1>
<p>The initial value of <code>Error.prototype</code> is the Error prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-error-prototype-object">19.5.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-error-@@create">
<h1><span class="secnum" id="sec-19.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-@@create" title="link to this section">19.5.2.2</a></span>
Error[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%ErrorPrototype%"</code>, ( [[ErrorData]]) ).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> [[ErrorData]] is initially assigned the value <b>undefined</b> as a flag to indicate
that the instance has not yet been initialized by the Error constructor. This flag value is never directly exposed to
ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-error-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-19.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-error-prototype-object" title="link to this section">19.5.3</a></span> Properties of the Error Prototype Object</h1>
<p>The Error prototype object is an ordinary object. It is not an Error instance and does not have an [[ErrorData] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Error
prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
</div>
<section id="sec-error.prototype.constructor">
<h1><span class="secnum" id="sec-19.5.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.constructor" title="link to this section">19.5.3.1</a></span> Error.prototype.constructor</h1>
<p>The initial value of <code>Error.prototype.constructor</code> is the built-in <code>Error</code> constructor.</p>
</section>
<section id="sec-error.prototype.message">
<h1><span class="secnum" id="sec-19.5.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.message" title="link to this section">19.5.3.2</a></span> Error.prototype.message</h1>
<p>The initial value of <code>Error.prototype.message</code> is the empty String.</p>
</section>
<section id="sec-error.prototype.name">
<h1><span class="secnum" id="sec-19.5.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.name" title="link to this section">19.5.3.3</a></span> Error.prototype.name</h1>
<p>The initial value of <code>Error.prototype.name</code> is <span style="font-family:
monospace">"<b>Error</b>"</span>.</p>
</section>
<section id="sec-error.prototype.tostring">
<h1><span class="secnum" id="sec-19.5.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.tostring" title="link to this section">19.5.3.4</a></span> Error.prototype.toString ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>name</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"name"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>If <i>name</i> is <b>undefined</b>, then let <i>name</i> be <span style="font-family:
monospace">"<b>Error</b>"</span>; else let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li>Let <i>msg</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"message"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>msg</i>).</li>
<li>If <i>msg</i> is <b>undefined</b>, then let <i>msg</i> be the empty String; else let <i>msg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>msg</i>).</li>
<li>If <i>name</i> is the empty String, return <i>msg</i><span style="font-family: monospace">.</span></li>
<li>If <i>msg</i> is the empty String, return <i>name</i><span style="font-family: monospace">.</span></li>
<li>Return the result of concatenating <i>name</i>, <code>":"</code>, a single space character, and <i>msg</i>.</li>
</ol>
</section>
</section>
<section id="sec-properties-of-error-instances">
<h1><span class="secnum" id="sec-19.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-error-instances" title="link to this section">19.5.4</a></span> Properties of Error Instances</h1>
<p>Error instances are ordinary objects that inherit properties from the Error prototype object and have an [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose initial value is <span class="value">undefined</span>. The only specified uses of [[ErrorData]] is to flag whether or not an Error instance has
been initialized by the Error constructor and to identify them as Error objects within <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring">Object.prototype.toString</a></code>.</p>
</section>
<section id="sec-native-error-types-used-in-this-standard">
<div class="front">
<h1><span class="secnum" id="sec-19.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard" title="link to this section">19.5.5</a></span> Native Error Types Used in This Standard</h1>
<p>A new instance of one of the <i>NativeError</i> objects below is thrown when a runtime error is detected. All of these
objects share the same structure, as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror-object-structure">19.5.6</a>.</p>
</div>
<section id="sec-native-error-types-used-in-this-standard-evalerror">
<h1><span class="secnum" id="sec-19.5.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-evalerror" title="link to this section">19.5.5.1</a></span> EvalError</h1>
<p>This exception is not currently used within this specification. This object remains for compatibility with previous
editions of this specification.</p>
</section>
<section id="sec-native-error-types-used-in-this-standard-rangeerror">
<h1><span class="secnum" id="sec-19.5.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-rangeerror" title="link to this section">19.5.5.2</a></span> RangeError</h1>
<p>Indicates a value that is not in the set or range of allowable values. See 15.4.2.2, 15.4.5.1, 15.7.4.2, 15.7.4.5,
15.7.4.6, 15.7.4.7, and 15.9.5.43.</p>
</section>
<section id="sec-native-error-types-used-in-this-standard-referenceerror">
<h1><span class="secnum" id="sec-19.5.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-referenceerror" title="link to this section">19.5.5.3</a></span> ReferenceError</h1>
<p>Indicate that an invalid reference value has been detected. See 8.9.1, 8.9.2, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a>, 10.2.1.1.4, 10.2.1.2.4, and 11.13.1.</p>
</section>
<section id="sec-native-error-types-used-in-this-standard-syntaxerror">
<h1><span class="secnum" id="sec-19.5.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-syntaxerror" title="link to this section">19.5.5.4</a></span> SyntaxError</h1>
<p>Indicates that a parsing error has occurred. See 11.1.5, 11.3.1, 11.3.2, 11.4.1, 11.4.4, 11.4.5, 11.13.1, 11.13.2, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-this-keyword">12.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators-static-semantics-isfunctiondefinition">12.10.1</a>,
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators-static-semantics-early-errors">12.14.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-block">13.1</a>, 15.1.2.1,
15.3.2.1, 15.10.2.2, 15.10.2.5, 15.10.2.9, 15.10.2.15, 15.10.2.19, 15.10.4.1, and 15.12.2.</p>
</section>
<section id="sec-native-error-types-used-in-this-standard-typeerror">
<h1><span class="secnum" id="sec-19.5.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-typeerror" title="link to this section">19.5.5.5</a></span> TypeError</h1>
<p>Indicates the actual type of an operand is different than the expected type. See 8.6.2, 8.9.2, 8.10.5, 8.12.5, 8.12.7,
8.12.8, 8.12.9, 9.9, 9.10, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">10.2.1</a>, 10.2.1.1.3, 10.6, 11.2.2, 11.2.3, 11.4.1, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components">11.8.6</a>, 11.8.7, 11.3.1, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-declarations-and-the-variable-statement">13.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-binding-patterns">13.2.3</a>,
15, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-load-records-and-loadrequest-objects">15.2.3.2</a>, 15.2.3.3, 15.2.3.4, 15.2.3.5, 15.2.3.6, 15.2.3.7,
15.2.3.8, 15.2.3.9, 15.2.3.10, 15.2.3.11, 15.2.3.12, 15.2.3.13, 15.2.3.14, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtolocate">15.2.4.3</a>,
15.3.3.2, 15.3.3.3, 15.3.3.4, 15.3.3.5, 15.3.3.5.2, 15.3.3.5.3, 15.3.4, 15.3.4.3, 15.3.4.4, 15.4.3.3, 15.4.3.11,
15.4.3.16, 15.4.3.17, 15.4.3.18, 15.4.3.19, 15.4.3.20, 15.4.3.21, 15.4.3.22, 15.4.5.1, 15.5.4.2, 15.5.4.3, 15.6.4.2,
15.6.4.3, 15.7.4, 15.7.4.2, 15.7.4.4, 15.9.5, 15.9.5.44, 15.10.4.1, 15.10.6, 15.11.4.4 and 15.12.3.</p>
</section>
<section id="sec-native-error-types-used-in-this-standard-urierror">
<h1><span class="secnum" id="sec-19.5.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard-urierror" title="link to this section">19.5.5.6</a></span> URIError</h1>
<p>Indicates that one of the global URI handling functions was used in a way that is incompatible with its definition. See
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">15.1.3</a>.</p>
</section>
</section>
<section id="sec-nativeerror-object-structure">
<div class="front">
<h1><span class="secnum" id="sec-19.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror-object-structure" title="link to this section">19.5.6</a></span> <i>NativeError</i> Object Structure</h1>
<p>When an ECMAScript implementation detects a runtime error, it throws a new instance of one of the <i>NativeError</i>
objects defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard">19.5.5</a>. Each of these objects has the
structure described below, differing only in the name used as the constructor name instead of <i>NativeError</i>, in the
<b>name</b> property of the prototype object, and in the implementation-defined <code>message</code> property of the
prototype object.</p>
<p>For each error object, references to <i>NativeError</i> in the definition should be replaced with the appropriate error
object name from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-native-error-types-used-in-this-standard">19.5.5</a>.</p>
</div>
<section id="sec-nativeerror-constructors">
<div class="front">
<h1><span class="secnum" id="sec-19.5.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror-constructors" title="link to this section">19.5.6.1</a></span> <i>NativeError</i> Constructors</h1>
<p>When a <i>NativeError</i> constructor is called as a function rather than as a constructor, it creates and
initializes a new object. A call of the object as a function is equivalent to calling it as a constructor with the same
arguments. However, if the <b>this</b> value passed in the call is an Object with an uninitialized [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, it initializes the <b>this</b> value using the
argument value. This permits a <i>NativeError</i> to be used both as factory method and to perform constructor instance
initialisation.</p>
<p>The <i>NativeError</i> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<i>NativeError</i> behaviour should include a <code>super</code> call to the <i>NativeError</i> constructor to
initialize subclass instances.</p>
</div>
<section id="sec-nativeerror">
<h1><span class="secnum" id="sec-19.5.6.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror" title="link to this section">19.5.6.1.1</a></span> NativeError ( message )</h1>
<p>When a <i>NativeError</i> function is called with argument <i>message</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>func</i> be this <i>NativeError</i> function object.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> does not have an
[[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has an [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[ErrorData]] is not
<b>undefined</b>, then
<ol class="block">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>func</i>,
<code>"%<i>NativeError</i>Prototype%"</code>, ( [[ErrorData]]) ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object.</li>
<li>Set the value of <i>O’s</i> [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to any value other than <b>undefined</b>.</li>
<li>If <i>message</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>msg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>message</i>).</li>
<li>Let <i>msgDesc</i> be the PropertyDescriptor{[[Value]]: <i>msg</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>false</b>, [[Configurable]]: <b>true</b>}.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O</i>,
"<code>message</code>", <i>msgDesc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return <i>O</i>.</li>
</ol>
<p>The actual value of the string passed in step 3.a is either <code>"%EvalErrorPrototype%"</code>,
<code>"%RangeErrorPrototype%"</code>, <code>"%ReferenceErrorPrototype%"</code>, <code>"%SyntaxErrorPrototype%"</code>,
<code>"%TypeErrorPrototype%"</code>, or <code>"%URIErrorPrototype%"</code> corresponding to which <i>NativeError</i>
constructor is being defined.</p>
</section>
<section id="sec-new-nativeerror-argumentslist">
<h1><span class="secnum" id="sec-19.5.6.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-nativeerror-argumentslist" title="link to this section">19.5.6.1.2</a></span> new <i>NativeError</i> ( ...argumentsList )</h1>
<p>When a <i>NativeError</i> constructor is called as part of a new expression with argument list <i>argumentsList</i>
it performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be this <i>NativeError</i> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was
invoked by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If a <i>NativeError</i> constructor is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript
function object</a>, its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-nativeerror-constructors">
<div class="front">
<h1><span class="secnum" id="sec-19.5.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-nativeerror-constructors" title="link to this section">19.5.6.2</a></span> Properties of the <i>NativeError</i> Constructors</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of a
<i>NativeError</i> constructor is the Error constructor object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-constructor">19.5.1</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), each <i>NativeError</i> constructor has the
following properties:</p>
</div>
<section id="sec-nativeerror.prototype">
<h1><span class="secnum" id="sec-19.5.6.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror.prototype" title="link to this section">19.5.6.2.1</a></span> NativeError.prototype</h1>
<p>The initial value of <b><i>NativeError</i><span style="font-family: monospace">.prototype</span></b> is a
<i>NativeError</i> prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-nativeerror-prototype-objects">19.5.6.3</a>). Each
<i>NativeError</i> constructor has a separate prototype object.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-nativeerror-@@create">
<h1><span class="secnum" id="sec-19.5.6.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror-@@create" title="link to this section">19.5.6.2.2</a></span> <i>NativeError</i> [ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<i>NativeErrorPrototype</i>, ([[ErrorData]]) ).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The actual value passed as <span class="nt">NativeErrorPrototype</span> in step 2 is either
<code>"%EvalErrorPrototype%"</code>, <code>"%RangeErrorPrototype%"</code>, <code>"%ReferenceErrorPrototype%"</code>,
<code>"%SyntaxErrorPrototype%"</code>, <code>"%TypeErrorPrototype%"</code>, or <code>"%URIErrorPrototype%"</code>
corresponding to which <i>NativeError</i> constructor is being defined.</p>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> [[ErrorData]] is initially assigned the value <b>undefined</b> as a flag to indicate
that the instance has not yet been initialized by the <i>NativeError</i> constructor. This flag value is never
directly exposed to ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-nativeerror-prototype-objects">
<div class="front">
<h1><span class="secnum" id="sec-19.5.6.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-nativeerror-prototype-objects" title="link to this section">19.5.6.3</a></span> Properties of the <i>NativeError</i> Prototype Objects</h1>
<p>Each <i>NativeError</i> prototype object is an ordinary object. It is not an Error instance and does not have an
[[ErrorData] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of each
<i>NativeError</i> prototype object is the standard built-in Error prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-error-prototype-object">19.5.3</a>).</p>
</div>
<section id="sec-nativeerror.prototype.constructor">
<h1><span class="secnum" id="sec-19.5.6.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror.prototype.constructor" title="link to this section">19.5.6.3.1</a></span> <i>NativeError</i>.prototype.constructor</h1>
<p>The initial value of the <code>constructor</code> property of the prototype for a given <i>NativeError</i>
constructor is the <i>NativeError</i> constructor function itself (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror-constructors">19.5.6.1</a>).</p>
</section>
<section id="sec-nativeerror.prototype.message">
<h1><span class="secnum" id="sec-19.5.6.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror.prototype.message" title="link to this section">19.5.6.3.2</a></span> <i>NativeError</i>.prototype.message</h1>
<p>The initial value of the <code>message</code> property of the prototype for a given <i>NativeError</i> constructor is
the empty String.</p>
</section>
<section id="sec-nativeerror.prototype.name">
<h1><span class="secnum" id="sec-19.5.6.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nativeerror.prototype.name" title="link to this section">19.5.6.3.3</a></span> <i>NativeError</i>.prototype.name</h1>
<p>The initial value of the <code>name</code> property of the prototype for a given <i>NativeError</i> constructor is a
string consisting of the name of the constructor (the name used instead of <i>NativeError</i>).</p>
</section>
</section>
<section id="sec-properties-of-nativeerror-instances">
<h1><span class="secnum" id="sec-19.5.6.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-nativeerror-instances" title="link to this section">19.5.6.4</a></span> Properties of <i>NativeError</i> Instances</h1>
<p><i>NativeError</i> instances are ordinary objects that inherit properties from their <i>NativeError</i> prototype
object and have an [[ErrorData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose initial
value is <span class="value">undefined</span>. The only specified use of [[ErrorData]] is to flag whether or not an Error
or <i>NativeError</i> instance has been initialized by its constructor.</p>
</section>
</section>
</section>
</section>
<section id="sec-numbers-and-dates">
<div class="front">
<h1><span class="secnum" id="sec-20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-numbers-and-dates" title="link to this section">20</a></span> Numbers and
Dates</h1>
</div>
<section id="sec-number-objects">
<div class="front">
<h1><span class="secnum" id="sec-20.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-objects" title="link to this section">20.1</a></span> Number
Objects</h1>
</div>
<section id="sec-number-constructor">
<div class="front">
<h1><span class="secnum" id="sec-20.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-constructor" title="link to this section">20.1.1</a></span>
The Number Constructor</h1>
<p>The Number constructor is the %Number% intrinsic object and the initial value of the <code>Number</code> property of
the global object. When <code>Number</code> is called as a function rather than as a constructor, it performs a type
conversion. However, if the <b>this</b> value passed in the call is an Object with an uninitialized [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, it initializes the <b>this</b> value using the
argument value. This permits <code>Number</code> to be used both to perform type conversion and to perform constructor
instance initialisation.</p>
<p>The <code>Number</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>Number</code> behaviour must include a <code>super</code> call to the <code>Number</code> constructor to initialize
the [[NumberData]] state of subclass instances.</p>
</div>
<section id="sec-number-constructor-number-value">
<h1><span class="secnum" id="sec-20.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-constructor-number-value" title="link to this section">20.1.1.1</a></span> Number ( [ value ] )</h1>
<p>When <code>Number</code> is called with argument <var>number</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If no arguments were passed to this function invocation, then let <i>n</i> be +0.</li>
<li>Else, let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[NumberData]] is
<b>undefined</b>, then
<ol class="block">
<li>Set the value of <i>O’s</i> [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>n</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</li>
<li>Return <i>n</i>.</li>
</ol>
</section>
<section id="sec-new-number-argumentslist">
<h1><span class="secnum" id="sec-20.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-number-argumentslist" title="link to this section">20.1.1.2</a></span> new Number ( ...argumentsList )</h1>
<p>When <code>Number</code> is called as part of a new expression with argument list <i>argumentsList</i>it performs the
following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Number</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Number</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-number-constructor">
<div class="front">
<h1><span class="secnum" id="sec-20.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-number-constructor" title="link to this section">20.1.2</a></span> Properties of the Number Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Number constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), the Number constructor has the following
properties:</p>
</div>
<section id="sec-number.epsilon">
<h1><span class="secnum" id="sec-20.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.epsilon" title="link to this section">20.1.2.1</a></span>
Number.EPSILON</h1>
<p>The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as
a Number value, which is approximately 2.2204460492503130808472633361816 x 10‍<sup>−‍16</sup>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.isfinite">
<h1><span class="secnum" id="sec-20.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite" title="link to this section">20.1.2.2</a></span>
Number.isFinite ( number )</h1>
<p>When the <code>Number.isFinite</code> is called with one argument <var>number</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>number</i>) is not Number, return <b>false</b>.</li>
<li>If <i>number</i> is <b>NaN</b>, <b>+∞</b>, or <b>−∞</b>, return <b>false</b>.</li>
<li>Otherwise, return <b>true</b>.</li>
</ol>
</section>
<section id="sec-number.isinteger">
<h1><span class="secnum" id="sec-20.1.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isinteger" title="link to this section">20.1.2.3</a></span> Number.isInteger ( number )</h1>
<p>When the <code>Number.isInteger</code> is called with one argument <var>number</var>, the following steps are
taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>number</i>) is not Number, return <b>false</b>.</li>
<li>If <i>number</i> is <b>NaN</b>, <b>+∞</b>, or <b>−∞</b>, return <b>false</b>.</li>
<li>Let <i>integer</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>number</i>).</li>
<li>If <i>integer</i> is not equal to <i>number</i>, return <b>false</b>.</li>
<li>Otherwise, return <b>true</b>.</li>
</ol>
</section>
<section id="sec-number.isnan">
<h1><span class="secnum" id="sec-20.1.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isnan" title="link to this section">20.1.2.4</a></span>
Number.isNaN ( number )</h1>
<p>When the <code>Number.isNaN</code> is called with one argument <var>number</var>, the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>number</i>) is not Number, return <b>false</b>.</li>
<li>If <i>number</i> is <b>NaN</b>, return <b>true</b>.</li>
<li>Otherwise, return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This function differs from the global isNaN function (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isnan-number">18.2.3</a>) is that it does not convert its argument to a Number before determining whether it
is NaN.</p>
</div>
</section>
<section id="sec-number.issafeinteger">
<h1><span class="secnum" id="sec-20.1.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.issafeinteger" title="link to this section">20.1.2.5</a></span> Number.isSafeInteger ( number )</h1>
<p>When the <code>Number.isSafeInteger</code> is called with one argument <var>number</var>, the following steps are
taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>number</i>) is not Number, return <b>false</b>.</li>
<li>If <i>number</i> is <b>NaN</b>, <b>+∞</b>, or <b>−∞</b>, return <b>false</b>.</li>
<li>Let <i>integer</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>number</i>).</li>
<li>If <i>integer</i> is not equal to <i>number</i>, return <b>false</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>integer</i>) ≤ 2<sup>53</sup>−1, then return
<b>true</b>.</li>
<li>Otherwise, return <b>false</b>.</li>
</ol>
</section>
<section id="sec-number.max_safe_integer">
<h1><span class="secnum" id="sec-20.1.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer" title="link to this section">20.1.2.6</a></span> Number.MAX_SAFE_INTEGER</h1>
<p>The value of Number.MAX_SAFE_INTEGER is 9007199254740991 (2<sup>53</sup>−1).</p>
<p><br>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.max_value">
<h1><span class="secnum" id="sec-20.1.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_value" title="link to this section">20.1.2.7</a></span> Number.MAX_VALUE</h1>
<p>The value of <code>Number.MAX_VALUE</code> is the largest positive finite value of the Number type, which is
approximately <span style="font-family: Times New Roman">1.7976931348623157&nbsp;×&nbsp;10<sup>308</sup></span>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.nan">
<h1><span class="secnum" id="sec-20.1.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.nan" title="link to this section">20.1.2.8</a></span>
Number.NaN</h1>
<p>The value of <code>Number.NaN</code> is <b>NaN</b>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.negative_infinity">
<h1><span class="secnum" id="sec-20.1.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.negative_infinity" title="link to this section">20.1.2.9</a></span> Number.NEGATIVE_INFINITY</h1>
<p>The value of Number.NEGATIVE_INFINITY is −∞.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.min_safe_integer">
<h1><span class="secnum" id="sec-20.1.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.min_safe_integer" title="link to this section">20.1.2.10</a></span> Number.MIN_SAFE_INTEGER</h1>
<p>The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2<sup>53</sup>−1)).</p>
<p><br>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.min_value">
<h1><span class="secnum" id="sec-20.1.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.min_value" title="link to this section">20.1.2.11</a></span> Number.MIN_VALUE</h1>
<p>The value of <code>Number.MIN_VALUE</code> is the smallest positive value of the Number type, which is approximately
<span style="font-family: Times New Roman">5&nbsp;×&nbsp;10<sup>−324</sup></span>.</p>
<p>In the IEEE-764 double precision binary representation, the smallest possible value is a denormalized number. If an
implementation does not support denormalized values, the value of <code>Number.MIN_VALUE</code> must be the smallest
non-zero positive value that can actually be represented by the implementation.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.parsefloat">
<h1><span class="secnum" id="sec-20.1.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.parsefloat" title="link to this section">20.1.2.12</a></span> Number.parseFloat ( string )</h1>
<p>The value of the <code>Number.parseFloat</code> data property is the same built-in function object that is the value of
the <code>parseFloat</code> property of the global object defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-parsefloat-string">18.2.4</a>.</p>
</section>
<section id="sec-number.parseint">
<h1><span class="secnum" id="sec-20.1.2.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.parseint" title="link to this section">20.1.2.13</a></span> Number.parseInt ( string, radix )</h1>
<p>The value of the <code>Number.parseInt</code> data property is the same built-in function object that is the value of
the <code>parseInt</code> property of the global object defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-parseint-string-radix">18.2.5</a>.</p>
</section>
<section id="sec-number.positive_infinity">
<h1><span class="secnum" id="sec-20.1.2.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.positive_infinity" title="link to this section">20.1.2.14</a></span> Number.POSITIVE_INFINITY</h1>
<p>The value of Number.POSITIVE_INFINITY is +∞.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number.prototype">
<h1><span class="secnum" id="sec-20.1.2.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype" title="link to this section">20.1.2.15</a></span> Number.prototype</h1>
<p>The initial value of <code>Number.prototype</code> is the Number prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-number-prototype-object">20.1.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-number-@@create">
<h1><span class="secnum" id="sec-20.1.2.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number-@@create" title="link to this section">20.1.2.16</a></span> Number[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%NumberPrototype%"</code>, ( [[NumberData]])).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> [[NumberData]] is initially assigned the value <b>undefined</b> as a flag to indicate
that the instance has not yet been initialized by the Number constructor. This flag value is never directly exposed to
ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-number-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-20.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-number-prototype-object" title="link to this section">20.1.3</a></span> Properties of the Number Prototype Object</h1>
<p>The Number prototype object is an ordinary object. It is not a Number instance and does not have a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Number prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>Unless explicitly stated otherwise, the methods of the Number prototype object defined below are not generic and the
<b>this</b> value passed to them must be either a Number value or an object that has a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> that has been initialized to a Number value.</p>
<p>The abstract operation <span style="font-family: Times New Roman">thisNumberValue(<i>value</i>)</span> performs the
following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Number, return <i>value</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value)</i> is Object and <i>value</i> has a
[[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>n</i> be the value of <i>value’s</i> [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>n</i> is not <b>undefined</b>, then return <i>n</i>.</li>
</ol>
</li>
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<p>The phrase “this Number value” within the specification of a method refers to the result returned by
calling the abstract operation <span style="font-family: Times New Roman">thisNumberValue</span> with the <b>this</b>
value of the method invocation passed as the argument.</p>
</div>
<section id="sec-number.prototype.constructor">
<h1><span class="secnum" id="sec-20.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.constructor" title="link to this section">20.1.3.1</a></span> Number.prototype.constructor</h1>
<p>The initial value of <code>Number.prototype.constructor</code> is the built-in <code>Number</code> constructor.</p>
</section>
<section id="sec-number.prototype.toexponential">
<h1><span class="secnum" id="sec-20.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.toexponential" title="link to this section">20.1.3.2</a></span> Number.prototype.toExponential ( fractionDigits )</h1>
<p>Return a String containing this Number value represented in decimal exponential notation with one digit before the
significand's decimal point and <var>fractionDigits</var> digits after the significand's decimal point. If
<var>fractionDigits</var> is <b>undefined</b>, include as many significand digits as necessary to uniquely specify the
Number (just like in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a> except that in this case the Number is always output in
exponential notation). Specifically, perform the following steps:</p>
<ol class="proc">
<li>Let <i>x</i> be thisNumberValue(<b>this</b> value).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li>Let <i>f</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>fractionDigits</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>f</i> is 0, when <i>fractionDigits</i> is <b>undefined</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>f</i>).</li>
<li>If <i>x</i> is <b>NaN</b>, return the String <code>"NaN"</code>.</li>
<li>Let <i>s</i> be the empty String.</li>
<li>If <i>x</i> <i>&lt;</i> 0, then
<ol class="block">
<li>Let <i>s</i> be <code>"-"</code>.</li>
<li>Let <i>x</i> = –<i>x</i>.</li>
</ol>
</li>
<li>If <i>x</i> = +∞, then
<ol class="block">
<li>Return the concatenation of the Strings <i>s</i> and <code>"Infinity"</code>.</li>
</ol>
</li>
<li>If <i>f</i> &lt; 0 or <i>f</i> &gt; 20, throw a <b>RangeError</b> exception.</li>
<li>If <i>x</i> = 0, then
<ol class="block">
<li>Let <i>m</i> be the String consisting of <i>f</i>+1 occurrences of the code unit 0x0030.</li>
<li>Let <i>e</i> = 0.</li>
</ol>
</li>
<li>Else <i>x</i> ≠ 0,
<ol class="block">
<li>If <i>fractionDigits</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>e</i> and <i>n</i> be integers such that 10<sup><i>f</i></sup> ≤ <i>n</i> &lt;
10<sup><i>f</i>+1</sup> and for which the exact mathematical value of <i>n</i> ×
10<sup><i>e</i>–<i>f</i></sup> – <i>x</i> is as close to zero as possible. If there are two such
sets of <i>e</i> and <i>n</i>, pick the <i>e</i> and <i>n</i> for which <i>n</i> ×
10<sup><i>e</i>–<i>f</i></sup> is larger.</li>
</ol>
</li>
<li>Else <i>fractionDigits</i> is <b>undefined</b>,
<ol class="block">
<li>Let <i>e</i>, <i>n</i>, and <i>f</i> be integers such that <i>f</i> ≥ 0, 10<sup><i>f</i></sup> ≤
<i>n</i> &lt; 10<sup><i>f</i>+1</sup>, the number value for n × 10<sup><i>e</i>–<i>f</i></sup>
is <i>x</i>, and <i>f</i> is as small as possible. Note that the decimal representation of <i>n</i> has
<i>f</i>+1 digits, <i>n</i> is not divisible by 10, and the least significant digit of <i>n</i> is not
necessarily uniquely determined by these criteria.</li>
</ol>
</li>
<li>Let <i>m</i> be the String consisting of the digits of the decimal representation of <i>n</i> (in order, with no
leading zeroes).</li>
</ol>
</li>
<li>If <i>f</i> ≠ 0, then
<ol class="block">
<li>Let <i>a</i> be the first element of <i>m</i>, and let <i>b</i> be the remaining <i>f</i> elements of
<i>m</i>.</li>
<li>Let <i>m</i> be the concatenation of the three Strings <i>a</i>, <code>"."</code>, and <i>b</i>.</li>
</ol>
</li>
<li>If <i>e</i> = 0, then
<ol class="block">
<li>Let <i>c</i> = <code>"+".</code></li>
<li>Let <i>d</i> = <code>"0".</code></li>
</ol>
</li>
<li>Else
<ol class="block">
<li>If <i>e</i> &gt; 0, then let <i>c</i> = <code>"+".</code></li>
<li>Else <i>e</i> ≤ 0,
<ol class="block">
<li>Let <i>c</i> = <code>"-"</code>.</li>
<li>Let <i>e</i> = –<i>e</i>.</li>
</ol>
</li>
<li>Let <i>d</i> be the String consisting of the digits of the decimal representation of <i>e</i> (in order, with no
leading zeroes).</li>
</ol>
</li>
<li>Let <i>m</i> be the concatenation of the four Strings <i>m</i>, <code>"e"</code>, <i>c</i>, and <i>d</i>.</li>
<li>Return the concatenation of the Strings <i>s</i> and <i>m</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>toExponential</code> method is <b>1</b>.</p>
<p>If the <code>toExponential</code> method is called with more than one argument, then the behaviour is undefined (see <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects">clause 17</a>).</p>
<p>An implementation is permitted to extend the behaviour of <code>toExponential</code> for values of
<var>fractionDigits</var> less than 0 or greater than 20. In this case <code>toExponential</code> would not necessarily
throw <b>RangeError</b> for such values.</p>
<div class="note">
<p><span class="nh">NOTE</span> For implementations that provide more accurate conversions than required by the rules
above, it is recommended that the following alternative version of step 12.b.i be used as a guideline:</p>
<ol class="proc">
<li>Let <i>e</i>, <i>n</i>, and <i>f</i> be integers such that <i>f</i> ≥ 0, 10<sup><i>f</i></sup> ≤ n &lt;
10<sup><i>f</i>+1</sup>, the number value for n × 10<sup><i>e</i>–<i>f</i></sup> is x, and <i>f</i> is
as small as possible. If there are multiple possibilities for <i>n</i>, choose the value of <i>n</i> for which
<i>n</i> × 10<sup><i>e</i>–<i>f</i></sup> is closest in value to <i>x</i>. If there are two such
possible values of <i>n</i>, choose the one that is even.</li>
</ol>
</div>
</section>
<section id="sec-number.prototype.tofixed">
<h1><span class="secnum" id="sec-20.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.tofixed" title="link to this section">20.1.3.3</a></span> Number.prototype.toFixed ( fractionDigits )</h1>
<div class="note">
<p><span class="nh">Note</span> <b>toFixed</b> returns a String containing this Number value represented in decimal
fixed-point notation with <i>fractionDigits</i> digits after the decimal point. If <i>fractionDigits</i> is
<b>undefined</b>, 0 is assumed.</p>
</div>
<p>The following steps are performed:</p>
<ol class="proc">
<li>Let <i>x</i> be thisNumberValue(<b>this</b> value).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li>Let <i>f</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>fractionDigits</i>). (If <i>fractionDigits</i> is
<b>undefined</b>, this step produces the value <code>0</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>f</i>).</li>
<li>If <i>f</i> &lt; 0 or <i>f</i> &gt; 20, throw a <b>RangeError</b> exception.</li>
<li>If <i>x</i> is <b>NaN</b>, return the String <code>"NaN"</code>.</li>
<li>Let <i>s</i> be the empty String.</li>
<li>If <i>x</i> &lt; 0, then
<ol class="block">
<li>Let <i>s</i> be "<code>-</code>".</li>
<li>Let <i>x</i> = –<i>x</i>.</li>
</ol>
</li>
<li>If <i>x</i> ≥ 10<sup>21</sup>, then
<ol class="block">
<li>Let <i>m</i> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>x</i>).</li>
</ol>
</li>
<li>Else <i>x</i> &lt; 10<sup>21</sup>,
<ol class="block">
<li>Let <i>n</i> be an integer for which the exact mathematical value of <i>n</i> ÷ 10<sup>f</sup> –
<i>x</i> is as close to zero as possible. If there are two such <i>n</i>, pick the larger <i>n</i>.</li>
<li>If <i>n</i> = 0, let <i>m</i> be the String <code>"0"</code>. Otherwise, let <i>m</i> be the String consisting
of the digits of the decimal representation of <i>n</i> (in order, with no leading zeroes).</li>
<li>If <i>f</i> ≠ 0, then
<ol class="block">
<li>Let <i>k</i> be the number of elements in <i>m</i>.</li>
<li>If <i>k</i> ≤ <i>f</i>, then
<ol class="block">
<li>Let <i>z</i> be the String consisting of <i>f</i>+1–<i>k</i> occurrences of the code unit
0x0030.</li>
<li>Let <i>m</i> be the concatenation of Strings <i>z</i> and <i>m</i>.</li>
<li>Let <i>k</i> = <i>f</i> + 1.</li>
</ol>
</li>
<li>Let <i>a</i> be the first <i>k</i>–<i>f</i> elements of <i>m</i>, and let <i>b</i> be the remaining
<i>f</i> elements of <i>m</i>.</li>
<li>Let <i>m</i> be the concatenation of the three Strings <i>a</i>, <code>"."</code>, and <i>b</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Return the concatenation of the Strings <i>s</i> and <i>m</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>toFixed</code> method is <b>1</b>.</p>
<p>If the <code>toFixed</code> method is called with more than one argument, then the behaviour is undefined (see <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects">clause&nbsp;17</a>).</p>
<p>An implementation is permitted to extend the behaviour of <code>toFixed</code> for values of <var>fractionDigits</var>
less than 0 or greater than 20. In this case <code>toFixed</code> would not necessarily throw <b>RangeError</b> for such
values.</p>
<div class="note">
<p><span class="nh">NOTE</span> The output of <code>toFixed</code> may be more precise than <code>toString</code> for
some values because toString only prints enough significant digits to distinguish the number from adjacent number
values. For example,</p>
<p>(<code>1000000000000000128).toString()</code> returns <code>"1000000000000000100"</code>,<br>while
(<code>1000000000000000128).toFixed(0)</code> returns <code>"1000000000000000128"</code>.</p>
</div>
</section>
<section id="sec-number.prototype.tolocalestring">
<h1><span class="secnum" id="sec-20.1.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.tolocalestring" title="link to this section">20.1.3.4</a></span> Number.prototype.toLocaleString( [ reserved1 [ ., reserved2 ] ])</h1>
<p>An ECMAScript implementation that includes the ECMA-402 International API must implement the
<code>Number.prototype.toLocaleString</code> method as specified in the ECMA-402 specification. If an ECMAScript
implementation does not include the ECMA-402 API the following specification of the <code>toLocaleString</code> method is
used.</p>
<p>Produces a String value that represents this Number value formatted according to the conventions of the host
environment’s current locale. This function is implementation-dependent, and it is permissible, but not encouraged,
for it to return the same thing as <code>toString</code>.</p>
<p>The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that
do not include ECMA-402 support must not use those parameter position for anything else.</p>
<p>The <code>length</code> property of the <code>toLocaleString</code> method is <b>0</b>.</p>
</section>
<section id="sec-number.prototype.toprecision">
<h1><span class="secnum" id="sec-20.1.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.toprecision" title="link to this section">20.1.3.5</a></span> Number.prototype.toPrecision ( precision )</h1>
<p>Return a String containing this Number value represented either in decimal exponential notation with one digit before
the significand's decimal point and <span style="font-family: Times New Roman"><i>precision</i>–1</span> digits
after the significand's decimal point or in decimal fixed notation with <var>precision</var> significant digits. If
<var>precision</var> is <b>undefined</b>, call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8">7.1.9</a>)
instead. Specifically, perform the following steps:</p>
<ol class="proc">
<li>Let <i>x</i> be thisNumberValue(<b>this</b> value).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li>If <i>precision</i> is <b>undefined</b>, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>x</i>).</li>
<li>Let <i>p</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>precision</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>p</i>).</li>
<li>If <i>x</i> is <b>NaN</b>, return the String <code>"NaN"</code>.</li>
<li>Let <i>s</i> be the empty String.</li>
<li>If <i>x</i> &lt; 0, then
<ol class="block">
<li>Let <i>s</i> be <code>"-"</code>.</li>
<li>Let <i>x</i> = –<i>x</i>.</li>
</ol>
</li>
<li>If <i>x</i> = +∞, then
<ol class="block">
<li>Return the concatenation of the Strings <i>s</i> and <code>"Infinity"</code>.</li>
</ol>
</li>
<li>If <i>p</i> &lt; 1 or <i>p</i> &gt; 21, throw a <b>RangeError</b> exception.</li>
<li>If <i>x</i> = 0, then
<ol class="block">
<li>Let <i>m</i> be the String consisting of <i>p</i> occurrences of the code unit 0x0030 (the Unicode character
‘<span style="font-family: monospace">0</span>’).</li>
<li>Let <i>e</i> = 0.</li>
</ol>
</li>
<li>Else <i>x</i> ≠ 0,
<ol class="block">
<li>Let <i>e</i> and <i>n</i> be integers such that 10<sup><i>p</i>–1</sup> ≤ <i>n</i> &lt;
10<sup><i>p</i></sup> and for which the exact mathematical value of <i>n</i> ×
10<sup><i>e</i>–<i>p</i>+1</sup> – <i>x</i> is as close to zero as possible. If there are two such
sets of <i>e</i> and <i>n</i>, pick the <i>e</i> and <i>n</i> for which <i>n</i> ×
10<sup><i>e</i>–<i>p</i>+1</sup> is larger.</li>
<li>Let <i>m</i> be the String consisting of the digits of the decimal representation of <i>n</i> (in order, with no
leading zeroes).</li>
<li>If <i>e</i> &lt; –6 or <i>e</i> ≥ <i>p</i>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>e</i> ≠ 0</li>
<li>Let <i>a</i> be the first element of <i>m</i>, and let <i>b</i> be the remaining <i>p</i>–1 elements
of <i>m</i>.</li>
<li>Let <i>m</i> be the concatenation of the three Strings <i>a</i>, <code>"."</code>, and <i>b</i>.</li>
<li>If <i>e</i> &gt; 0, then
<ol class="block">
<li>Let <i>c</i> = <code>"+"</code>.</li>
</ol>
</li>
<li>Else <i>e</i> &lt; 0,
<ol class="block">
<li>Let <i>c</i> = <code>"-"</code>.</li>
<li>Let <i>e</i> = –<i>e</i>.</li>
</ol>
</li>
<li>Let <i>d</i> be the String consisting of the digits of the decimal representation of <i>e</i> (in order,
with no leading zeroes).</li>
<li>Return the concatenation of the five Strings <i>s</i>, <i>m</i>, <code>"e"</code>, <i>c</i>, and
<i>d</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>e</i> = <i>p</i>–1, then return the concatenation of the Strings <i>s</i> and <i>m</i>.</li>
<li>If <i>e</i> ≥ 0, then
<ol class="block">
<li>Let <i>m</i> be the concatenation of the first <i>e</i>+1 elements of <i>m</i>, the code unit 0x002E (Unicode
character ‘<span style="font-family: monospace">.</span>’), and the remaining <i>p</i>–
(<i>e</i>+1) elements of <i>m</i>.</li>
</ol>
</li>
<li>Else <i>e</i> &lt; 0,
<ol class="block">
<li>Let <i>m</i> be the concatenation of the String <code>"0."</code>, –(<i>e</i>+1) occurrences of code unit
0x0030 (the Unicode character ‘<code>0</code>’), and the String <i>m</i>.</li>
</ol>
</li>
<li>Return the concatenation of the Strings <i>s</i> and <i>m</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>toPrecision</code> method is <b>1</b>.</p>
<p>If the <code>toPrecision</code> method is called with more than one argument, then the behaviour is undefined (see <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects">clause 17</a>).</p>
<p>An implementation is permitted to extend the behaviour of <code>toPrecision</code> for values of <var>precision</var>
less than 1 or greater than 21. In this case <code>toPrecision</code> would not necessarily throw <b>RangeError</b> for
such values.</p>
</section>
<section id="sec-number.prototype.tostring">
<h1><span class="secnum" id="sec-20.1.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.tostring" title="link to this section">20.1.3.6</a></span> Number.prototype.toString ( [ radix ] )</h1>
<p>The optional <var>radix</var> should be an integer value in the inclusive range <span style="font-family: Times New
Roman">2</span> to <span style="font-family: Times New Roman">36</span>. If <var>radix</var> not present or is
<b>undefined</b> the Number <span style="font-family: Times New Roman">10</span> is used as the value of <var>radix</var>.
If <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>radix</i>)</span> is the Number
<span style="font-family: Times New Roman">10</span> then this Number value is given as an argument to the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a> abstract operation; the resulting String value is returned.</p>
<p>If <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>radix</i>)</span> is not an
integer between 2 and 36 inclusive throw a <b>RangeError</b> exception. If <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>radix</i>)</span> is an integer from 2 to 36, but not 10, the result is a String
representation of this Number value using the specified radix. Letters <code>a</code>-<code>z</code> are used for digits
with values 10 through 35. The precise algorithm is implementation-dependent if the radix is not 10, however the algorithm
should be a generalisation of that specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring-applied-to-the-number-type">7.1.12.1</a>.</p>
<p>The <code>toString</code> function is not generic; it throws a <b>TypeError</b> exception if its <b>this</b> value is
not a Number or a Number object. Therefore, it cannot be transferred to other kinds of objects for use as a method.</p>
</section>
<section id="sec-number.prototype.valueof">
<h1><span class="secnum" id="sec-20.1.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.prototype.valueof" title="link to this section">20.1.3.7</a></span> Number.prototype.valueOf ( )</h1>
<ol class="proc">
<li>Let <i>x</i> be thisNumberValue(<b>this</b> value).</li>
<li>Return <i>x</i>.</li>
</ol>
</section>
</section>
<section id="sec-properties-of-number-instances">
<h1><span class="secnum" id="sec-20.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-number-instances" title="link to this section">20.1.4</a></span> Properties of Number Instances</h1>
<p>Number instances are ordinary objects that inherit properties from the Number prototype object. Number instances also
have a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. The [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the Number value represented by this Number
object.</p>
</section>
</section>
<section id="sec-math-object">
<div class="front">
<h1><span class="secnum" id="sec-20.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math-object" title="link to this section">20.2</a></span> The Math
Object</h1>
<p>The Math object is a single ordinary object.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Math
object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>The Math is not a function object. It does not have a [[Construct]] internal method; it is not possible to use the Math
object as a constructor with the <code>new</code> operator. The Math object also does not have a [[Call]] internal method;
it is not possible to invoke the Math object as a function.</p>
<div class="note">
<p><span class="nh">NOTE</span> In this specification, the phrase “the Number value for <i>x</i>” has a
technical meaning defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">6.1.6</a>.</p>
</div>
</div>
<section id="sec-value-properties-of-the-math-object">
<div class="front">
<h1><span class="secnum" id="sec-20.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-value-properties-of-the-math-object" title="link to this section">20.2.1</a></span> Value Properties of the Math Object</h1>
</div>
<section id="sec-math.e">
<h1><span class="secnum" id="sec-20.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.e" title="link to this section">20.2.1.1</a></span>
Math.E</h1>
<p>The Number value for <var>e</var>, the base of the natural logarithms, which is approximately
2.7182818284590452354.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-math.ln10">
<h1><span class="secnum" id="sec-20.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.ln10" title="link to this section">20.2.1.2</a></span>
Math.LN10</h1>
<p>The Number value for the natural logarithm of 10, which is approximately 2.302585092994046.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-math.log10e">
<h1><span class="secnum" id="sec-20.2.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log10e" title="link to this section">20.2.1.3</a></span>
Math.LOG10E</h1>
<p>The Number value for the base-<span style="font-family: Times New Roman">10</span> logarithm of <var>e</var>, the base
of the natural logarithms; this value is approximately <span style="font-family: Times New
Roman">0.4342944819032518</span>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The value of <code>Math.LOG10E</code> is approximately the reciprocal of the value of
<code>Math.LN10</code>.</p>
</div>
</section>
<section id="sec-math.ln2">
<h1><span class="secnum" id="sec-20.2.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.ln2" title="link to this section">20.2.1.4</a></span>
Math.LN2</h1>
<p>The Number value for the natural logarithm of 2, which is approximately 0.6931471805599453.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-math.log2e">
<h1><span class="secnum" id="sec-20.2.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log2e" title="link to this section">20.2.1.5</a></span>
Math.LOG2E</h1>
<p>The Number value for the base-<span style="font-family: Times New Roman">2</span> logarithm of <var>e</var>, the base
of the natural logarithms; this value is approximately <span style="font-family: Times New
Roman">1.4426950408889634</span>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The value of <code>Math.LOG2E</code> is approximately the reciprocal of the value of
<code>Math.LN2</code>.</p>
</div>
</section>
<section id="sec-math.pi">
<h1><span class="secnum" id="sec-20.2.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.pi" title="link to this section">20.2.1.6</a></span>
Math.PI</h1>
<p>The Number value for <span style="font-family: Times New Roman">π</span>, the ratio of the circumference of a circle
to its diameter, which is approximately <span style="font-family: Times New Roman">3.1415926535897932</span>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-math.sqrt1_2">
<h1><span class="secnum" id="sec-20.2.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sqrt1_2" title="link to this section">20.2.1.7</a></span>
Math.SQRT1_2</h1>
<p>The Number value for the square root of <span style="font-family: Times New Roman">½</span>, which is
approximately <span style="font-family: Times New Roman">0.7071067811865476</span>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The value of <code>Math.SQRT1_2</code> is approximately the reciprocal of the value of
<code>Math.SQRT2</code>.</p>
</div>
</section>
<section id="sec-math.sqrt2">
<h1><span class="secnum" id="sec-20.2.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sqrt2" title="link to this section">20.2.1.8</a></span>
Math.SQRT2</h1>
<p>The Number value for the square root of <span style="font-family: Times New Roman">2</span>, which is approximately
<span style="font-family: Times New Roman">1.4142135623730951</span>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-math-@@tostringtag">
<h1><span class="secnum" id="sec-20.2.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math-@@tostringtag" title="link to this section">20.2.1.9</a></span> Math [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">Math</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-function-properties-of-the-math-object">
<div class="front">
<h1><span class="secnum" id="sec-20.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-properties-of-the-math-object" title="link to this section">20.2.2</a></span> Function Properties of the Math Object</h1>
<p>Each of the following <code>Math</code> object functions applies the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a> abstract
operation to each of its arguments (in left-to-right order if there is more than one). If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a> returns an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>,
that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> is immediately returned. Otherwise, the
function performs a computation on the resulting Number value(s). The value returned by each function is a Number.</p>
<p>In the function descriptions below, the symbols NaN, −0, +0, −∞ and +∞ refer to the Number
values described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-number-type">6.1.6</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The behaviour of the functions <code>acos</code>, <code>acosh</code>, <code>asin</code>,
<code>asinh</code>, <code>atan</code>, <code>atanh</code>, <code>atan2</code>, <code>cbrt</code>, <code>cos</code>,
<code>cosh</code>, <code>exp</code>, <code>hypot</code>, <code>log</code>,<code>log1p</code>, <code>log2</code>,
<code>log10</code>, <code>pow</code>, <code>sin</code>, <code>sinh</code>, <code>sqrt</code>, <code>tan</code>, and
<code>tanh</code> is not precisely specified here except to require specific results for certain argument values that
represent boundary cases of interest. For other argument values, these functions are intended to compute approximations
to the results of familiar mathematical functions, but some latitude is allowed in the choice of approximation
algorithms. The general intent is that an implementer should be able to use the same mathematical library for ECMAScript
on a given hardware platform that is available to C programmers on that platform.</p>
</div>
<p>Although the choice of algorithms is left to the implementation, it is recommended (but not specified by this standard)
that implementations use the approximation algorithms for IEEE 754 arithmetic contained in <code>fdlibm</code>, the freely
distributable mathematical library from Sun Microsystems (<a href="http://www.netlib.org/fdlibm">http://www.netlib.org/fdlibm</a><span style="font-family: monospace">)</span>.</p>
</div>
<section id="sec-math.abs">
<h1><span class="secnum" id="sec-20.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.abs" title="link to this section">20.2.2.1</a></span>
Math.abs ( x )</h1>
<p>Returns the absolute value of <var>x</var>; the result has the same magnitude as <var>x</var> but has positive
sign.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is −0, the result is +0.</li>
<li>If <i>x</i> is −∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.acos">
<h1><span class="secnum" id="sec-20.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.acos" title="link to this section">20.2.2.2</a></span>
Math.acos ( x )</h1>
<p>Returns an implementation-dependent approximation to the arc cosine of <var>x</var>. The result is expressed in radians
and ranges from <span style="font-family: Times New Roman">+0</span> to <span style="font-family: Times New
Roman">+π</span>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is greater than 1, the result is NaN.</li>
<li>If <i>x</i> is less than <b>−</b>1, the result is NaN.</li>
<li>If <i>x</i> is exactly 1, the result is +0.</li>
</ul>
</section>
<section id="sec-math.acosh">
<h1><span class="secnum" id="sec-20.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.acosh" title="link to this section">20.2.2.3</a></span>
Math.acosh( x )</h1>
<p>Returns an implementation-dependent approximation to the inverse hyperbolic cosine of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If x is less than 1, the result is NaN.</li>
<li>If x is 1, the result is +0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.asin">
<h1><span class="secnum" id="sec-20.2.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.asin" title="link to this section">20.2.2.4</a></span>
Math.asin ( x )</h1>
<p>Returns an implementation-dependent approximation to the arc sine of <var>x</var>. The result is expressed in radians
and ranges from <span style="font-family: Times New Roman">−π/2</span> to <span style="font-family: Times New
Roman">+π/2</span>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is greater than 1, the result is NaN.</li>
<li>If <i>x</i> is less than –1, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
</ul>
</section>
<section id="sec-math.asinh">
<h1><span class="secnum" id="sec-20.2.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.asinh" title="link to this section">20.2.2.5</a></span>
Math.asinh( x )</h1>
<p>Returns an implementation-dependent approximation to the inverse hyperbolic sine of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If x is −∞, the result is −∞.</li>
</ul>
</section>
<section id="sec-math.atan">
<h1><span class="secnum" id="sec-20.2.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.atan" title="link to this section">20.2.2.6</a></span>
Math.atan ( x )</h1>
<p>Returns an implementation-dependent approximation to the arc tangent of <var>x</var>. The result is expressed in
radians and ranges from <span style="font-family: Times New Roman">−π/2</span> to <span style="font-family: Times
New Roman">+π/2</span>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is an implementation-dependent approximation to +π/2.</li>
<li>If <i>x</i> is −∞, the result is an implementation-dependent approximation to −π/2.</li>
</ul>
</section>
<section id="sec-math.atanh">
<h1><span class="secnum" id="sec-20.2.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.atanh" title="link to this section">20.2.2.7</a></span>
Math.atanh( x )</h1>
<p>Returns an implementation-dependent approximation to the inverse hyperbolic tangent of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is less than −1, the result is NaN.</li>
<li>If <i>x</i> is greater than 1, the result is NaN.</li>
<li>If <i>x</i> is −1, the result is −∞.</li>
<li>If <i>x</i> is +1, the result is +∞.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
</ul>
</section>
<section id="sec-math.atan2">
<h1><span class="secnum" id="sec-20.2.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.atan2" title="link to this section">20.2.2.8</a></span>
Math.atan2 ( y, x )</h1>
<p>Returns an implementation-dependent approximation to the arc tangent of the quotient <span style="font-family: Times
New Roman"><i>y</i><b>/</b><i>x</i></span> of the arguments <var>y</var> and <var>x</var>, where the signs of <var>y</var>
and <var>x</var> are used to determine the quadrant of the result. Note that it is intentional and traditional for the
two-argument arc tangent function that the argument named <var>y</var> be first and the argument named <var>x</var> be
second. The result is expressed in radians and ranges from <span style="font-family: Times New Roman">−π</span>
to <span style="font-family: Times New Roman">+π</span>.</p>
<ul>
<li>If either <i>x</i> or <i>y</i> is NaN, the result is NaN.</li>
<li>If <i>y</i>&gt;0 and <i>x</i> is +0, the result is an implementation-dependent approximation to +π/2.</li>
<li>If <i>y</i>&gt;0 and <i>x</i> is −0, the result is an implementation-dependent approximation to +π/2.</li>
<li>If <i>y</i> is +0 and <i>x</i>&gt;0, the result is +0.</li>
<li>If <i>y</i> is +0 and <i>x</i> is +0, the result is +0.</li>
<li>If <i>y</i> is +0 and <i>x</i> is −0, the result is an implementation-dependent approximation to +π.</li>
<li>If <i>y</i> is +0 and <i>x</i>&lt;0, the result is an implementation-dependent approximation to +π.</li>
<li>If <i>y</i> is −0 and <i>x</i>&gt;0, the result is −0.</li>
<li>If <i>y</i> is −0 and <i>x</i> is +0, the result is −0.</li>
<li>If <i>y</i> is −0 and <i>x</i> is −0, the result is an implementation-dependent approximation to
−π.</li>
<li>If <i>y</i> is −0 and <i>x</i>&lt;0, the result is an implementation-dependent approximation to
−π.</li>
<li>If <i>y</i>&lt;0 and <i>x</i> is +0, the result is an implementation-dependent approximation to −π/2.</li>
<li>If <i>y</i>&lt;0 and <i>x</i> is −0, the result is an implementation-dependent approximation to
−π/2.</li>
<li>If <i>y</i>&gt;0 and <i>y</i> is finite and <i>x</i> is +∞, the result is +0.</li>
<li>If <i>y</i>&gt;0 and <i>y</i> is finite and <i>x</i> is −∞, the result if an implementation-dependent
approximation to +π.</li>
<li>If <i>y</i>&lt;0 and <i>y</i> is finite and <i>x</i> is +∞, the result is −0.</li>
<li>If <i>y</i>&lt;0 and <i>y</i> is finite and <i>x</i> is −∞, the result is an implementation-dependent
approximation to −π.</li>
<li>If <i>y</i> is +∞ and <i>x</i> is finite, the result is an implementation-dependent approximation to
+π/2.</li>
<li>If <i>y</i> is −∞ and <i>x</i> is finite, the result is an implementation-dependent approximation to
−π/2.</li>
<li>If <i>y</i> is +∞ and <i>x</i> is +∞, the result is an implementation-dependent approximation to
+π/4.</li>
<li>If <i>y</i> is +∞ and <i>x</i> is −∞, the result is an implementation-dependent approximation to
+3π/4.</li>
<li>If <i>y</i> is −∞ and <i>x</i> is +∞, the result is an implementation-dependent approximation to
−π/4.</li>
<li>If <i>y</i> is −∞ and <i>x</i> is −∞, the result is an implementation-dependent
approximation to −3π/4.</li>
</ul>
</section>
<section id="sec-math.cbrt">
<h1><span class="secnum" id="sec-20.2.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cbrt" title="link to this section">20.2.2.9</a></span>
Math.cbrt ( x )</h1>
<p>Returns an implementation-dependent approximation to the cube root of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is −∞.</li>
</ul>
</section>
<section id="sec-math.ceil">
<h1><span class="secnum" id="sec-20.2.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.ceil" title="link to this section">20.2.2.10</a></span>
Math.ceil ( x )</h1>
<p>Returns the smallest (closest to <b>−∞</b>) Number value that is not less than <var>x</var> and is equal to
a mathematical integer. If <var>x</var> is already an integer, the result is <var>x</var>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is −∞.</li>
<li>If <i>x</i> is less than 0 but greater than -1, the result is −0.</li>
</ul>
<p>The value of <code>Math.ceil(x)</code> is the same as the value of <code>-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.floor">Math.floor</a>(-x)</code>.</p>
</section>
<section id="sec-math.clz32">
<h1><span class="secnum" id="sec-20.2.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.clz32" title="link to this section">20.2.2.11</a></span>
Math.clz32 ( x )</h1>
<p>When <code>Math.clz32</code> is called with one argument <var>x</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>Let <i>p</i> be the number of leading zero bits in the 32-bit binary representation of <i>n</i>.</li>
<li>Return <i>p</i>.</li>
</ol>
<p class="Note">NOTE If <i>n</i> is 0, <i>p</i> will be 32. If the most significant bit of the 32-bit binary encoding of
<i>n</i> is 1, <i>p</i> will be 0.</p>
</section>
<section id="sec-math.cos">
<h1><span class="secnum" id="sec-20.2.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cos" title="link to this section">20.2.2.12</a></span>
Math.cos ( x )</h1>
<p>Returns an implementation-dependent approximation to the cosine of <var>x</var>. The argument is expressed in
radians.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is 1.</li>
<li>If <i>x</i> is −0, the result is 1.</li>
<li>If <i>x</i> is +∞, the result is NaN.</li>
<li>If <i>x</i> is −∞, the result is NaN.</li>
</ul>
</section>
<section id="sec-math.cosh">
<h1><span class="secnum" id="sec-20.2.2.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.cosh" title="link to this section">20.2.2.13</a></span>
Math.cosh ( x )</h1>
<p>Returns an implementation-dependent approximation to the hyperbolic cosine of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is 1.</li>
<li>If <i>x</i> is −0, the result is 1.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is +∞.</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The value of cosh(x) is the same as <i>(exp(x) + exp(-x))/2</i>.</p>
</div>
</section>
<section id="sec-math.exp">
<h1><span class="secnum" id="sec-20.2.2.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.exp" title="link to this section">20.2.2.14</a></span>
Math.exp ( x )</h1>
<p>Returns an implementation-dependent approximation to the exponential function of <var>x</var> (<var>e</var> raised to
the power of <var>x</var>, where <var>e</var> is the base of the natural logarithms).</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is 1.</li>
<li>If <i>x</i> is −0, the result is 1.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is +0.</li>
</ul>
</section>
<section id="sec-math.expm1">
<h1><span class="secnum" id="sec-20.2.2.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.expm1" title="link to this section">20.2.2.15</a></span>
Math.expm1 ( x )</h1>
<p>Returns an implementation-dependent approximation to subtracting 1 from the exponential function of <i>x</i> (<i>e</i>
raised to the power of <i>x</i>, where <i>e</i> is the base of the natural logarithms). The result is computed in a way
that is accurate even when the value of x is close 0.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is −1.</li>
</ul>
</section>
<section id="sec-math.floor">
<h1><span class="secnum" id="sec-20.2.2.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.floor" title="link to this section">20.2.2.16</a></span>
Math.floor ( x )</h1>
<p>Returns the greatest (closest to <b>+∞</b>) Number value that is not greater than <var>x</var> and is equal to a
mathematical integer. If <var>x</var> is already an integer, the result is <var>x</var>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is −∞.</li>
<li>If <i>x</i> is greater than 0 but less than 1, the result is +0.</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The value of <code>Math.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(x)</code> is the
same as the value of <code>-<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.ceil">Math.ceil</a>(-x)</code>.</p>
</div>
</section>
<section id="sec-math.fround">
<h1><span class="secnum" id="sec-20.2.2.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.fround" title="link to this section">20.2.2.17</a></span>
Math.fround ( x )</h1>
<p>When <code>Math.fround</code> is called with argument <i>x</i> the following steps are taken:</p>
<ol class="proc">
<li>If <i>x</i> is NaN, return NaN.</li>
<li>If <i>x</i> is one of +0, −0, +∞, −∞, then return <i>x</i>.</li>
<li>Let <i>x32</i> be the result of converting <i>x</i> to a value in IEEE-754-2005 binary32 format using
roundTiesToEven.</li>
<li>Let <i>x64</i> be the result of converting <i>x32</i> to a value in IEEE-754-2005 binary64 format.</li>
<li>Return the ECMAScript Number value corresponding to <i>x64</i>.</li>
</ol>
</section>
<section id="sec-math.hypot">
<h1><span class="secnum" id="sec-20.2.2.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.hypot" title="link to this section">20.2.2.18</a></span>
Math.hypot ( value1 , value2 [ , …values ] )</h1>
<p><code>Math.hypot</code> returns an implementation-dependent approximation of the square root of the sum of squares of
its arguments.</p>
<ul>
<li>If no arguments are passed, the result is +0.</li>
<li>If any argument is +∞, the result is +∞.</li>
<li>If any argument is −∞, the result is +∞.</li>
<li>If no argument is +∞ or −∞, and any argument is NaN, the result is NaN.</li>
<li>If all arguments are either +0 or −0, the result is +0.</li>
</ul>
<p>The length property of the <code>hypot</code> function is 2.</p>
<div class="note">
<p><span class="nh">NOTE</span> Implementations should take care to avoid the loss of precision from overflows and
underflows that are prone to occur in naive implementations when this function is called with more than two
arguments.</p>
</div>
</section>
<section id="sec-math.imul">
<h1><span class="secnum" id="sec-20.2.2.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.imul" title="link to this section">20.2.2.19</a></span>
Math.imul ( x, y )</h1>
<p>When the <code>Math.imul</code> is called with arguments <var>x</var> and <var>y</var> the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>a</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>a</i>).</li>
<li>Let <i>b</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>y</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>b</i>).</li>
<li>Let <i>product</i> be (<i>a</i> × <i>b</i>) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a>
2<sup>32</sup>.</li>
<li>If <i>product</i> ≥ 2<sup>31</sup>, return <i>product</i> − 2<sup>32</sup>, otherwise return
<i>product</i>.</li>
</ol>
</section>
<section id="sec-math.log">
<h1><span class="secnum" id="sec-20.2.2.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log" title="link to this section">20.2.2.20</a></span>
Math.log ( x )</h1>
<p>Returns an implementation-dependent approximation to the natural logarithm of <var>x</var>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is less than 0, the result is NaN.</li>
<li>If <i>x</i> is +0 or −0, the result is −∞.</li>
<li>If <i>x</i> is 1, the result is +0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.log1p">
<h1><span class="secnum" id="sec-20.2.2.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log1p" title="link to this section">20.2.2.21</a></span>
Math.log1p ( x )</h1>
<p>Returns an implementation-dependent approximation to the natural logarithm of 1 + <i>x</i>. The result is computed in
a way that is accurate even when the value of x is close to zero.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is less than -1, the result is NaN.</li>
<li>If x is -1, the result is -∞.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.log10">
<h1><span class="secnum" id="sec-20.2.2.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log10" title="link to this section">20.2.2.22</a></span>
Math.log10 ( x )</h1>
<p>Returns an implementation-dependent approximation to the base 10 logarithm of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is less than 0, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is −∞.</li>
<li>If <i>x</i> is −0, the result is −∞.</li>
<li>If <i>x</i> is 1, the result is +0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.log2">
<h1><span class="secnum" id="sec-20.2.2.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.log2" title="link to this section">20.2.2.23</a></span>
Math.log2 ( x )</h1>
<p>Returns an implementation-dependent approximation to the base 2 logarithm of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is less than 0, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is −∞.</li>
<li>If <i>x</i> is −0, the result is −∞.</li>
<li>If <i>x</i> is 1, the result is +0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.max">
<h1><span class="secnum" id="sec-20.2.2.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.max" title="link to this section">20.2.2.24</a></span>
Math.max ( value1, value2 [ , …values ] )</h1>
<p>Given zero or more arguments, calls <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a> on each of the arguments and returns the
largest of the resulting values.</p>
<ul>
<li>
<p>If no arguments are given, the result is −∞.</p>
</li>
<li>
<p>If any value is NaN, the result is NaN.</p>
</li>
<li>
<p>The comparison of values to determine the largest value is done using the Abstract Relational Comparison algorithm
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">7.2.8</a>) except that +0 is considered to be larger than −0.</p>
</li>
</ul>
<p>The <code>length</code> property of the <code>max</code> method is <b>2</b>.</p>
</section>
<section id="sec-math.min">
<h1><span class="secnum" id="sec-20.2.2.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.min" title="link to this section">20.2.2.25</a></span>
Math.min ( value1, value2 [ , …values ] )</h1>
<p>Given zero or more arguments, calls <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a> on each of the arguments and returns the
smallest of the resulting values.</p>
<ul>
<li>
<p>If no arguments are given, the result is +∞.</p>
</li>
<li>
<p>If any value is NaN, the result is NaN.</p>
</li>
<li>
<p>The comparison of values to determine the smallest value is done using the Abstract Relational Comparison algorithm
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger">7.2.8</a>) except that +0 is considered to be larger than −0.</p>
</li>
</ul>
<p>The <code>length</code> property of the <code>min</code> method is <b>2</b>.</p>
</section>
<section id="sec-math.pow">
<h1><span class="secnum" id="sec-20.2.2.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.pow" title="link to this section">20.2.2.26</a></span>
Math.pow ( x, y )</h1>
<p>Returns an implementation-dependent approximation to the result of raising <var>x</var> to the power <var>y</var>.</p>
<ul>
<li>If <i>y</i> is NaN, the result is NaN.</li>
<li>If <i>y</i> is +0, the result is 1, even if <i>x</i> is NaN.</li>
<li>If <i>y</i> is −0, the result is 1, even if <i>x</i> is NaN.</li>
<li>If <i>x</i> is NaN and <i>y</i> is nonzero, the result is NaN.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>x</i>)&gt;1 and <i>y</i> is +∞, the result is
+∞.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>x</i>)&gt;1 and <i>y</i> is −∞, the result is
+0.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>x</i>) is 1 and <i>y</i> is +∞, the result is NaN.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>x</i>) is 1 and <i>y</i> is −∞, the result is
NaN.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>x</i>)&lt;1 and <i>y</i> is +∞, the result is +0.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>x</i>)&lt;1 and <i>y</i> is −∞, the result is
+∞.</li>
<li>If <i>x</i> is +∞ and <i>y</i>&gt;0, the result is +∞.</li>
<li>If <i>x</i> is +∞ and <i>y</i>&lt;0, the result is +0.</li>
<li>If <i>x</i> is −∞ and <i>y</i>&gt;0 and <i>y</i> is an odd integer, the result is −∞.</li>
<li>If <i>x</i> is −∞ and <i>y</i>&gt;0 and <i>y</i> is not an odd integer, the result is +∞.</li>
<li>If <i>x</i> is −∞ and <i>y</i>&lt;0 and <i>y</i> is an odd integer, the result is −0.</li>
<li>If <i>x</i> is −∞ and <i>y</i>&lt;0 and <i>y</i> is not an odd integer, the result is +0.</li>
<li>If <i>x</i> is +0 and <i>y</i>&gt;0, the result is +0.</li>
<li>If <i>x</i> is +0 and <i>y</i>&lt;0, the result is +∞.</li>
<li>If <i>x</i> is −0 and <i>y</i>&gt;0 and <i>y</i> is an odd integer, the result is −0.</li>
<li>If <i>x</i> is −0 and <i>y</i>&gt;0 and <i>y</i> is not an odd integer, the result is +0.</li>
<li>If <i>x</i> is −0 and <i>y</i>&lt;0 and <i>y</i> is an odd integer, the result is −∞.</li>
<li>If <i>x</i> is −0 and <i>y</i>&lt;0 and <i>y</i> is not an odd integer, the result is +∞.</li>
<li>If <i>x</i>&lt;0 and <i>x</i> is finite and <i>y</i> is finite and <i>y</i> is not an integer, the result is
NaN.</li>
</ul>
</section>
<section id="sec-math.random">
<h1><span class="secnum" id="sec-20.2.2.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.random" title="link to this section">20.2.2.27</a></span>
Math.random ( )</h1>
<p>Returns a Number value with positive sign, greater than or equal to 0 but less than 1, chosen randomly or pseudo
randomly with approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy.
This function takes no arguments.</p>
<p>Each <code>Math.random</code> function created for distinct code Realms must produce a distinct sequence of values from
successive calls.</p>
</section>
<section id="sec-math.round">
<h1><span class="secnum" id="sec-20.2.2.28"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.round" title="link to this section">20.2.2.28</a></span>
Math.round ( x )</h1>
<p>Returns the Number value that is closest to <var>x</var> and is equal to a mathematical integer. If two integer Number
values are equally close to <var>x</var>, then the result is the Number value that is closer to <span style="font-family:
Times New Roman">+∞</span>. If <var>x</var> is already an integer, the result is <var>x</var>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If <i>x</i> is −∞, the result is −∞.</li>
<li>If <i>x</i> is greater than 0 but less than 0.5, the result is +0.</li>
<li>If <i>x</i> is less than 0 but greater than or equal to -0.5, the result is −0.</li>
</ul>
<div class="note">
<p><span class="nh">NOTE 1</span> <code>Math.round(3.5)</code> returns 4, but <code>Math.round(–3.5)</code>
returns –3.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The value of <code>Math.round(x)</code> is the same as the value of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.floor">Math.floor</a>(x+0.5)</code>, except when <code>x</code> is −0 or is less than 0 but
greater than or equal to -0.5; for these cases <code>Math.round(x)</code> returns −0, but <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.floor">Math.floor</a>(x+0.5)</code> returns +0.</p>
</div>
</section>
<section id="sec-math.sign">
<h1><span class="secnum" id="sec-20.2.2.29"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sign" title="link to this section">20.2.2.29</a></span>
Math.sign(x)</h1>
<p>Returns the sign of the x, indicating whether x is positive, negative or zero.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is negative and not −0, the result is −1.</li>
<li>If <i>x</i> is positive and not +0, the result is +1.</li>
</ul>
</section>
<section id="sec-math.sin">
<h1><span class="secnum" id="sec-20.2.2.30"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sin" title="link to this section">20.2.2.30</a></span>
Math.sin ( x )</h1>
<p>Returns an implementation-dependent approximation to the sine of <var>x</var>. The argument is expressed in
radians.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞ or −∞, the result is NaN.</li>
</ul>
</section>
<section id="sec-math.sinh">
<h1><span class="secnum" id="sec-20.2.2.31"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sinh" title="link to this section">20.2.2.31</a></span>
Math.sinh( x )</h1>
<p>Returns an implementation-dependent approximation to the hyperbolic sine of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If x is −∞, the result is −∞.</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The value of sinh(x) is the same as <i>(exp(x) - exp(-x))/2</i>.</p>
</div>
</section>
<section id="sec-math.sqrt">
<h1><span class="secnum" id="sec-20.2.2.32"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sqrt" title="link to this section">20.2.2.32</a></span>
Math.sqrt ( x )</h1>
<p>Returns an implementation-dependent approximation to the square root of <var>x</var>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is less than 0, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
</ul>
</section>
<section id="sec-math.tan">
<h1><span class="secnum" id="sec-20.2.2.33"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.tan" title="link to this section">20.2.2.33</a></span>
Math.tan ( x )</h1>
<p>Returns an implementation-dependent approximation to the tangent of <var>x</var>. The argument is expressed in
radians.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞ or −∞, the result is NaN.</li>
</ul>
</section>
<section id="sec-math.tanh">
<h1><span class="secnum" id="sec-20.2.2.34"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.tanh" title="link to this section">20.2.2.34</a></span>
Math.tanh ( x )</h1>
<p>Returns an implementation-dependent approximation to the hyperbolic tangent of <i>x</i>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +∞, the result is +1.</li>
<li>If <i>x</i> is −∞, the result is -1.</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The value of tanh(x) is the same as <i>(exp(x) - exp(-x))/(exp(x) + exp(-x))</i>.</p>
</div>
</section>
<section id="sec-math.trunc">
<h1><span class="secnum" id="sec-20.2.2.35"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.trunc" title="link to this section">20.2.2.35</a></span>
Math.trunc ( x )</h1>
<p>Returns the integral part of the number <var>x</var>, removing any fractional digits. If <var>x</var> is already an
integer, the result is <var>x</var>.</p>
<ul>
<li>If <i>x</i> is NaN, the result is NaN.</li>
<li>If <i>x</i> is −0, the result is −0.</li>
<li>If <i>x</i> is +0, the result is +0.</li>
<li>If <i>x</i> is +∞, the result is +∞.</li>
<li>If x is −∞, the result is −∞.</li>
<li>If <i>x</i> is greater than 0 but less than 1, the result is +0.</li>
<li>If <i>x</i> is less than 0 but greater than <span style="font-family: sans-serif">−</span>1, the result is
<span style="font-family: sans-serif">−</span>0.</li>
</ul>
</section>
</section>
</section>
<section id="sec-date-objects">
<div class="front">
<h1><span class="secnum" id="sec-20.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-objects" title="link to this section">20.3</a></span> Date
Objects</h1>
</div>
<section id="sec-overview-of-date-objects-and-definitions-of-abstract-operations">
<div class="front">
<h1><span class="secnum" id="sec-20.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-overview-of-date-objects-and-definitions-of-abstract-operations" title="link to this section">20.3.1</a></span> Overview of Date Objects and Definitions of Abstract Operations</h1>
<p>The following functions are abstract operations that operate on time values (defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">20.3.1.1</a>). Note that, in every case, if any argument to one of these functions
is <b>NaN</b>, the result will be <b>NaN</b>.</p>
</div>
<section id="sec-time-values-and-time-range">
<h1><span class="secnum" id="sec-20.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range" title="link to this section">20.3.1.1</a></span> Time Values and Time Range</h1>
<p>A Date object contains a Number indicating a particular instant in time to within a millisecond. Such a Number is
called a <i>time value</i>. A time value may also be <b>NaN</b>, indicating that the Date object does not represent a
specific instant of time.</p>
<p>Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC. In time values leap seconds are ignored. It
is assumed that there are exactly 86,400,000 milliseconds per day. ECMAScript Number values can represent all integers
from –9,007,199,254,740,992 to 9,007,199,254,740,992; this range suffices to measure times to millisecond precision
for any instant that is within approximately 285,616 years, either forward or backward, from 01 January, 1970 UTC.</p>
<p>The actual range of times supported by ECMAScript Date objects is slightly smaller: exactly –100,000,000 days to
100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. This gives a range of
8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC.</p>
<p>The exact moment of midnight at the beginning of 01 January, 1970 UTC is represented by the value <b>+0</b>.</p>
</section>
<section id="sec-day-number-and-time-within-day">
<h1><span class="secnum" id="sec-20.3.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day" title="link to this section">20.3.1.2</a></span> Day Number and Time within Day</h1>
<p>A given <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> <i>t</i> belongs to day number</p>
<div class="display">Day(<i>t</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>t</i> / msPerDay)</div>
<p>where the number of milliseconds per day is</p>
<div class="display">msPerDay = 86400000</div>
<p>The remainder is called the time within the day:</p>
<div class="display">TimeWithinDay(<i>t</i>) = <i>t</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> msPerDay</div>
</section>
<section id="sec-year-number">
<h1><span class="secnum" id="sec-20.3.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number" title="link to this section">20.3.1.3</a></span>
Year Number</h1>
<p>ECMAScript uses an extrapolated Gregorian system to map a day number to a year number and to determine the month and
date within that year. In this system, leap years are precisely those which are (divisible by <span style="font-family:
Times New Roman">4</span>) and ((not divisible by <span style="font-family: Times New Roman">100</span>) or (divisible by
<span style="font-family: Times New Roman">400</span>)). The number of days in year number <var>y</var> is therefore
defined by</p>
<div class="display">DaysInYear(<i>y</i>) = 365 if (<i>y</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 4) ≠ 0<br>= 366 if (<i>y</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 4) = 0 and (<i>y</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 100) ≠ 0<br>= 365 if (<i>y</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 100) = 0 and (<i>y</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 400) ≠ 0<br>= 366 if (<i>y</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 400) = 0</div>
<p>All non-leap years have <span style="font-family: Times New Roman">365</span> days with the usual number of days per
month and leap years have an extra day in February. The day number of the first day of year <var>y</var> is given by:</p>
<div class="display">DayFromYear(<i>y</i>) = 365 × (<i>y</i>−1970) + <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>((<i>y</i>−1969)/4) − <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>((<i>y</i>−1901)/100) + <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>((<i>y</i>−1601)/400)</div>
<p>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> of the start of a year is:</p>
<div class="display">TimeFromYear(<i>y</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">msPerDay</a> × DayFromYear(<i>y</i>)</div>
<p>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> determines a year by:</p>
<div class="display">YearFromTime(<i>t</i>) = the largest integer <i>y</i> (closest to positive infinity) such that TimeFromYear(<i>y</i>) ≤ <i>t</i></div>
<p>The leap-year function is 1 for a time within a leap year and otherwise is zero:</p>
<div class="display">InLeapYear(<i>t</i>) = 0 if DaysInYear(YearFromTime(<i>t</i>)) = 365<br>= 1 if DaysInYear(YearFromTime<i>(t</i>)) = 366</div>
</section>
<section id="sec-month-number">
<h1><span class="secnum" id="sec-20.3.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number" title="link to this section">20.3.1.4</a></span>
Month Number</h1>
<p>Months are identified by an integer in the range <span style="font-family: Times New Roman">0</span> to <span style="font-family: Times New Roman">11</span>, inclusive. The mapping MonthFromTime(<i>t</i>) from a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> <i>t</i> to a month number is defined by:</p>
<div class="display">MonthFromTime(<i>t</i>) = 0 if 0 ≤ DayWithinYear(<i>t</i>) &lt; 31<br> = 1 if 31 ≤ DayWithinYear (<i>t</i>) &lt; 59+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 2 if 59+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 90+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 3 if 90+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 120+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 4 if 120+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 151+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 5 if 151+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 181+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 6 if 181+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 212+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 7 if 212+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 243+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 8 if 243+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 273+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 9 if 273+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 304+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 10 if 304+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 334+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)<br> = 11 if 334+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) ≤ DayWithinYear (<i>t</i>) &lt; 365+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>)</div>
<p>where</p>
<div class="display">DayWithinYear(<i>t</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>)−DayFromYear(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t)</i>)</div>
<p>A month value of <span style="font-family: Times New Roman">0</span> specifies January; <span style="font-family: Times
New Roman">1</span> specifies February; <span style="font-family: Times New Roman">2</span> specifies March; <span style="font-family: Times New Roman">3</span> specifies April; <span style="font-family: Times New
Roman">4</span>&nbsp;specifies May; <span style="font-family: Times New Roman">5</span> specifies June; <span style="font-family: Times New Roman">6</span> specifies July; <span style="font-family: Times New Roman">7</span>
specifies August; <span style="font-family: Times New Roman">8</span> specifies September; <span style="font-family: Times
New Roman">9</span> specifies October; <span style="font-family: Times New Roman">10</span> specifies November; and <span style="font-family: Times New Roman">11</span> specifies December. Note that <span style="font-family: Times New
Roman">MonthFromTime(0) = 0</span>, corresponding to Thursday, 01 January, 1970.</p>
</section>
<section id="sec-date-number">
<h1><span class="secnum" id="sec-20.3.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number" title="link to this section">20.3.1.5</a></span>
Date Number</h1>
<p>A date number is identified by an integer in the range <span style="font-family: Times New Roman">1</span> through
<span style="font-family: Times New Roman">31</span>, inclusive. The mapping DateFromTime(<i>t</i>) from a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> <i>t</i> to a month number is defined by:</p>
<div class="display">DateFromTime(<i>t</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)+1 if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=0<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−30 if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=1<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−58−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=2<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−89−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=3<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−119−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=4<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−150−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=5<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−180−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=6<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−211−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=7<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−242−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=8<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−272−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=9<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−303−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=10<br> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">DayWithinYear</a>(<i>t</i>)−333−<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">InLeapYear</a>(<i>t</i>) if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>)=11</div>
</section>
<section id="sec-week-day">
<h1><span class="secnum" id="sec-20.3.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-week-day" title="link to this section">20.3.1.6</a></span> Week
Day</h1>
<p>The weekday for a particular <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> <var>t</var> is defined as</p>
<div class="display">WeekDay(<i>t</i>) = (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>) + 4) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 7</div>
<p>A weekday value of <span style="font-family: Times New Roman">0</span> specifies Sunday; <span style="font-family:
Times New Roman">1</span> specifies Monday; <span style="font-family: Times New Roman">2</span> specifies Tuesday; <span style="font-family: Times New Roman">3</span> specifies Wednesday; <span style="font-family: Times New
Roman">4</span>&nbsp;specifies Thursday; <span style="font-family: Times New Roman">5</span> specifies Friday; and <span style="font-family: Times New Roman">6</span> specifies Saturday. Note that <span style="font-family: Times New
Roman">WeekDay(0) = 4</span>, corresponding to Thursday, 01 January, 1970.</p>
</section>
<section id="sec-local-time-zone-adjustment">
<h1><span class="secnum" id="sec-20.3.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time-zone-adjustment" title="link to this section">20.3.1.7</a></span> Local Time Zone Adjustment</h1>
<p>An implementation of ECMAScript is expected to determine the local time zone adjustment. The local time zone adjustment
is a value LocalTZA measured in milliseconds which when added to UTC represents the local <i>standard</i> time. Daylight
saving time is <i>not</i> reflected by LocalTZA.</p>
<div class="note">
<p><span class="nh">NOTE</span> It is recommended that implementations use the time zone information of the IANA Time
Zone Database.</p>
</div>
</section>
<section id="sec-daylight-saving-time-adjustment">
<h1><span class="secnum" id="sec-20.3.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-daylight-saving-time-adjustment" title="link to this section">20.3.1.8</a></span> Daylight Saving Time Adjustment</h1>
<p>An implementation dependent algorithm using best available information on time zones to determine the local daylight
saving time adjustment DaylightSavingTA(<i>t</i>), measured in milliseconds. An implementation of ECMAScript is expected
to make its best effort to determine the local daylight saving time adjustment.</p>
</section>
<section id="sec-local-time">
<h1><span class="secnum" id="sec-20.3.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time" title="link to this section">20.3.1.9</a></span>
Local Time</h1>
<p>Conversion from UTC to local time is defined by</p>
<div class="display">LocalTime(<i>t</i>) = <i>t</i> + <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time-zone-adjustment">LocalTZA</a> + <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-daylight-saving-time-adjustment">DaylightSavingTA</a>(<i>t</i>)</div>
<p>Conversion from local time to UTC is defined by</p>
<div class="display">UTC(<i>t</i>) = <i>t</i> – <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time-zone-adjustment">LocalTZA</a> – <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-daylight-saving-time-adjustment">DaylightSavingTA</a>(<i>t</i> – <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time-zone-adjustment">LocalTZA</a>)</div>
<div class="note">
<p><span class="nh">NOTE</span> UTC(LocalTime(<i>t</i>)) is not necessarily always equal to <i>t</i>.</p>
</div>
</section>
<section id="sec-hours-minutes-second-and-milliseconds">
<h1><span class="secnum" id="sec-20.3.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds" title="link to this section">20.3.1.10</a></span> Hours, Minutes, Second, and Milliseconds</h1>
<p>The following functions are useful in decomposing time values:</p>
<div class="display">HourFromTime(<i>t</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>t</i> / msPerHour) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> HoursPerDay</div>
<div class="display">MinFromTime(<i>t</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>t</i> / msPerMinute) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> MinutesPerHour</div>
<div class="display">SecFromTime(<i>t</i>) = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>t</i> / msPerSecond) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> SecondsPerMinute</div>
<div class="display">msFromTime(<i>t</i>) = <i>t</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> msPerSecond</div>
<p>where</p>
<div class="display">HoursPerDay = 24</div>
<div class="display">MinutesPerHour = 60</div>
<div class="display">SecondsPerMinute = 60</div>
<div class="display">msPerSecond = 1000</div>
<div class="display">msPerMinute = 60000 = msPerSecond × SecondsPerMinute</div>
<div class="display">msPerHour = 3600000 = msPerMinute × MinutesPerHour</div>
</section>
<section id="sec-maketime">
<h1><span class="secnum" id="sec-20.3.1.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime" title="link to this section">20.3.1.11</a></span>
MakeTime (hour, min, sec, ms)</h1>
<p>The operator MakeTime calculates a number of milliseconds from its four arguments, which must be ECMAScript Number
values. This operator functions as follows:</p>
<ol class="proc">
<li>If <i>hour</i> is not finite or <i>min</i> is not finite or <i>sec</i> is not finite or <i>ms</i> is not finite,
return <b>NaN</b>.</li>
<li>Let <i>h</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>hour</i>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>min</i>).</li>
<li>Let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>sec</i>).</li>
<li>Let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>ms</i>).</li>
<li>Let <i>t</i> be <i>h</i> <code>*</code> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msPerHour</a>
<code>+</code> <i>m</i> <code>*</code> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msPerMinute</a>
<code>+</code> <i>s</i> <code>*</code> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msPerSecond</a>
<code>+</code> <i>milli</i>, performing the arithmetic according to IEEE 754 rules (that is, as if using the
ECMAScript operators <code>*</code> and <code>+</code>).</li>
<li>Return <i>t</i>.</li>
</ol>
</section>
<section id="sec-makeday">
<h1><span class="secnum" id="sec-20.3.1.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday" title="link to this section">20.3.1.12</a></span>
MakeDay (year, month, date)</h1>
<p>The operator MakeDay calculates a number of days from its three arguments, which must be ECMAScript Number values. This
operator functions as follows:</p>
<ol class="proc">
<li>If <i>year</i> is not finite or <i>month</i> is not finite or <i>date</i> is not finite, return <b>NaN</b>.</li>
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>year</i>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>month</i>).</li>
<li>Let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>date</i>).</li>
<li>Let <i>ym</i> be <i>y</i> + <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>m</i> /12).</li>
<li>Let <i>mn</i> be <i>m</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> 12.</li>
<li>Find a value <i>t</i> such that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t</i>) is <i>ym</i> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>) is <i>mn</i> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>) is 1; but if this is not possible (because some argument is out
of range), return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>) + <i>dt</i> − 1.</li>
</ol>
</section>
<section id="sec-makedate">
<h1><span class="secnum" id="sec-20.3.1.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate" title="link to this section">20.3.1.13</a></span>
MakeDate (day, time)</h1>
<p>The operator MakeDate calculates a number of milliseconds from its two arguments, which must be ECMAScript Number
values. This operator functions as follows:</p>
<ol class="proc">
<li>If <i>day</i> is not finite or <i>time</i> is not finite, return <b>NaN</b>.</li>
<li>Return <i>day</i> × <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">msPerDay</a> + <i>time</i>.</li>
</ol>
</section>
<section id="sec-timeclip">
<h1><span class="secnum" id="sec-20.3.1.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip" title="link to this section">20.3.1.14</a></span>
TimeClip (time)</h1>
<p>The operator TimeClip calculates a number of milliseconds from its argument, which must be an ECMAScript Number value.
This operator functions as follows:</p>
<ol class="proc">
<li>If <i>time</i> is not finite, return <b>NaN</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>time</i>) &gt; 8.64&nbsp;<span style="font-family:
sans-serif">×</span>&nbsp;10<sup>15</sup>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>time</i>) + (<b>+0</b>). (Adding a positive zero converts
<b>−0</b> to <b>+0</b>.)</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The point of step 3 is that an implementation is permitted a choice of internal
representations of time values, for example as a 64-bit signed integer or as a 64-bit floating-point value. Depending on
the implementation, this internal representation may or may not distinguish <b>−0</b> and <b>+0</b>.</p>
</div>
</section>
<section id="sec-date-time-string-format">
<div class="front">
<h1><span class="secnum" id="sec-20.3.1.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-time-string-format" title="link to this section">20.3.1.15</a></span> Date Time String Format</h1>
<p>ECMAScript defines a string interchange format for date-times based upon a simplification of the ISO 8601 Extended
Format. The format is as follows: <code>YYYY-MM-DDTHH:mm:ss.sss<i>Z</i></code></p>
<p>Where the fields are as follows:</p>
<p><code>YYYY</code> <span style="font-family: sans-serif">is the decimal digits of the year 0000 to 9999 in the
Gregorian calendar.</span></p>
<p><code>-</code> <span style="font-family: sans-serif">“</span><code>-</code><span style="font-family:
sans-serif">” (hyphen) appears literally twice in the string.</span></p>
<p><code>MM</code> <span style="font-family: sans-serif">is the month of the year from 01 (January) to 12
(December).</span></p>
<p><code>DD</code> <span style="font-family: sans-serif">is the day of the month from 01 to 31.</span></p>
<p><code>T</code> <span style="font-family: sans-serif">“</span><code>T</code><span style="font-family:
sans-serif">” appears literally in the string, to indicate the beginning of the time element.</span></p>
<p><code>HH</code> <span style="font-family: sans-serif">is the number of complete hours that have passed since
midnight as two decimal digits from 00 to 24.</span></p>
<p><code>:</code> <span style="font-family: sans-serif">“</span><code>:</code><span style="font-family:
sans-serif">” (colon) appears literally twice in the string.</span></p>
<p><code>mm</code> <span style="font-family: sans-serif">is the number of complete minutes since the start of the
hour as two decimal digits from 00 to 59.</span></p>
<p><code>ss</code> <span style="font-family: sans-serif">is the number of complete seconds since the start of the
minute as two decimal digits from 00 to 59.</span></p>
<p><code>.</code> <span style="font-family: sans-serif">“</span><code>.</code><span style="font-family:
sans-serif">” (dot) appears literally in the string.</span></p>
<p><code>sss</code> <span style="font-family: sans-serif">is the number of complete milliseconds since the start of
the second as three decimal digits.</span></p>
<p><code>Z</code> <span style="font-family: sans-serif">is the time zone offset specified as
“</span><code>Z</code><span style="font-family: sans-serif">” (for UTC) or either
“</span><code>+</code><span style="font-family: sans-serif">” or “</span><code>-</code><span style="font-family: sans-serif">” followed by a time expression</span> <code>HH:mm</code></p>
<p>This format includes date-only forms:</p>
<pre>YYYY<br>YYYY-MM<br>YYYY-MM-DD</pre>
<p>It also includes “date-time” forms that consist of one of the above date-only forms immediately followed
by one of the following time forms with an optional time zone offset appended:</p>
<pre>THH:mm<br>THH:mm:ss<br>THH:mm:ss.sss</pre>
<p>All numbers must be base <span style="font-family: Times New Roman">10</span>. If the <code>MM</code> or
<code>DD</code> fields are absent “<code>01</code>” is used as the value. If the <code>HH</code>,
<code>mm</code>, or <code>ss</code> fields are absent “<code>00</code>” is used as the value and the value
of an absent <code>sss</code> field is “<code>000</code>”. If the time zone offset is absent, the date-time
is interpreted as a local time.</p>
<p>Illegal values (out-of-bounds as well as syntax errors) in a format string means that the format string is not a
valid instance of this format.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> As every day both starts and ends with midnight, the two notations <span style="font-family: monospace">00:00</span> and <span style="font-family: monospace">24:00</span> are available to
distinguish the two midnights that can be associated with one date. This means that the following two notations refer
to exactly the same point in time: <span style="font-family: monospace">1995-02-04T24:00</span> and <span style="font-family: monospace">1995-02-05T00:00</span></p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> There exists no international standard that specifies abbreviations for civil time
zones like CET, EST, etc. and sometimes the same abbreviation is even used for two very different time zones. For this
reason, ISO 8601 and this format specifies numeric representations of date and time.</p>
</div>
</div>
<section id="sec-extended-years">
<h1><span class="secnum" id="sec-20.3.1.15.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-extended-years" title="link to this section">20.3.1.15.1</a></span> Extended years</h1>
<p>ECMAScript requires the ability to specify <span style="font-family: Times New Roman">6</span> digit years (extended
years); approximately <span style="font-family: Times New Roman">285,426</span> years, either forward or backward, from
01 January, 1970 UTC. To represent years before <span style="font-family: Times New Roman">0</span> or after <span style="font-family: Times New Roman">9999</span>, ISO 8601 permits the expansion of the year representation, but only by
prior agreement between the sender and the receiver. In the simplified ECMAScript format such an expanded year
representation shall have <span style="font-family: Times New Roman">2</span> extra year digits and is always prefixed
with a + or – sign. The year <span style="font-family: Times New Roman">0</span> is considered positive and hence
prefixed with a + sign.</p>
<div class="note">
<p><span class="nh">NOTE</span> Examples of extended years:</p>
<p>-283457-03-21T15:00:59.008Z 283458 B.C.<span style="font-family: Times New
Roman"><br></span>-000001-01-01T00:00:00Z 2 B.C.<span style="font-family: Times New
Roman"><br></span>+000000-01-01T00:00:00Z 1 B.C.<span style="font-family: Times New
Roman"><br></span>+000001-01-01T00:00:00Z 1 A.D.<span style="font-family: Times New
Roman"><br></span>+001970-01-01T00:00:00Z 1970 A.D.<span style="font-family: Times New
Roman"><br></span>+002009-12-15T00:00:00Z 2009 A.D.<span style="font-family: Times New
Roman"><br></span>+287396-10-12T08:59:00.992Z 287396 A.D.</p>
</div>
</section>
</section>
</section>
<section id="sec-date-constructor">
<div class="front">
<h1><span class="secnum" id="sec-20.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-constructor" title="link to this section">20.3.2</a></span>
The Date Constructor</h1>
<p>The Date constructor is the %Date% intrinsic object and the initial value of the <code>Date</code> property of the
global object. When <code>Date</code> is called as a function rather than as a constructor, it returns a String
representing the current time (UTC). However, if the <b>this</b> value passed in the call is an Object with an
uninitialized [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, <code>Date</code>
initializes the <b>this</b> object using the argument value. This permits <code>Date</code> to be used both as a function
for creating data strings and to perform constructor instance initialisation.</p>
<p>The <code>Date</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>Date</code> behaviour must include a <code>super</code> call to the <code>Date</code> constructor to initialize the
[[DateValue]] state of subclass instances.</p>
</div>
<section id="sec-date-year-month-date-hours-minutes-seconds-ms">
<h1><span class="secnum" id="sec-20.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-year-month-date-hours-minutes-seconds-ms" title="link to this section">20.3.2.1</a></span> Date ( year, month [, date [ , hours [ , minutes [ , seconds [ , ms ]
] ] ] ] )</h1>
<p>This description applies only if the Date constructor is called with at least two arguments.</p>
<p>When the <code>Date</code> function is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>numberOfArgs</i> be the number of arguments passed to this constructor call.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numberOfArgs</i> ≥ 2.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[DateValue]] is
<b>undefined</b>, then
<ol class="block">
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>year</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>year</i>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>month</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>month</i>).</li>
<li>If <i>date</i> is supplied then let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>); else let
<i>dt</i> be <b>1</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>dt</i>).</li>
<li>If <i>hours</i> is supplied then let <i>h</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>hours</i>); else let
<i>h</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>h</i>).</li>
<li>If <i>minutes</i> is supplied then let <i>min</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>minutes</i>); else
let <i>min</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>min</i>).</li>
<li>If <i>seconds</i> is supplied then let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>seconds</i>); else
let <i>s</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>s</i>).</li>
<li>If <i>ms</i> is supplied then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>); else let
<i>milli</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>milli</i>).</li>
<li>If&nbsp;<i>y</i>&nbsp;is&nbsp;not&nbsp;<b>NaN</b>&nbsp;and&nbsp;0&nbsp;≤&nbsp;<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>y</i>)&nbsp;≤&nbsp;99,&nbsp;then let <i>yr</i> be&nbsp;1900+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>y</i>); otherwise, let <i>yr</i> be <i>y</i>.</li>
<li>Let <i>finalDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<i>yr</i>,
<i>m</i>, <i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<i>h</i>, <i>min</i>, <i>s</i>, <i>milli</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>finalDate</i>)).</li>
<li>Return <i>O</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>now</i> be the Number that is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> (UTC)
identifying the current time.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-todatestring">ToDateString</a> (<i>now</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-date-value">
<h1><span class="secnum" id="sec-20.3.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-value" title="link to this section">20.3.2.2</a></span> Date
( value )</h1>
<p>This description applies only if the Date constructor is called with exactly one argument.</p>
<p>When the <code>Date</code> function is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>numberOfArgs</i> be the number of arguments passed to this constructor call.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numberOfArgs</i> = 1.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[DateValue]] is
<b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object and <i>value</i> has a
[[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>tv</i> be thisTimeValue(<i>value</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>value</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is String, then
<ol class="block">
<li>Let <i>tv</i> be the result of parsing <i>v</i> as a date, in exactly the same manner as for the
<code>parse</code> method (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.parse">20.3.3.2</a>). If the parse resulted in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, <i>tv</i> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>tv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>v</i>).</li>
</ol>
</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>tv</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>tv</i>).</li>
<li>Return <i>O</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>now</i> be the Number that is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> (UTC)
identifying the current time.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-todatestring">ToDateString</a> (<i>now</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-date-constructor-date">
<h1><span class="secnum" id="sec-20.3.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-constructor-date" title="link to this section">20.3.2.3</a></span> Date ( )</h1>
<p>This description applies only if the Date constructor is called with no arguments.</p>
<p>When the <code>Date</code> function is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>numberOfArgs</i> be the number of arguments passed to this constructor call.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numberOfArgs</i> = 0.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[DateValue]] is
<b>undefined</b>, then
<ol class="block">
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> (UTC) identifying the current time.</li>
<li>Return <i>O</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>now</i> be the Number that is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> (UTC)
identifying the current time.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-todatestring">ToDateString</a> (<i>now</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-new-date-argumentslist">
<h1><span class="secnum" id="sec-20.3.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-date-argumentslist" title="link to this section">20.3.2.4</a></span> new Date ( ...argumentsList )</h1>
<p>When <code>Date</code> is called as part of a new expression with argument list <var>argumentsList</var> it performs
the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Date</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Date</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-date-constructor">
<div class="front">
<h1><span class="secnum" id="sec-20.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-constructor" title="link to this section">20.3.3</a></span> Properties of the Date Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Date
constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <code>7</code>), the Date constructor has the following
properties:</p>
</div>
<section id="sec-date.now">
<h1><span class="secnum" id="sec-20.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.now" title="link to this section">20.3.3.1</a></span>
Date.now ( )</h1>
<p>The <code>now</code> function return a Number value that is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time
value</a> designating the UTC date and time of the occurrence of the call to <code>now</code>.</p>
</section>
<section id="sec-date.parse">
<h1><span class="secnum" id="sec-20.3.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.parse" title="link to this section">20.3.3.2</a></span>
Date.parse ( string )</h1>
<p>The <code>parse</code> function applies the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a> operator to its argument. If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a> results in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a> is immediately returned. Otherwise,
<code>parse</code> interprets the resulting String as a date and time; it returns a Number, the UTC <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> corresponding to the date and time. The String may be interpreted as
a local time, a UTC time, or a time in some other time zone, depending on the contents of the String. The function first
attempts to parse the format of the String according to the rules (including extended years) called out in Date Time
String Format (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-time-string-format">20.3.1.15</a>). If the String does not conform to that format the
function may fall back to any implementation-specific heuristics or implementation-specific date formats. Unrecognisable
Strings or dates containing illegal element values in the format String shall cause <code>Date.parse</code> to return
<b>NaN</b>.</p>
<p>If <var>x</var> is any Date object whose milliseconds amount is zero within a particular implementation of ECMAScript,
then all of the following expressions should produce the same numeric value in that implementation, if all the properties
referenced have their initial values:</p>
<pre><i>x</i>.valueOf()</pre>
<pre>Date.parse(<i>x</i>.toString())</pre>
<pre>Date.parse(<i>x</i>.toUTCString())</pre>
<pre>Date.parse(<i>x</i>.toISOString())</pre>
<p>However, the expression</p>
<pre>Date.parse(<i>x</i>.toLocaleString())</pre>
<p>is not required to produce the same Number value as the preceding three expressions and, in general, the value produced
by <code>Date.parse</code> is implementation-dependent when given any String value that does not conform to the Date Time
String Format (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-time-string-format">20.3.1.15</a>) and that could not be produced in that implementation
by the <code>toString</code> or <code>toUTCString</code> method.</p>
</section>
<section id="sec-date.prototype">
<h1><span class="secnum" id="sec-20.3.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype" title="link to this section">20.3.3.3</a></span>
Date.prototype</h1>
<p>The initial value of <code>Date.prototype</code> is the built-in Date prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">20.3.4</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-date.utc">
<h1><span class="secnum" id="sec-20.3.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.utc" title="link to this section">20.3.3.4</a></span>
Date.UTC ( year, month [ , date [ , hours [ , minutes [ , seconds [ , ms ] ] ] ] ] )</h1>
<p>When the <code>UTC</code> function is called with fewer than two arguments, the behaviour is implementation-dependent.
When the <code>UTC</code> function is called with two to seven arguments, it computes the date from <var>year</var>,
<var>month</var> and (optionally) <var>date</var>, <var>hours</var>, <var>minutes</var>, <var>seconds</var> and
<var>ms</var>. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>year</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>y</i>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>month</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>m</i>).</li>
<li>If <i>date</i> is supplied then let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>); else let
<i>dt</i> be <b>1</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>dt</i>).</li>
<li>If <i>hours</i> is supplied then let <i>h</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>hours</i>); else let
<i>h</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>h</i>).</li>
<li>If <i>minutes</i> is supplied then let <i>min</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>minutes</i>); else let
<i>min</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>min</i>).</li>
<li>If <i>seconds</i> is supplied then let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>seconds</i>); else let
<i>s</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>s</i>).</li>
<li>If <i>ms</i> is supplied then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>); else let
<i>milli</i> be <b>0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>milli</i>).</li>
<li>If&nbsp;<i>y</i>&nbsp;is&nbsp;not&nbsp;<b>NaN</b>&nbsp;and&nbsp;0&nbsp;≤&nbsp;<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>y</i>)&nbsp;≤&nbsp;99,&nbsp;then let <i>yr</i> be&nbsp;1900+<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>y</i>); otherwise, let <i>yr</i> be <i>y</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<i>yr</i>, <i>m</i>, <i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<i>h</i>,
<i>min</i>, <i>s</i>, <i>milli</i>))).</li>
</ol>
<p>The <code>length</code> property of the <code>UTC</code> function is <b>7</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <span style="font-family: monospace">UTC</span> function differs from the <span style="font-family: monospace">Date</span> constructor in two ways: it returns a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> as a Number, rather than creating a Date object, and it interprets
the arguments in UTC rather than as local time.</p>
</div>
</section>
<section id="sec-date-@@create">
<h1><span class="secnum" id="sec-20.3.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-@@create" title="link to this section">20.3.3.5</a></span>
Date[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%DatePrototype%"</code>, ( [[DateValue]])).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> [[DateValue]] is initially assigned the value <b>undefined</b> as a flag to indicate
that the instance has not yet been initialized by the Date constructor. This flag value is never directly exposed to
ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-date-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-20.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object" title="link to this section">20.3.4</a></span> Properties of the Date Prototype Object</h1>
<p>The Date prototype object is itself an ordinary object. It is not a Date instance and does not have a [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Date
prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">20.3.4</a>).</p>
<p>Unless explicitly defined otherwise, the methods of the Date prototype object defined below are not generic and the
<b>this</b> value passed to them must be an object that has a [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> that has been initialized to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a>.</p>
<p>The abstract operation <span style="font-family: Times New Roman">thisTimeValue(<i>value</i>)</span> performs the
following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value)</i> is Object and <i>value</i> has a
[[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>n</i> be the Number that is the value of <i>value’s</i> [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>n</i> is not <b>undefined</b>, then return <i>n</i>.</li>
</ol>
</li>
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<p>In following descriptions of functions that are properties of the Date prototype object, the phrase “this Date
object” refers to the object that is the <b>this</b> value for the invocation of the function. The phrase
“this <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a>” within the specification of a method refers to
the result returned by calling the abstract operation <span style="font-family: Times New Roman">thisTimeValue</span>
with the <b>this</b> value of the method invocation passed as the argument.</p>
</div>
<section id="sec-date.prototype.constructor">
<h1><span class="secnum" id="sec-20.3.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.constructor" title="link to this section">20.3.4.1</a></span> Date.prototype.constructor</h1>
<p>The initial value of <code>Date.prototype.constructor</code> is the built-in <code>Date</code> constructor.</p>
</section>
<section id="sec-date.prototype.getdate">
<h1><span class="secnum" id="sec-20.3.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getdate" title="link to this section">20.3.4.2</a></span> Date.prototype.getDate ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.getday">
<h1><span class="secnum" id="sec-20.3.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getday" title="link to this section">20.3.4.3</a></span> Date.prototype.getDay ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-week-day">WeekDay</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.getfullyear">
<h1><span class="secnum" id="sec-20.3.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getfullyear" title="link to this section">20.3.4.4</a></span> Date.prototype.getFullYear ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.gethours">
<h1><span class="secnum" id="sec-20.3.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.gethours" title="link to this section">20.3.4.5</a></span> Date.prototype.getHours ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.getmilliseconds">
<h1><span class="secnum" id="sec-20.3.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getmilliseconds" title="link to this section">20.3.4.6</a></span> Date.prototype.getMilliseconds ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.getminutes">
<h1><span class="secnum" id="sec-20.3.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getminutes" title="link to this section">20.3.4.7</a></span> Date.prototype.getMinutes ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.getmonth">
<h1><span class="secnum" id="sec-20.3.4.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getmonth" title="link to this section">20.3.4.8</a></span> Date.prototype.getMonth ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.getseconds">
<h1><span class="secnum" id="sec-20.3.4.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getseconds" title="link to this section">20.3.4.9</a></span> Date.prototype.getSeconds ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)).</li>
</ol>
</section>
<section id="sec-date.prototype.gettime">
<h1><span class="secnum" id="sec-20.3.4.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.gettime" title="link to this section">20.3.4.10</a></span> Date.prototype.getTime ( )</h1>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
</ol>
</section>
<section id="sec-date.prototype.gettimezoneoffset">
<h1><span class="secnum" id="sec-20.3.4.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.gettimezoneoffset" title="link to this section">20.3.4.11</a></span> Date.prototype.getTimezoneOffset ( )</h1>
<p>Returns the difference between local time and UTC time in minutes.</p>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return (<i>t</i> − <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)) / <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msPerMinute</a>.</li>
</ol>
</section>
<section id="sec-date.prototype.getutcdate">
<h1><span class="secnum" id="sec-20.3.4.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcdate" title="link to this section">20.3.4.12</a></span> Date.prototype.getUTCDate ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutcday">
<h1><span class="secnum" id="sec-20.3.4.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcday" title="link to this section">20.3.4.13</a></span> Date.prototype.getUTCDay ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-week-day">WeekDay</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutcfullyear">
<h1><span class="secnum" id="sec-20.3.4.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcfullyear" title="link to this section">20.3.4.14</a></span> Date.prototype.getUTCFullYear ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutchours">
<h1><span class="secnum" id="sec-20.3.4.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutchours" title="link to this section">20.3.4.15</a></span> Date.prototype.getUTCHours ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutcmilliseconds">
<h1><span class="secnum" id="sec-20.3.4.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcmilliseconds" title="link to this section">20.3.4.16</a></span> Date.prototype.getUTCMilliseconds ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutcminutes">
<h1><span class="secnum" id="sec-20.3.4.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcminutes" title="link to this section">20.3.4.17</a></span> Date.prototype.getUTCMinutes ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutcmonth">
<h1><span class="secnum" id="sec-20.3.4.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcmonth" title="link to this section">20.3.4.18</a></span> Date.prototype.getUTCMonth ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.getutcseconds">
<h1><span class="secnum" id="sec-20.3.4.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getutcseconds" title="link to this section">20.3.4.19</a></span> Date.prototype.getUTCSeconds ( )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>).</li>
</ol>
</section>
<section id="sec-date.prototype.setdate">
<h1><span class="secnum" id="sec-20.3.4.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setdate" title="link to this section">20.3.4.20</a></span> Date.prototype.setDate ( date )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>).</li>
<li>Let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>),
<i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>newDate</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
</section>
<section id="sec-date.prototype.setfullyear">
<h1><span class="secnum" id="sec-20.3.4.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setfullyear" title="link to this section">20.3.4.21</a></span> Date.prototype.setFullYear ( year [ , month [ , date ] ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>); but if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a> is <b>NaN</b>, let <i>t</i> be
<b>+0</b>.</li>
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>year</i>).</li>
<li>If <i>month</i> is not specified, then let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>);
otherwise, let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>month</i>).</li>
<li>If <i>date</i> is not specified, then let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>);
otherwise, let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<i>y</i>, <i>m</i>,
<i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>newDate</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setFullYear</code> method is <b>3</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>month</i> is not specified, this method behaves as if <i>month</i> were specified
with the value <code>getMonth()</code>. If <i>date</i> is not specified, it behaves as if <i>date</i> were specified
with the value <code>getDate()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.sethours">
<h1><span class="secnum" id="sec-20.3.4.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.sethours" title="link to this section">20.3.4.22</a></span> Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>).</li>
<li>Let <i>h</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>hour</i>).</li>
<li>If <i>min</i> is not specified, then let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>); otherwise, let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>min</i>).</li>
<li>If <i>sec</i> is not specified, then let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>); otherwise, let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>sec</i>).</li>
<li>If <i>ms</i> is not specified, then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>); otherwise, let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>).</li>
<li>Let <i>date</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<i>h</i>,
<i>m</i>, <i>s</i>, <i>milli</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>date</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setHours</code> method is <b>4</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>min</i> is not specified, this method behaves as if <i>min</i> were specified with
the value <code>getMinutes()</code>. If <i>sec</i> is not specified, it behaves as if <i>sec</i> were specified with the
value <code>getSeconds()</code>. If <i>ms</i> is not specified, it behaves as if <i>ms</i> were specified with the value
<code>getMilliseconds()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setmilliseconds">
<h1><span class="secnum" id="sec-20.3.4.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setmilliseconds" title="link to this section">20.3.4.23</a></span> Date.prototype.setMilliseconds ( ms )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>).</li>
<li>Let <i>time</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>),
<i>time</i>))).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
</section>
<section id="sec-date.prototype.setminutes">
<h1><span class="secnum" id="sec-20.3.4.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setminutes" title="link to this section">20.3.4.24</a></span> Date.prototype.setMinutes ( min [ , sec [ , ms ] ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>min</i>).</li>
<li>If <i>sec</i> is not specified, then let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>); otherwise, let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>sec</i>).</li>
<li>If <i>ms</i> is not specified, then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>); otherwise, let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>).</li>
<li>Let <i>date</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>), <i>m</i>, <i>s</i>,
<i>milli</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>date</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setMinutes</code> method is <b>3</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>sec</i> is not specified, this method behaves as if <i>sec</i> were specified with
the value <code>getSeconds()</code>. If <i>ms</i> is not specified, this behaves as if <i>ms</i> were specified with the
value <code>getMilliseconds()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setmonth">
<h1><span class="secnum" id="sec-20.3.4.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setmonth" title="link to this section">20.3.4.25</a></span> Date.prototype.setMonth ( month [ , date ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>month</i>).</li>
<li>If <i>date</i> is not specified, then let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>);
otherwise, let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t</i>), <i>m</i>, <i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>newDate</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setMonth</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>date</i> is not specified, this method behaves as if <i>date</i> were specified
with the value <code>getDate()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setseconds">
<h1><span class="secnum" id="sec-20.3.4.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setseconds" title="link to this section">20.3.4.26</a></span> Date.prototype.setSeconds ( sec [ , ms ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>).</li>
<li>Let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>sec</i>).</li>
<li>If <i>ms</i> is not specified, then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>); otherwise, let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>).</li>
<li>Let <i>date</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>), <i>s</i>, <i>milli</i>)).</li>
<li>Let <i>u</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<i>date</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>u</i>.</li>
<li>Return <i>u</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setSeconds</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>ms</i> is not specified, this method behaves as if <i>ms</i> were specified with
the value <code>getMilliseconds()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.settime">
<h1><span class="secnum" id="sec-20.3.4.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.settime" title="link to this section">20.3.4.27</a></span> Date.prototype.setTime ( time )</h1>
<ol class="proc">
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>time</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
</section>
<section id="sec-date.prototype.setutcdate">
<h1><span class="secnum" id="sec-20.3.4.28"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutcdate" title="link to this section">20.3.4.28</a></span> Date.prototype.setUTCDate ( date )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>),
<i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>newDate</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
</section>
<section id="sec-date.prototype.setutcfullyear">
<h1><span class="secnum" id="sec-20.3.4.29"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutcfullyear" title="link to this section">20.3.4.29</a></span> Date.prototype.setUTCFullYear ( year [ , month [ , date ] ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>; but if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a> is <b>NaN</b>, let <i>t</i> be
<b>+0</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>year</i>).</li>
<li>If <i>month</i> is not specified, then let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>);
otherwise, let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>month</i>).</li>
<li>If <i>date</i> is not specified, then let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>);
otherwise, let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<i>y</i>, <i>m</i>,
<i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>newDate</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setUTCFullYear</code> method is <b>3</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>month</i> is not specified, this method behaves as if <i>month</i> were specified
with the value <code>getUTCMonth()</code>. If <i>date</i> is not specified, it behaves as if <i>date</i> were specified
with the value <code>getUTCDate()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setutchours">
<h1><span class="secnum" id="sec-20.3.4.30"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutchours" title="link to this section">20.3.4.30</a></span> Date.prototype.setUTCHours ( hour [ , min [ , sec [ , ms ] ] ]
)</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>h</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>hour</i>).</li>
<li>If <i>min</i> is not specified, then let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>); otherwise, let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>min</i>).</li>
<li>If <i>sec</i> is not specified, then let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>); otherwise, let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>sec</i>).</li>
<li>If <i>ms</i> is not specified, then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>); otherwise, let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<i>h</i>,
<i>m</i>, <i>s</i>, <i>milli</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>newDate</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setUTCHours</code> method is <b>4</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>min</i> is not specified, this method behaves as if <i>min</i> were specified with
the value <code>getUTCMinutes()</code>. If <i>sec</i> is not specified, it behaves as if <i>sec</i> were specified with
the value <code>getUTCSeconds()</code>. If <i>ms</i> is not specified, it behaves as if <i>ms</i> were specified with
the value <code>getUTCMilliseconds()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setutcmilliseconds">
<h1><span class="secnum" id="sec-20.3.4.31"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutcmilliseconds" title="link to this section">20.3.4.31</a></span> Date.prototype.setUTCMilliseconds ( ms )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>time</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <i>time</i>)).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
</section>
<section id="sec-date.prototype.setutcminutes">
<h1><span class="secnum" id="sec-20.3.4.32"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutcminutes" title="link to this section">20.3.4.32</a></span> Date.prototype.setUTCMinutes ( min [ , sec [, ms ] ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>min</i>).</li>
<li>If <i>sec</i> is not specified, then let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">SecFromTime</a>(<i>t</i>); otherwise, let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>sec</i>).</li>
<li>If <i>ms</i> is not specified, then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>); otherwise, let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>).</li>
<li>Let <i>date</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>), <i>m</i>, <i>s</i>,
<i>milli</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>date</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setUTCMinutes</code> method is <b>3</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>sec</i> is not specified, this method behaves as if <i>sec</i> were specified with
the value <code>getUTCSeconds()</code>. If <i>ms</i> is not specified, it function behaves as if <i>ms</i> were
specified with the value return by <code>getUTCMilliseconds()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setutcmonth">
<h1><span class="secnum" id="sec-20.3.4.33"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutcmonth" title="link to this section">20.3.4.33</a></span> Date.prototype.setUTCMonth ( month [ , date ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>m</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>month</i>).</li>
<li>If <i>date</i> is not specified, then let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>);
otherwise, let <i>dt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>date</i>).</li>
<li>Let <i>newDate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<i>t</i>), <i>m</i>, <i>dt</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>newDate</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setUTCMonth</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>date</i> is not specified, this method behaves as if <i>date</i> were specified
with the value <code>getUTCDate()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.setutcseconds">
<h1><span class="secnum" id="sec-20.3.4.34"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setutcseconds" title="link to this section">20.3.4.34</a></span> Date.prototype.setUTCSeconds ( sec [ , ms ] )</h1>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>Let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>sec</i>).</li>
<li>If <i>ms</i> is not specified, then let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">msFromTime</a>(<i>t</i>); otherwise, let <i>milli</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>ms</i>).</li>
<li>Let <i>date</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">Day</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-maketime">MakeTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">HourFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hours-minutes-second-and-milliseconds">MinFromTime</a>(<i>t</i>), <i>s</i>, <i>milli</i>)).</li>
<li>Let <i>v</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>date</i>).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <i>v</i>.</li>
<li>Return <i>v</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>setUTCSeconds</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <i>ms</i> is not specified, this methold behaves as if <i>ms</i> were specified with
the value <code>getUTCMilliseconds()</code>.</p>
</div>
</section>
<section id="sec-date.prototype.todatestring">
<h1><span class="secnum" id="sec-20.3.4.35"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.todatestring" title="link to this section">20.3.4.35</a></span> Date.prototype.toDateString ( )</h1>
<p>This function returns a String value. The contents of the String are implementation-dependent, but are intended to
represent the “date” portion of the Date in the current time zone in a convenient, human-readable form.</p>
</section>
<section id="sec-date.prototype.toisostring">
<h1><span class="secnum" id="sec-20.3.4.36"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.toisostring" title="link to this section">20.3.4.36</a></span> Date.prototype.toISOString ( )</h1>
<p>This function returns a String value representing the instance in time corresponding to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>. The format of the String is the Date Time string
format defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-time-string-format">20.3.1.15</a>. All fields are present in the String. The time
zone is always UTC, denoted by the suffix Z. If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>
is not a finite Number or if the year is not a value that can be represented in that format (if necessary using extended
year format), a <b>RangeError</b> exception is thrown.</p>
</section>
<section id="sec-date.prototype.tojson">
<h1><span class="secnum" id="sec-20.3.4.37"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.tojson" title="link to this section">20.3.4.37</a></span> Date.prototype.toJSON ( key )</h1>
<p>This function provides a String representation of a Date object for use by <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.stringify">JSON.stringify</a></code> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.stringify">24.3.2</a>).</p>
<p>When the <code>toJSON</code> method is called with argument <var>key</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>, giving it the <b>this</b> value as its
argument.</li>
<li>Let <i>tv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive">ToPrimitive</a>(<i>O</i>, hint Number).</li>
<li>If <i>tv</i> is a Number and is not finite, return <b>null</b>.</li>
<li>Let <i>toISO</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"toISOString"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>toISO</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>toISO</i>) is <b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Return the result of calling the [[Call]] internal method of <i>toISO</i> with <i>O</i> as <i>thisArgument</i> and
an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as <i>argumentsList</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> The argument is ignored.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>toJSON</code> function is intentionally generic; it does not require that
its <b>this</b> value be a Date object. Therefore, it can be transferred to other kinds of objects for use as a method.
However, it does require that any such object have a <code>toISOString</code> method. An object is free to use the
argument <i>key</i> to filter its stringification.</p>
</div>
</section>
<section id="sec-date.prototype.tolocaledatestring">
<h1><span class="secnum" id="sec-20.3.4.38"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.tolocaledatestring" title="link to this section">20.3.4.38</a></span> Date.prototype.toLocaleDateString ( [ reserved1 [ , reserved2 ] ]
)</h1>
<p>An ECMAScript implementation that includes the ECMA-402 International API must implement the
<code>Date.prototype.toLocaleDateString</code> method as specified in the ECMA-402 specification. If an ECMAScript
implementation does not include the ECMA-402 API the following specification of the <code>toLocaleDateString</code>
method is used.</p>
<p>This function returns a String value. The contents of the String are implementation-dependent, but are intended to
represent the “date” portion of the Date in the current time zone in a convenient, human-readable form that
corresponds to the conventions of the host environment’s current locale.</p>
<p>The meaning of the optional parameters to this method are defined in the ECMA-402 specification; implementations that
do not include ECMA-402 support must not use those parameter position for anything else.</p>
<p>The <code>length</code> property of the <code>toLocaleDateString</code> method is <b>0</b>.</p>
</section>
<section id="sec-date.prototype.tolocalestring">
<h1><span class="secnum" id="sec-20.3.4.39"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.tolocalestring" title="link to this section">20.3.4.39</a></span> Date.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )</h1>
<p>An ECMAScript implementation that includes the ECMA-402 International API must implement the
<code>Date.prototype.toLocaleString</code> method as specified in the ECMA-402 specification. If an ECMAScript
implementation does not include the ECMA-402 API the following specification of the <code>toLocaleString</code> method is
used.</p>
<p>This function returns a String value. The contents of the String are implementation-dependent, but are intended to
represent the Date in the current time zone in a convenient, human-readable form that corresponds to the conventions of
the host environment’s current locale.</p>
<p>The meaning of the optional parameters to this method are defined in the ECMA-402 specification; implementations that
do not include ECMA-402 support must not use those parameter position for anything else.</p>
<p>The <code>length</code> property of the <code>toLocaleString</code> method is <b>0</b>.</p>
</section>
<section id="sec-date.prototype.tolocaletimestring">
<h1><span class="secnum" id="sec-20.3.4.40"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.tolocaletimestring" title="link to this section">20.3.4.40</a></span> Date.prototype.toLocaleTimeString ( [ reserved1 [ , reserved2 ] ]
)</h1>
<p>An ECMAScript implementation that includes the ECMA-402 International API must implement the
<code>Date.prototype.toLocaleTimeString</code> method as specified in the ECMA-402 specification. If an ECMAScript
implementation does not include the ECMA-402 API the following specification of the <code>toLocaleString</code> method is
used.</p>
<p>This function returns a String value. The contents of the String are implementation-dependent, but are intended to
represent the “time” portion of the Date in the current time zone in a convenient, human-readable form that
corresponds to the conventions of the host environment’s current locale.</p>
<p>The meaning of the optional parameters to this method are defined in the ECMA-402 specification; implementations that
do not include ECMA-402 support must not use those parameter position for anything else.</p>
<p>The <code>length</code> property of the <code>toLocaleTimeString</code> method is <b>0</b>.</p>
</section>
<section id="sec-date.prototype.tostring">
<div class="front">
<h1><span class="secnum" id="sec-20.3.4.41"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.tostring" title="link to this section">20.3.4.41</a></span> Date.prototype.toString ( )</h1>
<p>The following steps are performed:</p>
<ol class="proc">
<li>Let <i>tv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-todatestring">ToDateString</a>(<i>tv)</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> For any Date object <span style="font-family: monospace"><i>d</i></span> whose
milliseconds amount is zero, the result of <span style="font-family: monospace"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.parse">Date.parse</a>(<i>d</i>.toString())</span> is equal to <span style="font-family:
monospace"><i>d</i>.valueOf()</span>. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.parse">20.3.3.2</a>.</p>
</div>
</div>
<section id="sec-todatestring">
<h1><span class="secnum" id="sec-20.3.4.41.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-todatestring" title="link to this section">20.3.4.41.1</a></span> Runtime Semantics: ToDateString(tv) Abstract Operation</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>tv</i>) is Number.</li>
<li>If <i>tv</i> is NaN, then return <code>"Invalid Date"</code>.</li>
<li>Return an implementation-dependent String value that represents <i>tv</i> as a date and time in the current time
zone using a convenient, human-readable form.</li>
</ol>
</section>
</section>
<section id="sec-date.prototype.totimestring">
<h1><span class="secnum" id="sec-20.3.4.42"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.totimestring" title="link to this section">20.3.4.42</a></span> Date.prototype.toTimeString ( )</h1>
<p>This function returns a String value. The contents of the String are implementation-dependent, but are intended to
represent the “time” portion of the Date in the current time zone in a convenient, human-readable form.</p>
</section>
<section id="sec-date.prototype.toutcstring">
<h1><span class="secnum" id="sec-20.3.4.43"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.toutcstring" title="link to this section">20.3.4.43</a></span> Date.prototype.toUTCString ( )</h1>
<p>This function returns a String value. The contents of the String are implementation-dependent, but are intended to
represent <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a> in a convenient, human-readable form
in UTC.</p>
<div class="note">
<p><span class="nh">NOTE</span> The intent is to produce a String representation of a date that is more readable than
the format specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-time-string-format">20.3.1.15</a>. It is not essential that the chosen format
be unambiguous or easily machine parsable. If an implementation does not have a preferred human-readable format it is
recommended to use the format defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-time-string-format">20.3.1.15</a> but with a space rather
than a “<span style="font-family: monospace">T</span>” used to separate the date and time elements.</p>
</div>
</section>
<section id="sec-date.prototype.valueof">
<h1><span class="secnum" id="sec-20.3.4.44"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.valueof" title="link to this section">20.3.4.44</a></span> Date.prototype.valueOf ( )</h1>
<p>The <code>valueOf</code> function returns a Number, which is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</p>
</section>
<section id="sec-date.prototype-@@toprimitive">
<h1><span class="secnum" id="sec-20.3.4.45"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype-@@toprimitive" title="link to this section">20.3.4.45</a></span> Date.prototype [ @@toPrimitive ] ( hint )</h1>
<p>This function is called by ECMAScript language operators to convert an object to a primitive value. The allowed values
for <var>hint</var> are "<code>default</code>", "<code>number</code>", and "<code>string</code>". Date objects, are
unique among built-in ECMAScript object in that they treat "<code>default</code>" as being equivalent to
"<code>string</code>", All other built-in ECMAScript objects treat "<code>default</code>" as being equivalent to
"<code>number</code>".</p>
<p>When the <code>@@toPrimitive</code> method is called with argument <var>hint</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value<b>.</b></li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>hint</i> is the string value "<code>string</code>" or the string value "<code>default</code>" , then
<ol class="block">
<li>Let <i>tryFirst</i> be "<code>string</code>".</li>
</ol>
</li>
<li>Else if <i>hint</i> is the string value "<code>number</code>", then
<ol class="block">
<li>Let <i>tryFirst</i> be "<code>number</code>".</li>
</ol>
</li>
<li>Else, throw a <b>TypeError</b> exception.</li>
<li>Return the result of OrdinaryToPrimitive(<i>O</i>,<i>tryFirst</i>).</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.toPrimitive]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-date-instances">
<h1><span class="secnum" id="sec-20.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-date-instances" title="link to this section">20.3.5</a></span> Properties of Date Instances</h1>
<p>Date instances are ordinary objects that inherit properties from the Date prototype object. Date instances also have a
[[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. The [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-time-values-and-time-range">time value</a> represented by this Date object.</p>
</section>
</section>
</section>
<section id="sec-text-processing">
<div class="front">
<h1><span class="secnum" id="sec-21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-text-processing" title="link to this section">21</a></span> Text
Processing</h1>
</div>
<section id="sec-string-objects">
<div class="front">
<h1><span class="secnum" id="sec-21.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-objects" title="link to this section">21.1</a></span> String
Objects</h1>
</div>
<section id="sec-string-constructor">
<div class="front">
<h1><span class="secnum" id="sec-21.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-constructor" title="link to this section">21.1.1</a></span>
The String Constructor</h1>
<p>The String constructor is the %String% intrinsic object and the initial value of the <code>String</code> property of
the global object. When <code>String</code> is called as a function rather than as a constructor, it performs a type
conversion. However, if the <b>this</b> value passed in the call is an Object with an uninitialized [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, it initializes the <b>this</b> value using the
argument value. This permits <code>String</code> to be used both to perform type conversion and to perform constructor
instance initialisation.</p>
<p>The <code>String</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>String</code> behaviour must include a <code>super</code> call to the <code>String</code> constructor to initialize
the [[StringData]] state of subclass instances.</p>
</div>
<section id="sec-string-constructor-string-value">
<h1><span class="secnum" id="sec-21.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-constructor-string-value" title="link to this section">21.1.1.1</a></span> String ( value )</h1>
<p>When <code>String</code> is called with argument <var>value</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If no arguments were passed to this function invocation, then let <i>s</i> be <code>""</code>.</li>
<li>Else, let <i>s</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>s</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[StringData]] is
<b>undefined</b>, then
<ol class="block">
<li>Let <i>length</i> be the number of code unit elements in <i>s.</i></li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>O</i>,
<code>"length"</code>, PropertyDescriptor{[[Value]]: <i>length</i>, [[Writable]]: <b>false</b>, [[Enumerable]]:
<b>false</b>, [[Configurable]]: <b>false</b> }).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Set the value of <i>O’s</i> [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>s</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</li>
<li>Return <i>s</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>String</code> function is <b>1</b>.</p>
</section>
<section id="sec-new-string-argumentslist">
<h1><span class="secnum" id="sec-21.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-string-argumentslist" title="link to this section">21.1.1.2</a></span> new String ( ...argumentsList )</h1>
<p>When <code>String</code> is called as part of a new expression , it initializes a newly created exotic String
object:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>String</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>String</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-string-constructor">
<div class="front">
<h1><span class="secnum" id="sec-21.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-string-constructor" title="link to this section">21.1.2</a></span> Properties of the String Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
String constructor is the standard built-in Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), the String constructor has the following
properties:</p>
</div>
<section id="sec-string.fromcharcode">
<h1><span class="secnum" id="sec-21.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.fromcharcode" title="link to this section">21.1.2.1</a></span> String.fromCharCode ( ...codeUnits )</h1>
<p>The <code>String.fromCharCode</code> function may be called with a variable number of arguments which form the rest
parameter <var>codeUnits</var>. The following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>codeUnits</i> is a well-formed rest parameter object.</li>
<li>Let <i>length</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>codeUnits</i>,
<code>"length"</code>)<code>.</code></li>
<li>Let <i>elements</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>nextIndex</i> be 0.</li>
<li>Repeat while <i>nextIndex</i> &lt; <i>length</i>
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>codeUnits</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nextIndex</i>)).</li>
<li>Let <i>nextCU</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16">ToUint16</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextCU</i>).</li>
<li>Append <i>nextCU</i> to the end of <i>elements</i>.</li>
<li>Let <i>nextIndex</i> be <i>nextIndex</i> + 1.</li>
</ol>
</li>
<li>Return the String value whose elements are, in order, the elements in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>elements</i>. If <i>length</i> is 0, the empty string is
returned.</li>
</ol>
<p>The <code>length</code> property of the <code>fromCharCode</code> function is <b>1</b>.</p>
</section>
<section id="sec-string.fromcodepoint">
<h1><span class="secnum" id="sec-21.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.fromcodepoint" title="link to this section">21.1.2.2</a></span> String.fromCodePoint ( ...codePoints )</h1>
<p>The <code>String.fromCodePoint</code> function may be called with a variable number of arguments which form the rest
parameter <var>codePoints</var>. The following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>codePoints</i> is a well-formed rest parameter object.</li>
<li>Let <i>length</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>codePoints</i>,
<code>"length"</code>)<code>.</code></li>
<li>Let <i>elements</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>nextIndex</i> be 0.</li>
<li>Repeat while <i>nextIndex</i> &lt; <i>length</i>
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>codePoints</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nextIndex</i>)).</li>
<li>Let <i>nextCP</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextCP</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>nextCP</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>nextCP</i>))
is <b>false</b>, then throw a <b>RangeError</b> exception.</li>
<li>If <i>nextCP</i> &lt; 0 or <i>nextCP</i> &gt; 0x10FFFF, then throw a <b>RangeError</b> exception.</li>
<li>Append the elements of the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of
<i>nextCP</i> to the end of <i>elements</i>.</li>
<li>Let <i>nextIndex</i> be <i>nextIndex</i> + 1.</li>
</ol>
</li>
<li>Return the String value whose elements are, in order, the elements in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>elements</i>. If <i>length</i> is 0, the empty string is
returned.</li>
</ol>
<p>The <code>length</code> property of the <code>fromCodePoint</code> function is <b>1</b>.</p>
</section>
<section id="sec-string.prototype">
<h1><span class="secnum" id="sec-21.1.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype" title="link to this section">21.1.2.3</a></span> String.prototype</h1>
<p>The initial value of <code>String.prototype</code> is the standard built-in String prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-string-prototype-object">21.1.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-string.raw">
<h1><span class="secnum" id="sec-21.1.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.raw" title="link to this section">21.1.2.4</a></span>
String.raw ( callSite [ , ...substitutions ] )</h1>
<p>The <code>String.raw</code> function may be called with a variable number of arguments. The first argument is
<var>callSite</var> and the remainder of the arguments form the rest parameter <var>substitutions</var>. The following
steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>substitutions</i> is a well-formed rest parameter object.</li>
<li>Let <i>cooked</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>callSite</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>cooked</i>).</li>
<li>Let <i>rawValue</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>cooked</i>,
<code>"raw"</code>)<code>.</code></li>
<li>Let <i>raw</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>rawValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>raw</i>).</li>
<li>Let <i>len</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>raw</i>, <code>"length"</code>)<code>.</code></li>
<li>Let <i>literalSegments</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>literalSegments</i>).</li>
<li>If <i>literalSegments</i> ≤ 0, then return the empty string.</li>
<li>Let <i>stringElements</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>nextIndex</i> be 0.</li>
<li>Repeat
<ol class="block">
<li>Let <i>nextKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nextIndex</i>).</li>
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>raw</i>, <i>nextKey</i>).</li>
<li>Let <i>nextSeg</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextSeg</i>).</li>
<li>Append in order the code unit elements of <i>nextSeg</i> to the end of <i>stringElements</i>.</li>
<li>If <i>nextIndex</i> + 1 = <i>literalSegments</i>, then
<ol class="block">
<li>Return the string value whose elements are, in order, the elements in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>stringElements</i>. If <i>length</i> is 0, the
empty string is returned.</li>
</ol>
</li>
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>substitutions</i>, <i>nextKey</i>).</li>
<li>Let <i>nextSub</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextSub</i>).</li>
<li>Append in order the code unit elements of <i>nextSub</i> to the end of <i>stringElements</i>.</li>
<li>Let <i>nextIndex</i> be <i>nextIndex</i> + 1.</li>
</ol>
</li>
</ol>
<p>The <code>length</code> property of the <code>raw</code> function is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> String.raw is intended for use as a tag function of a Tagged Template String (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tagged-templates">12.3.7</a>). When called as such the first argument will be a well formed template call
site object and the rest parameter will contain the substitution values.</p>
</div>
</section>
<section id="sec-string-@@create">
<h1><span class="secnum" id="sec-21.1.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-@@create" title="link to this section">21.1.2.5</a></span>
String[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>proto</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%StringPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-stringcreate">StringCreate</a> (<i>proto</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> [[StringData]] is initially assigned the value <b>undefined</b> as a flag to indicate
that the instance has not yet been initialized by the String constructor. This flag value is never directly exposed to
ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-string-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-21.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-string-prototype-object" title="link to this section">21.1.3</a></span> Properties of the String Prototype Object</h1>
<p>The String prototype object is itself an ordinary object. It is not a String instance and does not have a
[[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
String prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>Unless explicitly stated otherwise, the methods of the String prototype object defined below are not generic and the
<b>this</b> value passed to them must be either a String value or an object that has a [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> that has been initialized to a String value.</p>
<p>The abstract operation <span style="font-family: Times New Roman">thisStringValue(<i>value</i>)</span> performs the
following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is String, return <i>value</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value)</i> is Object and <i>value</i> has a
[[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>s</i> be the value of <i>value’s</i> [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>s</i> is not <b>undefined</b>, then return <i>s</i>.</li>
</ol>
</li>
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
<p>The phrase “this String value” within the specification of a method refers to the result returned by
calling the abstract operation <span style="font-family: Times New Roman">thisStringValue</span> with the <b>this</b>
value of the method invocation passed as the argument.</p>
</div>
<section id="sec-string.prototype.charat">
<h1><span class="secnum" id="sec-21.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.charat" title="link to this section">21.1.3.1</a></span> String.prototype.charAt ( pos )</h1>
<div class="note">
<p><span class="nh">NOTE</span> Returns a single element String containing the code unit at element position <i>pos</i>
in the String value resulting from converting this object to a String. If there is no element at that position, the
result is the empty String. The result is a String value, not a String object.</p>
<p>If <i>pos</i> is a value of Number type that is an integer, then the result of
<code>x.charAt(</code><i>pos</i><code>)</code> is equal to the result of
<code>x.substring(</code><i>pos</i><code>,</code> <i>pos</i><code>+1)</code>.</p>
</div>
<p>When the <code>charAt</code> method is called with one argument <var>pos</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>position</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>pos</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>position</i>).</li>
<li>Let <i>size</i> be the number of elements in <i>S</i>.</li>
<li>If <i>position</i> &lt; 0 or <i>position</i> ≥ <i>size</i>, return the empty String.</li>
<li>Return a String of length 1, containing one code unit from <i>S</i>, namely the code unit at position
<i>position</i>, where the first (leftmost) code unit in <i>S</i> is considered to be at position 0, the next one at
position 1, and so on.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>charAt</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.charcodeat">
<h1><span class="secnum" id="sec-21.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.charcodeat" title="link to this section">21.1.3.2</a></span> String.prototype.charCodeAt ( pos )</h1>
<div class="note">
<p><span class="nh">NOTE</span> Returns a Number (a nonnegative integer less than 2<sup>16</sup>) that is the code unit
value of the string element at position <i>pos</i> in the String resulting from converting this object to a String. If
there is no element at that position, the result is <b>NaN</b>.</p>
</div>
<p>When the <code>charCodeAt</code> method is called with one argument <var>pos</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>position</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>pos</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>position</i>).</li>
<li>Let <i>size</i> be the number of elements in <i>S</i>.</li>
<li>If <i>position</i> &lt; 0 or <i>position</i> ≥ <i>size</i>, return <b>NaN</b>.</li>
<li>Return a value of Number type, whose value is the code unit value of the element at position <i>position</i> in the
String <i>S</i>, where the first (leftmost) element in <i>S</i> is considered to be at position 0, the next one at
position 1, and so on.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>charCodeAt</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.codepointat">
<h1><span class="secnum" id="sec-21.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.codepointat" title="link to this section">21.1.3.3</a></span> String.prototype.codePointAt ( pos )</h1>
<div class="note">
<p><span class="nh">NOTE</span> Returns a nonnegative integer Number less than 1114112 (0x110000) that is the UTF-16
encoded code point value starting at the string element at position <i>pos</i> in the String resulting from converting
this object to a String. If there is no element at that position, the result is <b>undefined</b>. If a valid UTF-16
surrogate pair does not begin at <i>pos</i>, the result is the code unit at <i>pos</i>.</p>
</div>
<p>When the <code>codePointAt</code> method is called with one argument <var>pos</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>position</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>pos</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>position</i>).</li>
<li>Let <i>size</i> be the number of elements in <i>S</i>.</li>
<li>If <i>position</i> &lt; 0 or <i>position</i> ≥ <i>size</i>, return <b>undefined</b>.</li>
<li>Let <i>first</i> be the code unit value of the element at index <i>position</i> in the String <i>S</i>.</li>
<li>If <i>first</i> &lt; 0xD800 or <i>first</i> &gt; 0xDBFF or <i>position</i>+1 = <i>size</i>, then return
<i>first</i>.</li>
<li>Let <i>second</i> be the code unit value of the element at index <i>position</i>+1 in the String <i>S</i>.</li>
<li>If <i>second</i> &lt; 0xDC00 or <i>second</i> &gt; 0xDFFF, then return <i>first</i>.</li>
<li>Return ((<i>first</i> – 0xD800) × 1024) + (<i>second</i> – 0xDC00) + 0x10000.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>codePointAt</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.concat">
<h1><span class="secnum" id="sec-21.1.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.concat" title="link to this section">21.1.3.4</a></span> String.prototype.concat ( ...args )</h1>
<div class="note">
<p><span class="nh">NOTE</span> When the <code>concat</code> method is called it returns a String consisting of the
string elements of this object (converted to a String) followed by the string elements of each of the arguments
converted to a String. The result is a String value, not a String object.</p>
</div>
<p>When the <code>concat</code> method is called with zero or more arguments the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>args</i> is a well-formed rest parameter object.</li>
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>args</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is a copy of the argument list
passed to this function.</li>
<li>Let <i>R</i> be <i>S</i>.</li>
<li>Repeat, while <i>args</i> is not empty
<ol class="block">
<li>Remove the first element from <i>args</i> and let <i>next</i> be the value of that element.</li>
<li>Let <i>nextString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>next</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextString</i>).</li>
<li>Let <i>R</i> be the String value consisting of the string elements in the previous value of <i>R</i> followed by
the string elements of <i>nextString</i>.</li>
</ol>
</li>
<li>Return <i>R</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>concat</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>concat</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
</div>
</section>
<section id="sec-string.prototype.constructor">
<h1><span class="secnum" id="sec-21.1.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.constructor" title="link to this section">21.1.3.5</a></span> String.prototype.constructor</h1>
<p>The initial value of <code>String.prototype.constructor</code> is the built-in <code>String</code> constructor.</p>
</section>
<section id="sec-string.prototype.contains">
<h1><span class="secnum" id="sec-21.1.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.contains" title="link to this section">21.1.3.6</a></span> String.prototype.contains ( searchString [ , position ] )</h1>
<p>The <b>contains</b> method takes two arguments, <i>searchString</i> and <i>position</i>, and performs the following
steps:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>searchString</i>) is Object, then
<ol class="block">
<li>Let <i>isRegExp</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>searchString</i>, @@isRegExp).</li>
<li>If <i>isRegExp</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>searchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>searchStr</i>).</li>
<li>Let <i>pos</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>position</i>). (If <i>position</i> is <b>undefined</b>,
this step produces the value <b>0</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>pos</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>start</i> be min(max(<i>pos</i>, 0), <i>len</i>).</li>
<li>Let <i>searchLen</i> be the number of elements in <i>searchStr</i>.</li>
<li>If there exists any integer <i>k</i> not smaller than <i>start</i> such that <i>k</i> + <i>searchLen</i> is not
greater than <i>len</i>, and for all nonnegative integers <i>j</i> less than <i>searchLen</i>, the character at
position <i>k</i>+<i>j</i> of <i>S</i> is the same as the character at position <i>j</i> of <i>searchStr,</i> return
<b>true</b>; but if there is no such integer <i>k</i>, return <b>false</b>.</li>
</ol>
<p>The <b>length</b> property of the <b>contains</b> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> If <i>searchString</i> appears as a substring of the result of converting this object
to a String, at one or more positions that are greater than or equal to <i>position</i>, then return <b>true</b>;
otherwise, returns <b>false</b>. If <i>position</i> is <b>undefined</b>, 0 is assumed, so as to search all of the
String.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Throwing an exception if the first argument is a RegExp is specified in order to allow
future editions to define extends that allow such argument values.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> The <code>contains</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.endswith">
<h1><span class="secnum" id="sec-21.1.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.endswith" title="link to this section">21.1.3.7</a></span> String.prototype.endsWith ( searchString [ , endPosition] )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>searchString</i>) is Object, then
<ol class="block">
<li>Let <i>isRegExp</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>searchString</i>, @@isRegExp).</li>
<li>If <i>isRegExp</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>searchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>searchStr</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>If <i>endPosition</i> is <b>undefined</b>, let <i>pos</i> be <i>len</i>, else let <i>pos</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>endPosition</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>pos</i>).</li>
<li>Let <i>end</i> be min(max(<i>pos</i>, 0), <i>len</i>).</li>
<li>Let <i>searchLength</i> be the number of elements in <i>searchStr</i>.</li>
<li>Let <i>start</i> be <i>end</i> - <i>searchLength</i>.</li>
<li>If <i>start</i> is less than 0, return <b>false</b><i>.</i></li>
<li>If the <i>searchLength</i> sequence of elements of <i>S</i> starting at <i>start</i> is the same as the full element
sequence of <i>searchStr</i>, return <b>true</b>.</li>
<li>Otherwise, return <b>false</b>.</li>
</ol>
<p>The <b>length</b> property of the <b>endsWith</b> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> Returns <b>true</b> if the sequence of elements of <i>searchString</i> converted to a
String is the same as the corresponding elements of this object (converted to a String) starting at <i>endPosition</i>
– length(this). Otherwise returns <b>false</b>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Throwing an exception if the first argument is a RegExp is specified in order to allow
future editions to define extends that allow such argument values.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> The <b>endsWith</b> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.indexof">
<h1><span class="secnum" id="sec-21.1.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.indexof" title="link to this section">21.1.3.8</a></span> String.prototype.indexOf ( searchString [ , position ] )</h1>
<div class="note">
<p><span class="nh">NOTE</span> If <i>searchString</i> appears as a substring of the result of converting this object to
a String, at one or more positions that are greater than or equal to <i>position</i>, then the index of the smallest
such position is returned; otherwise, <code>‑1</code> is returned. If <i>position</i> is <b>undefined</b>, 0 is
assumed, so as to search all of the String.</p>
</div>
<p>The <code>indexOf</code> method takes two arguments, <var>searchString</var> and <var>position</var>, and performs the
following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>searchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>searchString</i>).</li>
<li>Let <i>pos</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>position</i>). (If <i>position</i> is <b>undefined</b>,
this step produces the value <code>0</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>pos</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>start</i> be min(max(<i>pos</i>, 0), <i>len</i>).</li>
<li>Let <i>searchLen</i> be the number of elements in <i>searchStr</i>.</li>
<li>Return the smallest possible integer <i>k</i> not smaller than <i>start</i> such that <i>k</i>+ <i>searchLen</i> is
not greater than <i>len</i>, and for all nonnegative integers <i>j</i> less than <i>searchLen</i>, the code unit at
position <i>k</i>+<i>j</i> of <i>S</i> is the same as the code unit at position <i>j</i> of <i>searchStr</i>; but if
there is no such integer <i>k</i>, then return the value <code>-1</code><span style="font-family:
sans-serif">.</span></li>
</ol>
<p>The <code>length</code> property of the <code>indexOf</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>indexOf</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.lastindexof">
<h1><span class="secnum" id="sec-21.1.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.lastindexof" title="link to this section">21.1.3.9</a></span> String.prototype.lastIndexOf ( searchString [ , position ] )</h1>
<div class="note">
<p><span class="nh">NOTE</span> If <i>searchString</i> appears as a substring of the result of converting this object to
a String at one or more positions that are smaller than or equal to <i>position</i>, then the index of the greatest such
position is returned; otherwise, <code>‑1</code> is returned. If <i>position</i> is <b>undefined</b>, the length
of the String value is assumed, so as to search all of the String.</p>
</div>
<p>The <code>lastIndexOf</code> method takes two arguments, <var>searchString</var> and <var>position</var>, and performs
the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>searchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>searchString</i>).</li>
<li>Let <i>numPos</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>position</i>). (If <i>position</i> is <b>undefined</b>,
this step produces the value <b>NaN</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>numPos</i>).</li>
<li>If <i>numPos</i> is <b>NaN</b>, let <i>pos</i> be <b>+∞</b>; otherwise, let <i>pos</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>numPos</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>start</i> be min(max(<i>pos</i>, 0), <i>len</i>).</li>
<li>Let <i>searchLen</i> be the number of elements in <i>searchStr</i>.</li>
<li>Return the largest possible nonnegative integer <i>k</i> not larger than <i>start</i> such that <i>k</i>+
<i>searchLen</i> is not greater than <i>len</i>, and for all nonnegative integers <i>j</i> less than
<i>searchLen</i>, the code unit at position <i>k</i>+<i>j</i> of <i>S</i> is the same as the code unit at position
<i>j</i> of <i>searchStr</i>; but if there is no such integer <i>k</i>, then return the value <code>-1</code>.</li>
</ol>
<p>The <code>length</code> property of the <code>lastIndexOf</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>lastIndexOf</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.localecompare">
<h1><span class="secnum" id="sec-21.1.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.localecompare" title="link to this section">21.1.3.10</a></span> String.prototype.localeCompare ( that [, reserved1 [ , reserved2 ] ]
)</h1>
<p>An ECMAScript implementation that includes the ECMA-402 International API must implement the <code>localeCompare</code>
method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the
following specification of the <code>localeCompare</code> method is used.</p>
<p>When the <code>localeCompare</code> method is called with argument <var>that</var>, it returns a Number other than
<b>NaN</b> that represents the result of a locale-sensitive String comparison of the <b>this</b> value (converted to a
String) with <var>that</var> (converted to a String). The two Strings are <var>S</var> and <span class="nt">That</span>.
The two Strings are compared in an implementation-defined fashion. The result is intended to order String values in the
sort order specified by the system default locale, and will be negative, zero, or positive, depending on whether
<var>S</var> comes before <span class="nt">That</span> in the sort order, the Strings are equal, or <var>S</var> comes
after <span class="nt">That</span> in the sort order, respectively.</p>
<p>Before perform the comparisons the following steps are performed to prepare the Strings:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>That</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>that</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>That</i>).</li>
</ol>
<p>The meaning of the optional second and third parameters to this method are defined in the ECMA-402 specification;
implementations that do not include ECMA-402 support must not assign any other interpretation to those parameter
position.</p>
<p>The <code>localeCompare</code> method, if considered as a function of two arguments <b>this</b> and <var>that</var>, is
a consistent comparison function (as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">22.1.3.24</a>) on the set of all
Strings.</p>
<p>The actual return values are implementation-defined to permit implementers to encode additional information in the
value, but the function is required to define a total ordering on all Strings. If the implementation performs
language-sensitive comparisions it must return <code>0</code> when comparing Strings that are considered canonically
equivalent by the Unicode standard.</p>
<p>If no language-sensitive comparison at all is available from the host environment, this function may perform a bitwise
comparison.</p>
<p>The <code>length</code> property of the <code>localeCompare</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The <code>localeCompare</code> method itself is not directly suitable as an argument
to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">Array.prototype.sort</a></code> because the latter requires a function of
two arguments.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> This function is intended to rely on whatever language-sensitive comparison
functionality is available to the ECMAScript environment from the host environment, and to compare according to the
rules of the host environment’s current locale. This function must treat Strings that are canonically equivalent
according to the Unicode standard as identical. It is also recommended that this function not honour Unicode
compatibility equivalences or decompositions. For a definition and discussion of canonical equivalence see the Unicode
Standard, chapters 2 and 3, as well as Unicode Annex #15, Unicode Normalization Forms and Unicode Technical Note #5
Canonical Equivalence in Applications. Also see Unicode Technical Stardard #10, Unicode Collation Algorithm.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> The <code>localeCompare</code> function is intentionally generic; it does not require
that its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.match">
<h1><span class="secnum" id="sec-21.1.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.match" title="link to this section">21.1.3.11</a></span> String.prototype.match ( regexp )</h1>
<p>When the <code>match</code> method is called with argument <var>regexp</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>regexp</i>) is Object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>regexp</i>, @@isRegExp) is <b>true</b>, then let <i>rx</i> be
<i>regexp</i>;</li>
<li>Else, let <i>rx</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpcreate">RegExpCreate</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-the-regexp-constructor">21.2.3.3</a>) with arguments <i>regexp</i> and
<b>undefined</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rx</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>rx</i>, <code>"match"</code>, ( <i>S</i> )). <i>.</i></li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>match</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.normalize">
<h1><span class="secnum" id="sec-21.1.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.normalize" title="link to this section">21.1.3.12</a></span> String.prototype.normalize ( [ form ] )</h1>
<p>When the <code>normalize</code> method is called with one argument <var>form</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>If <i>form</i> is not provided or <b>undefined</b> let <i>form</i> be <span style="font-family:
monospace"><b>"</b>NFC<b>"</b></span>.</li>
<li>Let <i>f</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>form</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>f</i>).</li>
<li>If <i>f</i> is not one of <span style="font-family: monospace"><b>"</b>NFC<b>"</b></span>, <span style="font-family:
monospace"><b>"</b>NFD<b>"</b></span>, <span style="font-family: monospace"><b>"</b>NFKC<b>"</b></span>, or <span style="font-family: monospace"><b>"</b>NFKD<b>"</b></span>, then throw a <b>RangeError</b> Exception.</li>
<li>Let <i>ns</i> be the String value is the result of normalizing <i>S</i> into the normalization form named by
<i>f</i> as specified in <i>Unicode Standard Annex #15, UnicodeNormalizatoin Forms</i>.</li>
<li>Return <i>ns</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>normalize</code> method is <b>0</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>normalize</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.repeat">
<h1><span class="secnum" id="sec-21.1.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.repeat" title="link to this section">21.1.3.13</a></span> String.prototype.repeat ( count )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>n</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>count</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>If <i>n</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>If <i>n</i> is +∞, then throw a <b>RangeError</b> exception.</li>
<li>Let <i>T</i> be a String value that is made from <i>n</i> copies of <i>S</i> appended together. If <i>n</i> is 0,
<i>T</i> is the empty String.</li>
<li>Return <i>T</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> This method creates a String consisting of the string elements of this object
(converted to String) repeated <i>count</i> time.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>repeat</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.replace">
<div class="front">
<h1><span class="secnum" id="sec-21.1.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.replace" title="link to this section">21.1.3.14</a></span> String.prototype.replace (searchValue, replaceValue )</h1>
<p>When the <code>replace</code> method is called with arguments <var>searchValue</var> and <var>replaceValue</var> the
following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>string</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>string</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>searchValue</i>) is Object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>searchValue</i>, @@isRegExp) is <b>true</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>searchValue</i>, <code>"replace"</code>, (<i>string</i>,
<i>replaceValue</i>)).</li>
</ol>
</li>
<li>Let <i>searchString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>searchString</i>).</li>
<li>Search <i>string</i> for the first occurrence of <i>searchString</i> and let <i>pos</i> be the index position
within <i>string</i> of the first code unit of the matched substring and let <i>matched</i> be
<i>searchString</i>. If no occurrences of <i>searchString</i> were found, return <i>string</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>replaceValue</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>replValue</i> be the result of calling the [[Call]] internal method of <i>replaceValue</i> passing
<b>undefined</b> as the <b>this</b> value and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
containing <i>matched</i>, <i>pos</i>, and <i>string</i> as the argument list.</li>
<li>Let <i>replStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>replValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>replStr</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>captures</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>replStr</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getreplacesubstitution">GetReplaceSubstitution</a>(<i>matched</i>, <i>string</i>, <i>pos</i>,
<i>captures</i>).</li>
</ol>
</li>
<li>Let <i>tailPos</i> be <i>pos</i> + the number of code units in <i>matched</i>.</li>
<li>Let <i>newString</i> be the String formed by concatenating the first <i>pos</i> code units of <i>string</i>,
<i>replStr</i>, and the trailing substring of <i>string</i> starting at index <i>tailPos</i>. If <i>pos</i> is 0,
the first element of the concatenation will be the empty String.</li>
<li>Return <i>newString</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>replace</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</div>
<section id="sec-getreplacesubstitution">
<h1><span class="secnum" id="sec-21.1.3.14.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getreplacesubstitution" title="link to this section">21.1.3.14.1</a></span> Runtime Semantics: GetReplaceSubstitution Abstract
Operation</h1>
<p>The abstract operation GetReplaceSubstitution(<var>matched</var>, <var>string</var>, <var>position</var>,
<var>captures</var>) performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>matched</i>) is String.</li>
<li>Let <i>matchLength</i> be the number of code units in <i>matched</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>string</i>) is String.</li>
<li>Let <i>stringLength</i> be the number of code units in <i>string</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>position</i> is a non-negative integer.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>position</i> ≤ <i>stringLength</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>captures</i> is a possibly empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of Strings.</li>
<li>Let <i>tailPos</i> be <i>position</i> + <i>matchLength</i>.</li>
<li>Let <i>m</i> be the number of elements in <i>captures</i>.</li>
<li>Let <i>result</i> be a String value derived from <i>matched</i> by replacing code unit elements in <i>matched</i>
by replacement text as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-40">Table 40</a>. These <code>$</code> replacements are done
left-to-right, and, once such a replacement is performed, the new replacement text is not subject to further
replacements.</li>
<li>Return <i>result</i>.</li>
</ol>
<figure>
<figcaption><span id="table-40">Table 40</span> — Replacement Text Symbol Substitutions</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Code units</th>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Unicode Characters</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Replacement text</th>
</tr>
<tr>
<td>0x0024, 0x0024</td>
<td><code>$$</code></td>
<td><code>$</code></td>
</tr>
<tr>
<td>0x0024, 0x0026</td>
<td><code>$&amp;</code></td>
<td><i>matched</i></td>
</tr>
<tr>
<td>0x0024, 0x0060</td>
<td><code>$`</code></td>
<td>If <i>position</i> is 0, the replacement is the empty String. Otherwise the replacement is the substring of <i>string</i> that starts at index 0 and whose last code point is at index <i>position</i> -1.</td>
</tr>
<tr>
<td>0x0024, 0x0027</td>
<td><code>$'</code></td>
<td>If <i>tailPos</i> ≥ <i>stringLength</i>, the replacement is the empty String. Otherwise the replacement is the substring of <i>string</i> that starts at index <i>tailPos</i> and continues to the end of <i>string</i>.</td>
</tr>
<tr>
<td>0x0024, N where<br>0x0031 ≤ N ≤ 0x0039</td>
<td><code>$n</code> <span style="font-family: Times New Roman">where</span> <code><br>n</code> <span style="font-family: Times New Roman">is one of</span> <code>1 2 3 4 5 6 7 8 9</code> <span style="font-family: Times New Roman">and</span> <code>$n</code> <span style="font-family: Times New Roman">is not followed by a decimal digit</span></td>
<td>The <i>n</i><sup>th</sup> element of <i>captures</i>, where <i>n</i> is a single digit in the range 1 to 9. If <i>n</i>≤<i>m</i> and the <i>n</i>th element of <i>captures</i> is <b>undefined</b>, use the empty String instead. If <i>n</i>&gt;<i>m</i>, the result is implementation-defined.</td>
</tr>
<tr>
<td>0x0024, N, N where<br>0x0030 ≤ N ≤ 0x0039</td>
<td><code>$nn</code> <span style="font-family: Times New Roman">where</span> <code><br>n</code> <span style="font-family: Times New Roman">is one of</span> <code>0 1 2 3 4 5 6 7 8 9</code></td>
<td>The <i>nn</i><sup>th</sup> elemet of <i>captures</i>, where <i>nn</i> is a two-digit decimal number in the range 01 to 99. If <i>nn</i>≤<i>m</i> and the <i>nn</i><sup>th</sup> element of <i>captures</i> is <b>undefined</b>, use the empty String instead. If <i>nn</i> is 00 or <i>nn</i>&gt;<i>m</i>, the result is implementation-defined.</td>
</tr>
<tr>
<td>0x0024</td>
<td><code>$</code> <span style="font-family: Times New Roman">in any context that does not match on of the above.</span></td>
<td><code>$</code></td>
</tr>
</tbody></table>
</figure>
</section>
</section>
<section id="sec-string.prototype.search">
<h1><span class="secnum" id="sec-21.1.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.search" title="link to this section">21.1.3.15</a></span> String.prototype.search ( regexp )</h1>
<p>When the search method is called with argument <var>regexp</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>string</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>string</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>regexp</i>) is Object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>regexp</i>, @@isRegExp) is <b>true</b> , then,
<ol class="block">
<li>Let <i>rx</i> be <i>regexp</i>;</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>rx</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpcreate">RegExpCreate</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-the-regexp-constructor">21.2.3.3</a>) with arguments <i>regexp</i> and
<b>undefined</b>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rx</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>rx</i>, <code>"search"</code>, (<i>string</i>)).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>search</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.slice">
<h1><span class="secnum" id="sec-21.1.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.slice" title="link to this section">21.1.3.16</a></span> String.prototype.slice ( start, end )</h1>
<p>The <code>slice</code> method takes two arguments, <var>start</var> and <var>end</var>, and returns a substring of the
result of converting this object to a String, starting from element position <var>start</var> and running to, but not
including, element position <var>end</var> (or through the end of the String if <var>end</var> is <b>undefined</b>). If
<var>start</var> is negative, it is treated as <span style="font-family: Times New
Roman"><i>sourceLength</i>+<i>start</i></span> where <var>sourceLength</var> is the length of the String. If
<var>end</var> is negative, it is treated as <span style="font-family: Times New
Roman"><i>sourceLength</i>+<i>end</i></span> where <var>sourceLength</var> is the length of the String. The result is a
String value, not a String object. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>intStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>intEnd</i> be <i>len</i>; else let <i>intEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li>If <i>intStart</i> is negative, let <i>from</i> be max(<i>len</i> + <i>intStart</i>,0); else let <i>from</i> be
min(<i>intStart</i>, <i>len</i>).</li>
<li>If <i>intEnd</i> is negative, let <i>to</i> be max(<i>len</i> + <i>intEnd</i>,0); else let <i>to</i> be
min(<i>intEnd</i>, <i>len</i>).</li>
<li>Let <i>span</i> be max(<i>to</i> – <i>from</i>,0).</li>
<li>Return a String value containing <i>span</i> consecutive elements from <i>S</i> beginning with the element at
position <i>from</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>slice</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>slice</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
</div>
</section>
<section id="sec-string.prototype.split">
<div class="front">
<h1><span class="secnum" id="sec-21.1.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.split" title="link to this section">21.1.3.17</a></span> String.prototype.split ( separator, limit )</h1>
<p>Returns an Array object into which substrings of the result of converting this object to a String have been stored.
The substrings are determined by searching from left to right for occurrences of <var>separator</var>; these occurrences
are not part of any substring in the returned array, but serve to divide up the String value. The value of
<var>separator</var> may be a String of any length or it may be a RegExp object.</p>
<p>When the <code>split</code> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>separator</i>) is Object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>separator</i>, @@isRegExp) is <b>true</b> , then,
<ol class="block">
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>separator</i>, <code>"split"</code>, (<i>O</i>,
<i>limit</i>))</li>
</ol>
</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>A</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a> with argument
0.</li>
<li>Let <i>lengthA</i> be 0.</li>
<li>If <i>limit</i> is <b>undefined</b>, let <i>lim</i> = 2<sup>53</sup>–1; else let <i>lim</i> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>limit</i>).</li>
<li>Let <i>s</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>p</i> = 0.</li>
<li>Let <i>R</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>separator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>R</i>).</li>
<li>If <i>lim</i> = 0, return <i>A</i>.</li>
<li>If <i>separator</i> is <b>undefined</b>, then
<ol class="block">
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>0</b>"</span>, <i>S</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Return <i>A</i>.</li>
</ol>
</li>
<li>If <i>s</i> = 0, then
<ol class="block">
<li>Let <i>z</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-splitmatch">SplitMatch</a>(<i>S</i>, 0, <i>R</i>).</li>
<li>If <i>z</i> is not <b>false</b>, return <i>A</i>.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>0</b>"</span>, <i>S</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Return <i>A</i>.</li>
</ol>
</li>
<li>Let <i>q</i> = <i>p</i>.</li>
<li>Repeat, while <i>q</i> ≠ <i>s</i>
<ol class="block">
<li>Let <i>e</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-splitmatch">SplitMatch</a>(<i>S, q, R</i>).</li>
<li>If <i>e</i> is <b>false</b>, then let <i>q</i> = <i>q</i>+1.</li>
<li>Else <i>e</i> is an integer index into <i>S</i>,
<ol class="block">
<li>If <i>e</i> = <i>p</i>, then let <i>q</i> = <i>q</i>+1.</li>
<li>Else <i>e</i> ≠ <i>p</i>,
<ol class="block">
<li>Let <i>T</i> be a String value equal to the substring of <i>S</i> consisting of the code units at
positions <i>p</i> (inclusive) through <i>q</i> (exclusive).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lengthA</i>), <i>T</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Increment <i>lengthA</i> by 1.</li>
<li>If <i>lengthA</i> = <i>lim</i>, return <i>A</i>.</li>
<li>Let <i>p</i> = <i>e</i>.</li>
<li>Let <i>q</i> = <i>p</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>T</i> be a String value equal to the substring of <i>S</i> consisting of the code units at positions
<i>p</i> (inclusive) through <i>s</i> (exclusive).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lengthA</i>), <i>T</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The above call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Return <i>A</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The value of <i>separator</i> may be an empty String, an empty regular expression, or
a regular expression that can match an empty String. In this case, <i>separator</i> does not match the empty substring
at the beginning or end of the input String, nor does it match the empty substring at the end of the previous
separator match. (For example, if <i>separator</i> is the empty String, the String is split up into individual code
unit elements; the length of the result array equals the length of the String, and each substring contains one code
unit.) If <i>separator</i> is a regular expression, only the first match at a given position of the <b>this</b> String
is considered, even if backtracking could yield a non-empty-substring match at that position. (For example,
<code>"ab".split(/a*?/)</code> evaluates to the array <code>["a","b"]</code>, while <code>"ab".split(/a*/)</code>
evaluates to the array<code>["","b"]</code>.)</p>
<p>If the <b>this</b> object is (or converts to) the empty String, the result depends on whether <i>separator</i> can
match the empty String. If it can, the result array contains no elements. Otherwise, the result array contains one
element, which is the empty String.</p>
<p>If <i>separator</i> is a regular expression that contains capturing parentheses, then each time <i>separator</i> is
matched the results (including any <b>undefined</b> results) of the capturing parentheses are spliced into the output
array. For&nbsp;example,</p>
<pre>"A&lt;B&gt;bold&lt;/B&gt;and&lt;CODE&gt;coded&lt;/CODE&gt;".split(/&lt;(\/)?([^&lt;&gt;]+)&gt;/)</pre>
<p>evaluates to the array</p>
<pre>["A", undefined, "B", "bold", "/", "B", "and", undefined,<br> "CODE", "coded", "/", "CODE", ""]</pre>
<p>If <i>separator</i> is <b>undefined</b>, then the result array contains just one String, which is the <b>this</b>
value (converted to a String). If <i>limit</i> is not <b>undefined</b>, then the output array is truncated so that it
contains no more than <i>limit</i> elements.</p>
</div>
</div>
<section id="sec-splitmatch">
<h1><span class="secnum" id="sec-21.1.3.17.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-splitmatch" title="link to this section">21.1.3.17.1</a></span> Runtime Semantics: SplitMatch Abstract Operation</h1>
<p>The abstract operation SplitMatch takes three parameters, a String <var>S</var>, an integer <var>q</var>, and a
String <var>R</var>, and performs the following in order to return either <b>false</b> or the end index of a match:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R</i>) must be String. Let <i>r</i> be the number of
code units in <i>R</i>.</li>
<li>Let <i>s</i> be the number of code units in <i>S</i>.</li>
<li>If <i>q</i>+<i>r</i> &gt; <i>s</i> then return <b>false</b>.</li>
<li>If there exists an integer <i>i</i> between 0 (inclusive) and <i>r</i> (exclusive) such that the code unit at
position <i>q</i>+<i>i</i> of <i>S</i> is different from the code unit at position <i>i</i> of <i>R</i>, then
return <b>false</b>.</li>
<li>Return <i>q</i>+<i>r</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>split</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE </span> The <code>split</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
</section>
<section id="sec-string.prototype.startswith">
<h1><span class="secnum" id="sec-21.1.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.startswith" title="link to this section">21.1.3.18</a></span> String.prototype.startsWith ( searchString [, position ] )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>searchString</i>) is Object, then</li>
<li>Let <i>isRegExp</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>searchString</i>, @@isRegExp).</li>
<li>If <i>isRegExp</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>searchString</i>) is Object, then
<ol class="block">
<li>Let <i>isRegExp</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>searchString</i>, @@isRegExp).</li>
<li>If <i>isRegExp</i> is <b>true</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>searchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchString</i>).</li>
<li>Let <i>searchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>searchString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>searchStr</i>).</li>
<li>Let <i>pos</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>position</i>). (If <i>position</i> is <b>undefined</b>,
this step produces the value <b>0</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>pos</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>start</i> be min(max(<i>pos</i>, 0), <i>len</i>).</li>
<li>Let <i>searchLength</i> be the number of elements in <i>searchStr</i>.</li>
<li>If <i>searchLength+start</i> is greater than <i>len</i>, return <b>false</b><i>.</i></li>
<li>If the <i>searchLength</i> sequence of elements of <i>S</i> starting at <i>start</i> is the same as the full element
sequence of <i>searchStr</i>, return <b>true</b>.</li>
<li>Otherwise, return <b>false</b>.</li>
</ol>
<p>The <b>length</b> property of the <b>startsWith</b> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> This method returns <b>true</b> if the sequence of elements of <i>searchString</i>
converted to a String is the same as the corresponding elements of this object (converted to a String) starting at
<i>position</i>. Otherwise returns <b>false</b>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Throwing an exception if the first argument is a RegExp is specified in order to allow
future editions to define extends that allow such argument values.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> The <b>startsWith</b> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.substring">
<h1><span class="secnum" id="sec-21.1.3.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.substring" title="link to this section">21.1.3.19</a></span> String.prototype.substring ( start, end )</h1>
<p>The <b>substring</b> method takes two arguments, <var>start</var> and <var>end</var>, and returns a substring of the
result of converting this object to a String, starting from element position <var>start</var> and running to, but not
including, element position <var>end</var> of the String (or through the end of the String is <var>end</var> is
<b>undefined</b>). The result is a String value, not a String object.</p>
<p>If either argument is <b>NaN</b> or negative, it is replaced with zero; if either argument is larger than the length of
the String, it is replaced with the length of the String.</p>
<p>If <var>start</var> is larger than <var>end</var>, they are swapped.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>len</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>intStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>intEnd</i> be <i>len</i>; else let <i>intEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li>Let <i>finalStart</i> be min(max(<i>intStart</i>, 0), <i>len</i>).</li>
<li>Let <i>finalEnd</i> be min(max(<i>intEnd</i>, 0), <i>len</i>).</li>
<li>Let <i>from</i> be min(<i>finalStart</i>, <i>finalEnd</i>).</li>
<li>Let <i>to</i> be max(<i>finalStart</i>, <i>finalEnd</i>).</li>
<li>Return a String whose length is <i>to</i> - <i>from</i>, containing code units from <i>S</i>, namely the code units
with indices <i>from</i> through <i>to</i> −1, in ascending order.</li>
</ol>
<p>The <code>length</code> property of the <code>substring</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>substring</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.tolocalelowercase">
<h1><span class="secnum" id="sec-21.1.3.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.tolocalelowercase" title="link to this section">21.1.3.20</a></span> String.prototype.toLocaleLowerCase ( )</h1>
<p>This function interprets a string value as a sequence of code points, as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a>.</p>
<p>This function works exactly the same as <code>toLowerCase</code> except that its result is intended to yield the
correct result for the host environment’s current locale, rather than a locale-independent result. There will only
be a difference in the few cases (such as Turkish) where the rules for that language conflict with the regular Unicode
case mappings.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The first parameter to this function is likely to be used in a future version of this
standard; it is recommended that implementations do not use this parameter position for anything else.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>toLocaleLowerCase</code> function is intentionally generic; it does not
require that its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for
use as a method.</p>
</div>
</section>
<section id="sec-string.prototype.tolocaleuppercase">
<h1><span class="secnum" id="sec-21.1.3.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.tolocaleuppercase" title="link to this section">21.1.3.21</a></span> String.prototype.toLocaleUpperCase ( )</h1>
<p>This function interprets a string value as a sequence of code points, as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a>.</p>
<p>This function works exactly the same as <code>toUpperCase</code> except that its result is intended to yield the
correct result for the host environment’s current locale, rather than a locale-independent result. There will only
be a difference in the few cases (such as Turkish) where the rules for that language conflict with the regular Unicode
case mappings.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The first parameter to this function is likely to be used in a future version of this
standard; it is recommended that implementations do not use this parameter position for anything else.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>toLocaleUpperCase</code> function is intentionally generic; it does not
require that its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for
use as a method.</p>
</div>
</section>
<section id="sec-string.prototype.tolowercase">
<h1><span class="secnum" id="sec-21.1.3.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.tolowercase" title="link to this section">21.1.3.22</a></span> String.prototype.toLowerCase ( )</h1>
<p>This function interprets a string value as a sequence of code points, as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a>. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>cpList</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing in order the code
points as defned in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a> of <i>S</i>, starting at the
first element of <i>S</i>.</li>
<li>For each code point <i>c</i> in <i>cpList</i>, if the Unicode Character Database provides a language insensitive
lower case equivalent of <i>c</i> then replace <i>c</i> in <i>cpList</i> with that equivalent code point(s).</li>
<li>Let <i>cuList</i> be a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each code point <i>c</i> in <i>cpList</i>, in order, append to <i>cuList</i> the elements of the UTF-16
Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of <i>c</i>.</li>
<li>Let <i>L</i> be a String whose elements are, in order, the elements of <i>cuList</i> .</li>
<li>Return <i>L</i>.</li>
</ol>
<p class="Note">The result must be derived according to the locale-insensitive case mappings in the Unicode Character
Database (this explicitly includes not only the UnicodeData.txt file, but also all locale-insensitive mappings in the
SpecialCasings.txt file that accompanies it).</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The case mapping of some code points may produce multiple code points . In this case
the result String may not be the same length as the source String. Because both <code>toUpperCase</code> and
<code>toLowerCase</code> have context-sensitive behaviour, the functions are not symmetrical. In other words,
<code>s.toUpperCase().toLowerCase()</code> is not necessarily equal to <code>s.toLowerCase()</code>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>toLowerCase</code> function is intentionally generic; it does not require
that its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.tostring">
<h1><span class="secnum" id="sec-21.1.3.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.tostring" title="link to this section">21.1.3.23</a></span> String.prototype.toString ( )</h1>
<p>When the <code>toString</code> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>s</i> be thisStringValue(<b>this</b> value).</li>
<li>Return <i>s</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> For a String object, the <code>toString</code> method happens to return the same thing
as the <code>valueOf</code> method.</p>
</div>
</section>
<section id="sec-string.prototype.touppercase">
<h1><span class="secnum" id="sec-21.1.3.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.touppercase" title="link to this section">21.1.3.24</a></span> String.prototype.toUpperCase ( )</h1>
<p>This function interprets a string value as a sequence of code points, as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a>.</p>
<p>This function behaves in exactly the same way as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.tolowercase">String.prototype.toLowerCase</a></code>, except that code points are mapped to
their <var>uppercase</var> equivalents as specified in the Unicode Character Database.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>toUpperCase</code> function is intentionally generic; it does not require that
its <b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.trim">
<h1><span class="secnum" id="sec-21.1.3.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.trim" title="link to this section">21.1.3.25</a></span> String.prototype.trim ( )</h1>
<p>This function interprets a string value as a sequence of code points, as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a>.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>T</i> be a String value that is a copy of <i>S</i> with both leading and trailing white space removed. The
definition of white space is the union of <i>WhiteSpace</i> and <i>LineTerminator</i>. When determining whether a
Unicode code point is in Unicode general category “Zs”, code unit sequences are interpreted as UTF-16
encoded code point sequences as specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-string-type">6.1.4</a>.</li>
<li>Return <i>T</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>trim</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore, it can be transferred to other kinds of objects for use as a
method.</p>
</div>
</section>
<section id="sec-string.prototype.valueof">
<h1><span class="secnum" id="sec-21.1.3.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.valueof" title="link to this section">21.1.3.26</a></span> String.prototype.valueOf ( )</h1>
<p>When the <code>valueOf</code> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>s</i> be thisStringValue(<b>this</b> value).</li>
<li>Return <i>s</i>.</li>
</ol>
</section>
<section id="sec-string.prototype-@@iterator">
<h1><span class="secnum" id="sec-21.1.3.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator" title="link to this section">21.1.3.27</a></span> String.prototype [ @@iterator ]( )</h1>
<p>When the @@iterator method is called it returns an Iterator object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface">25.1.2</a>) that
iterates over the code points of a String value, returning each code point as a String value. The following steps are
taken:</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createstringiterator">CreateStringIterator</a> abstract operation
with argument <i>S</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
</section>
<section id="sec-properties-of-string-instances">
<div class="front">
<h1><span class="secnum" id="sec-21.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-string-instances" title="link to this section">21.1.4</a></span> Properties of String Instances</h1>
<p>String instances are String exotic objects and have the internal methods specified for such objects. String instances
inherit properties from the String prototype object. String instances also have a [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>String instances have a <code>length</code> property, and a set of enumerable properties with integer indexed
names.</p>
</div>
<section id="sec-properties-of-string-instances-length">
<h1><span class="secnum" id="sec-21.1.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-string-instances-length" title="link to this section">21.1.4.1</a></span> length</h1>
<p>The number of elements in the String value represented by this String object.</p>
<p>Once a String object is initialized, this property is unchanging. It has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
</section>
</section>
<section id="sec-string-iterator-objects">
<div class="front">
<h1><span class="secnum" id="sec-21.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string-iterator-objects" title="link to this section">21.1.5</a></span> String Iterator Objects</h1>
<p>An String Iterator is an object, that represents a specific iteration over some specific String instance object. There
is not a named constructor for String Iterator objects. Instead, String iterator objects are created by calling certain
methods of String instance objects.</p>
</div>
<section id="sec-createstringiterator">
<h1><span class="secnum" id="sec-21.1.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createstringiterator" title="link to this section">21.1.5.1</a></span> CreateStringIterator Abstract Operation</h1>
<p>Several methods of String objects return Iterator objects. The abstract operation CreateStringIterator with argument
<var>string</var> is used to create such iterator objects. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>s</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>s</i>).</li>
<li>Let <i>iterator</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%StringIteratorPrototype%</span>, ([[IteratedStringt]], [[StringIteratorNextIndex]] )).</li>
<li>Set <i>iterator’s</i> [[IteratedString]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>s</i>.</li>
<li>Set <i>iterator’s</i> [[StringIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to 0.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-%stringiteratorprototype%-object">
<div class="front">
<h1><span class="secnum" id="sec-21.1.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%stringiteratorprototype%-object" title="link to this section">21.1.5.2</a></span> The %StringIteratorPrototype% Object</h1>
<p>All String Iterator Objects inherit properties from the %StringIteratorPrototype% intrinsic object. The
%StringIteratorPrototype% object is an ordinary object and its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the %ObjectPrototype% intrinsic object. In
addition, %StringIteratorPrototype% has the following properties:</p>
</div>
<section id="sec-%stringiteratorprototype%.next">
<h1><span class="secnum" id="sec-21.1.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%stringiteratorprototype%.next" title="link to this section">21.1.5.2.1</a></span> %StringIteratorPrototype%.next ( )</h1>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have all of the internal slots of an String Iterator Instance (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-string-iterator-instances">21.1.5.3</a>), throw a <b>TypeError</b> exception.</li>
<li>Let <i>s</i> be the value of the [[IteratedString]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>s</i> is <b>undefined</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
<li>Let <i>position</i> be the value of the [[StringIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>len</i> be the number of elements in <i>s</i>.</li>
<li>If <i>position</i> ≥ <i>len</i>, then
<ol class="block">
<li>Set the value of the [[IteratedString]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>O</i> to <b>undefined</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
</ol>
</li>
<li>Let <i>first</i> be the code unit value of the element at index <i>position</i> in <i>s</i>.</li>
<li>If <i>first</i> &lt; 0xD800 or <i>first</i> &gt; 0xDBFF or <i>position</i>+1 = <i>len</i>, then let
<i>resultString</i> be the string consisting of the single code unit <i>first</i>.</li>
<li>Else,
<ol class="block">
<li>Let <i>second</i> be the code unit value of the element at index <i>position</i>+1 in the String
<i>S</i>.</li>
<li>If <i>second</i> &lt; 0xDC00 or <i>second</i> &gt; 0xDFFF, then let <i>resultString</i> be the string
consisting of the single code unit <i>first</i>.</li>
<li>Else, let <i>resultString</i> be the string consisting of the code unit <i>first</i> followed by the code unit
<i>second</i>.</li>
</ol>
</li>
<li>Let <i>resultSize</i> be the number of code units in <i>resultString</i>.</li>
<li>Set the value of the [[StringIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to <i>position</i>+
<i>resultSize</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>resultString</i>, <b>false</b>).</li>
</ol>
</section>
<section id="sec-%stringiteratorprototype%-@@iterator">
<h1><span class="secnum" id="sec-21.1.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%stringiteratorprototype%-@@iterator" title="link to this section">21.1.5.2.2</a></span> %StringIteratorPrototype% [ @@iterator ] ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return the <b>this</b> value.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
<section id="sec-%stringiteratorprototype%.@@tostringtag">
<h1><span class="secnum" id="sec-21.1.5.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%stringiteratorprototype%.@@tostringtag" title="link to this section">21.1.5.2.3</a></span> %StringIteratorPrototype%.@@toStringTag</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family: monospace">String
Iterator</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-string-iterator-instances">
<h1><span class="secnum" id="sec-21.1.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-string-iterator-instances" title="link to this section">21.1.5.3</a></span> Properties of String Iterator Instances</h1>
<p>String Iterator instances are ordinary objects that inherit properties from the %StringIteratorPrototype% intrinsic
object. String Iterator instances are initially created with the internal slots listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-43">Table
43</a>.</p>
<figure>
<figcaption><span id="table-41">Table 41</span> — Internal Slots of String Iterator Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[IteratedString]]</td>
<td>The String value whose elements are being iterated.</td>
</tr>
<tr>
<td>[[StringIteratorNextIndex]]</td>
<td>The integer index of the next string index to be examined by this iteration.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-regexp-regular-expression-objects">
<div class="front">
<h1><span class="secnum" id="sec-21.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-regular-expression-objects" title="link to this section">21.2</a></span> RegExp (Regular Expression) Objects</h1>
<p>A RegExp object contains a regular expression and the associated flags.</p>
<div class="note">
<p><span class="nh">NOTE</span> The form and functionality of regular expressions is modelled after the regular expression
facility in the Perl&nbsp;5 programming language.</p>
</div>
</div>
<section id="sec-patterns">
<h1><span class="secnum" id="sec-21.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns" title="link to this section">21.2.1</a></span>
Patterns</h1>
<p>The <code>RegExp</code> constructor applies the following grammar to the input pattern String. An error occurs if the
grammar cannot interpret the String as an expansion of <span class="nt">Pattern</span>.</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">Pattern</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Disjunction</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Disjunction</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Alternative</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">Alternative</span><sub>[?U]</sub> <code class="t">|</code> <span class="nt">Disjunction</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Alternative</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">Alternative</span><sub>[?U]</sub> <span class="nt">Term</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Term</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Assertion</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">Atom</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">Atom</span><sub>[?U]</sub> <span class="nt">Quantifier</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Assertion</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><code class="t">^</code></div>
<div class="rhs"><code class="t">$</code></div>
<div class="rhs"><code class="t">\</code> <code class="t">b</code></div>
<div class="rhs"><code class="t">\</code> <code class="t">B</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">=</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">!</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Quantifier</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">QuantifierPrefix</span></div>
<div class="rhs"><span class="nt">QuantifierPrefix</span> <code class="t">?</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">*</code></div>
<div class="rhs"><code class="t">+</code></div>
<div class="rhs"><code class="t">?</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">,</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">,</code> <span class="nt">DecimalDigits</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Atom</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">PatternCharacter</span></div>
<div class="rhs"><code class="t">.</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">AtomEscape</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">CharacterClass</span><sub>[?U]</sub></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">:</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">SyntaxCharacter</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">^</code> <code class="t">$</code> <code class="t">\</code> <code class="t">.</code> <code class="t">*</code> <code class="t">+</code> <code class="t">?</code> <code class="t">(</code> <code class="t">)</code> <code class="t">[</code> <code class="t">]</code> <code class="t">{</code> <code class="t">}</code> <code class="t">|</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PatternCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">SyntaxCharacter</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AtomEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalEscape</span></div>
<div class="rhs"><span class="nt">CharacterEscape</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">CharacterClassEscape</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CharacterEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ControlEscape</span></div>
<div class="rhs"><code class="t">c</code> <span class="nt">ControlLetter</span></div>
<div class="rhs"><span class="nt">HexEscapeSequence</span></div>
<div class="rhs"><span class="nt">RegExpUnicodeEscapeSequence</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">IdentityEscape</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ControlEscape</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">f</code> <code class="t">n</code> <code class="t">r</code> <code class="t">t</code> <code class="t">v</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ControlLetter</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">g</code> <code class="t">h</code> <code class="t">i</code> <code class="t">j</code> <code class="t">k</code> <code class="t">l</code> <code class="t">m</code> <code class="t">n</code> <code class="t">o</code> <code class="t">p</code> <code class="t">q</code> <code class="t">r</code> <code class="t">s</code> <code class="t">t</code> <code class="t">u</code> <code class="t">v</code> <code class="t">w</code> <code class="t">x</code> <code class="t">y</code> <code class="t">z</code></div>
<div class="rhs"><code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code> <code class="t">G</code> <code class="t">H</code> <code class="t">I</code> <code class="t">J</code> <code class="t">K</code> <code class="t">L</code> <code class="t">M</code> <code class="t">N</code> <code class="t">O</code> <code class="t">P</code> <code class="t">Q</code> <code class="t">R</code> <code class="t">S</code> <code class="t">T</code> <code class="t">U</code> <code class="t">V</code> <code class="t">W</code> <code class="t">X</code> <code class="t">Y</code> <code class="t">Z</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">RegExpUnicodeEscapeSequence</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <code class="t">u</code> <span class="nt">LeadSurragate</span> <code class="t">\u</code> <span class="nt">TrailSurragate</span></div>
<div class="rhs"><code class="t">u</code> <span class="nt">Hex4Digits</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <code class="t">u{</code> <span class="nt">HexDigits</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LeadSurragate</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Hex4Digits</span> <span class="grhsannot">[match only if the CV of <span class="nt">Hex4Digits</span> is in the inclusive range 0xD800 to 0xDBFF]</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">TailSurragate</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Hex4Digits</span> <span class="grhsannot">[match only if the CV of <span class="nt">Hex4Digits</span> is in the inclusive range 0xDC00 to 0xDFFF]</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">IdentityEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">SyntaxCharacter</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">IdentifierPart</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> &lt;ZWJ&gt;</div>
<div class="rhs"><span class="grhsannot">[~U]</span> &lt;ZWNJ&gt;</div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">DecimalEscape</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalIntegerLiteral</span> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">d</code> <code class="t">D</code> <code class="t">s</code> <code class="t">S</code> <code class="t">w</code> <code class="t">W</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CharacterClass</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><code class="t">[</code> <span class="grhsannot">[lookahead ∉ {<code class="t">^</code>}]</span> <span class="nt">ClassRanges</span><sub>[?U]</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <code class="t">^</code> <span class="nt">ClassRanges</span><sub>[?U]</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassRanges</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">NonemptyClassRanges</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NonemptyClassRanges</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub> <span class="nt">NonemptyClassRangesNoDash</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub> <code class="t">-</code> <span class="nt">ClassAtom</span><sub>[?U]</sub> <span class="nt">ClassRanges</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NonemptyClassRangesNoDash</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span><sub>[?U]</sub> <span class="nt">NonemptyClassRangesNoDash</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span><sub>[?U]</sub> <code class="t">-</code> <span class="nt">ClassAtom</span><sub>[?U]</sub> <span class="nt">ClassRanges</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassAtom</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><code class="t">-</code></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassAtomNoDash</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">-</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">ClassEscape</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalEscape</span></div>
<div class="rhs"><code class="t">b</code></div>
<div class="rhs"><span class="nt">CharacterEscape</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">CharacterClassEscape</span></div>
</div>
</section>
<section id="sec-pattern-semantics">
<div class="front">
<h1><span class="secnum" id="sec-21.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics" title="link to this section">21.2.2</a></span>
Pattern Semantics</h1>
<p>A regular expression pattern is converted into an internal procedure using the process described below. An
implementation is encouraged to use more efficient algorithms than the ones listed below, as long as the results are the
same. The internal procedure is used as the value of a RegExp object’s [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>A <span class="nt">Pattern</span> is either a BMP pattern or a Unicode pattern depending upon whether or not its
associated flags contain an <code>"u"</code>. A BMP pattern matches against a String interpreted as consisting of a
sequence of Unicode code units. A Unicode pattern matches against a String interpreted as consisting of Unicode code
points encoded using UTF-16. In the context of describing the behaviour of a BMP pattern “character” means a
Unicode code unit. In the context of describing the behaviour of a Unicode pattern “character” means a UTF-16
code point. In either context, “character value” means the numeric value of the code unit or code point.</p>
<p>The semantics of <span class="nt">Pattern</span> is defined as if a <span class="nt">Pattern</span> was a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <span class="nt">SourceCharacter</span> values where each <span class="nt">SourceCharacter</span> corresponds to a Unicode code point. If a BMP pattern contains a non-BMP <span class="nt">SourceCharacter</span> the entire pattern is encoded using UTF-16 and the individual code units of that
encoding are used as the elements of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> For example, consider a pattern expressed in source code as the single non-BMP character
<span style="font-family: sans-serif">U+1D11E (MUSICAL SYMBOL G CLEF). Interpreted as a Unicode pattern, it would be a
single element (character) <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of the single code
point 0x1D11E. However, interpreted as a BMP pattern, it is first UTF-16 encoded to produce a two element <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of the code units 0xD834 and 0xDD1E.</span></p>
<p>Patterns are passed to the RegExp constructor as ECMAScript string values in which non-BMP characters are UTF-16
encoded. For example, the single character MUSICAL SYMBOL G CLEF pattern, expressed as a string value, is a String of
length 2 whose elements were the code units 0xD834 and 0xDD1E. So no further translation of the string would be
necessary to process it as a BMP pattern consisting of two pattern characters. However, to process it as a Unicode
pattern the string value must treated as if it was UTF-16 decoded into a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of a single pattern character, the code point
U+1D11E.</p>
<p>An implementation may not actually perform such translations to or from UTF-16, but the semantics of this
specification requires that the result of pattern matching be as if such translations were performed.</p>
</div>
</div>
<section id="sec-notation">
<h1><span class="secnum" id="sec-21.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-notation" title="link to this section">21.2.2.1</a></span>
Notation</h1>
<p>The descriptions below use the following variables:</p>
<ul>
<li>
<p><span class="nt">Input</span> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of all of
the characters, in order, of the String being matched by the regular expression pattern. Each character is either a
code units or a code points, depending upon the kind of pattern involved. The notation <span style="font-family: Times
New Roman"><i>input</i>[<i>n</i>]</span> means the <span style="font-family: Times New
Roman"><i>n<sup>th</sup></i></span> character of <var>input</var>, where <var>n</var> can range between 0 (inclusive)
and <span class="nt">InputLength</span> (exclusive).</p>
</li>
<li>
<p><span class="nt">InputLength</span> is the number of characters in <span class="nt">Input</span>.</p>
</li>
<li>
<p><span class="nt">NcapturingParens</span> is the total number of left capturing parentheses (i.e. the total number
of times the <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code>
<span class="nt">Disjunction</span> <code class="t">)</code></span> production is expanded) in the pattern. A left
capturing parenthesis is any <code>(</code> pattern character that is matched by the <code>(</code> terminal of the
<span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> production.</p>
</li>
<li>
<p><span class="nt">IgnoreCase</span> is <b>true</b> if the RegExp object's [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> contains <code>"i"</code> and otherwise is
<b>false</b>.</p>
</li>
<li>
<p><span class="nt">Multiline</span> is <b>true</b> if the RegExp object’s [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> contains <code>"m"</code> and otherwise is
<b>false</b>.</p>
</li>
<li>
<p><span class="nt">Unicode</span> is <b>true</b> if the RegExp object’s [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> contains <code>"u"</code> and otherwise is
<b>false</b>.</p>
</li>
</ul>
<p>Furthermore, the descriptions below use the following internal data structures:</p>
<ul>
<li>
<p>A <span class="nt">CharSet</span> is a mathematical set of characters, either code units or code points depending
up the state of the <span class="nt">Unicode</span> flag. “All characters” means either all code unit
values or all code point values also depending upon the state if <span class="nt">Unicode</span>.</p>
</li>
<li>
<p>A <span class="nt">State</span> is an ordered pair <span style="font-family: Times New Roman">(<i>endIndex</i>,
<i>captures</i>)</span> where <var>endIndex</var> is an integer and <var>captures</var> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <span class="nt">NcapturingParens</span> values. <span class="nt">States</span> are used to represent partial match states in the regular expression matching algorithms. The
<var>endIndex</var> is one plus the index of the last input character matched so far by the pattern, while
<var>captures</var> holds the results of capturing parentheses. The <span style="font-family: Times New
Roman"><i>n<sup>th</sup></i></span> element of <var>captures</var> is either a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that represents the value obtained by the <span style="font-family: Times New Roman"><i>n<sup>th</sup></i></span> set of capturing parentheses or <b>undefined</b> if
the <span style="font-family: Times New Roman"><i>n<sup>th</sup></i></span> set of capturing parentheses hasn’t
been reached yet. Due to backtracking, many <span class="nt">States</span> may be in use at any time during the
matching process.</p>
</li>
<li>
<p>A <span class="nt">MatchResult</span> is either a <span class="nt">State</span> or the special token <b>failure</b>
that indicates that the match failed.</p>
</li>
<li>
<p>A <span class="nt">Continuation</span> procedure is an internal closure (i.e. an internal procedure with some
arguments already bound to values) that takes one <span class="nt">State</span> argument and returns a <span class="nt">MatchResult</span> result. If an internal closure references variables which are bound in the function that
creates the closure, the closure uses the values that these variables had at the time the closure was created. The
<span class="nt">Continuation</span> attempts to match the remaining portion (specified by the closure's already-bound
arguments) of the pattern against <span class="nt">Input</span>, starting at the intermediate state given by its <span class="nt">State</span> argument. If the match succeeds, the <span class="nt">Continuation</span> returns the final
<span class="nt">State</span> that it reached; if the match fails, the <span class="nt">Continuation</span> returns
<b>failure</b>.</p>
</li>
<li>
<p>A <span class="nt">Matcher</span> procedure is an internal closure that takes two arguments -- a <span class="nt">State</span> and a <span class="nt">Continuation</span> -- and returns a <span class="nt">MatchResult</span> result. A <span class="nt">Matcher</span> attempts to match a middle subpattern
(specified by the closure's already-bound arguments) of the pattern against <span class="nt">Input</span>, starting at
the intermediate state given by its <span class="nt">State</span> argument. The <span class="nt">Continuation</span>
argument should be a closure that matches the rest of the pattern. After matching the subpattern of a pattern to
obtain a new <span class="nt">State</span>, the <span class="nt">Matcher</span> then calls <span class="nt">Continuation</span> on that new <span class="nt">State</span> to test if the rest of the pattern can match
as well. If it can, the <i>Matcher</i> returns the <span class="nt">State</span> returned by <span class="nt">Continuation</span>; if not, the <span class="nt">Matcher</span> may try different choices at its choice
points, repeatedly calling <span class="nt">Continuation</span> until it either succeeds or all possibilities have
been exhausted.</p>
</li>
<li>
<p>An <span class="nt">AssertionTester</span> procedure is an internal closure that takes a <span class="nt">State</span> argument and returns a Boolean result. The assertion tester tests a specific condition
(specified by the closure's already-bound arguments) against the current place in <span class="nt">Input</span> and
returns <b>true</b> if the condition matched or <b>false</b> if not.</p>
</li>
<li>
<p>An <span class="nt">EscapeValue</span> is either a character or an integer. An <span class="nt">EscapeValue</span>
is used to denote the interpretation of a <span class="nt">DecimalEscape</span> escape sequence: a character
<var>ch</var> means that the escape sequence is interpreted as the character <var>ch</var>, while an integer
<var>n</var> means that the escape sequence is interpreted as a backreference to the <span style="font-family: Times
New Roman"><i>n</i><sup>th</sup></span> set of capturing parentheses.</p>
</li>
</ul>
</section>
<section id="sec-pattern">
<h1><span class="secnum" id="sec-21.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern" title="link to this section">21.2.2.2</a></span>
Pattern</h1>
<p>The production <span class="prod"><span class="nt">Pattern</span> <span class="geq">::</span> <span class="nt">Disjunction</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>Disjunction</i> to obtain a Matcher <i>m</i>.</li>
<li>Return an internal closure that takes two arguments, a String <i>str</i> and an integer <i>index</i>, and performs
the following:
<ol class="nested proc">
<li>If <i>Unicode</i> is <b>true</b>, then let <i>Input</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of consisting of the sequence of code points of
<i>str</i> interpreted as a UTF-16 encoded Unicode string. Otherwise, let <i>Input</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of the sequence of code units that are the
elements of <i>str</i>. <i>Input</i> will be used throughout the algorithms in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics">21.2.2</a>. Each element of <i>Input</i> is considered to be a character.</li>
<li>Let <i>listIndex</i> be the index into <i>Input</i> of the character that was obtained from element <i>index</i>
of <i>str</i>.</li>
<li>Let <i>InputLength</i> be the number of character contained in <i>Input</i>. This variable will be used
throughout the algorithms in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics">21.2.2</a>.</li>
<li>Let <i>c</i> be a Continuation that always returns its State argument as a successful MatchResult.</li>
<li>Let <i>cap</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <i>NcapturingParens</i>
<b>undefined</b> values, indexed 1 through <i>NcapturingParens</i>.</li>
<li>Let <i>x</i> be the State (<i>listIndex</i>, <i>cap</i>).</li>
<li>Call <i>m</i>(<i>x</i>, <i>c</i>) and return its result.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> A Pattern evaluates ("compiles") to an internal procedure value. <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.exec">RegExp.prototype.exec</a></code> and other methods can then apply this procedure to a
String and an offset within the String to determine whether the pattern would match starting at exactly that offset
within the String, and, if it does match, what the values of the capturing parentheses would be. The algorithms in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics">21.2.2</a> are designed so that compiling a pattern may throw a <b>SyntaxError</b>
exception; on the other hand, once the pattern is successfully compiled, applying its result internal procedure to find
a match in a String cannot throw an exception (except for any host-defined exceptions that can occur anywhere such as
out-of-memory).</p>
</div>
</section>
<section id="sec-disjunction">
<h1><span class="secnum" id="sec-21.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-disjunction" title="link to this section">21.2.2.3</a></span>
Disjunction</h1>
<p>The production <span class="prod"><span class="nt">Disjunction</span> <span class="geq">::</span> <span class="nt">Alternative</span></span> evaluates by evaluating <span class="nt">Alternative</span> to obtain a <span style="font-family: Times New Roman">Matcher</span> and returning that <span style="font-family: Times New
Roman">Matcher</span>.</p>
<p>The production <span class="prod"><span class="nt">Disjunction</span> <span class="geq">::</span> <span class="nt">Alternative</span> <code class="t">|</code> <span class="nt">Disjunction</span></span> evaluates as
follows:</p>
<ol class="proc">
<li>Evaluate <i>Alternative</i> to obtain a Matcher <i>m1</i>.</li>
<li>Evaluate <i>Disjunction</i> to obtain a Matcher <i>m2</i>.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following:
<ol class="nested proc">
<li>Call <i>m1</i>(<i>x</i>, <i>c</i>) and let <i>r</i> be its result.</li>
<li>If <i>r</i> isn't <b>failure</b>, return <i>r</i>.</li>
<li>Call <i>m2</i>(<i>x</i>, <i>c</i>) and return its result.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>|</code> regular expression operator separates two alternatives. The pattern
first tries to match the left <i>Alternative</i> (followed by the sequel of the regular expression); if it fails, it
tries to match the right <i>Disjunction</i> (followed by the sequel of the regular expression). If the left
<i>Alternative</i>, the right <i>Disjunction</i>, and the sequel all have choice points, all choices in the sequel are
tried before moving on to the next choice in the left <i>Alternative</i>. If choices in the left <i>Alternative</i> are
exhausted, the right <i>Disjunction</i> is tried instead of the left <i>Alternative</i>. Any capturing parentheses
inside a portion of the pattern skipped by <code>|</code> produce <b>undefined</b> values instead of Strings. Thus, for
example,</p>
<pre>/a|ab/.exec("abc")</pre>
<p>returns the result <code>"a"</code> and not <code>"ab"</code>. Moreover,</p>
<pre>/((a)|(ab))((c)|(bc))/.exec("abc")</pre>
<p>returns the array</p>
<pre>["abc", "a", "a", undefined, "bc", undefined, "bc"]</pre>
<p>and not</p>
<pre>["abc", "ab", undefined, "ab", "c", "c", undefined]</pre>
</div>
</section>
<section id="sec-alternative">
<h1><span class="secnum" id="sec-21.2.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-alternative" title="link to this section">21.2.2.4</a></span>
Alternative</h1>
<p>The production <span class="prod"><span class="nt">Alternative</span> <span class="geq">::</span> <span class="grhsannot">[empty]</span></span> evaluates by returning a Matcher that takes two arguments, a State <var>x</var>
and a Continuation <var>c</var>, and returns the result of calling <var>c</var>(<var>x</var>).</p>
<p>The production <span class="prod"><span class="nt">Alternative</span> <span class="geq">::</span> <span class="nt">Alternative</span> <span class="nt">Term</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>Alternative</i> to obtain a Matcher <i>m1</i>.</li>
<li>Evaluate <i>Term</i> to obtain a Matcher <i>m2</i>.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following:
<ol class="nested proc">
<li>Create a Continuation <i>d</i> that takes a State argument <i>y</i> and returns the result of calling
<i>m2</i>(<i>y</i>, <i>c</i>).</li>
<li>Call <i>m1</i>(<i>x</i>, <i>d</i>) and return its result.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Consecutive <i>Terms</i> try to simultaneously match consecutive portions of
<i>Input</i>. If the left <i>Alternative</i>, the right <i>Term</i>, and the sequel of the regular expression all have
choice points, all choices in the sequel are tried before moving on to the next choice in the right <i>Term</i>, and all
choices in the right <i>Term</i> are tried before moving on to the next choice in the left <i>Alternative</i>.</p>
</div>
</section>
<section id="sec-term">
<div class="front">
<h1><span class="secnum" id="sec-21.2.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-term" title="link to this section">21.2.2.5</a></span>
Term</h1>
<p>The production <span class="prod"><span class="nt">Term</span> <span class="geq">::</span> <span class="nt">Assertion</span></span> evaluates by returning an internal Matcher closure that takes two arguments, a State
<var>x</var> and a Continuation <var>c</var>, and performs the following:</p>
<ol class="proc">
<li>Evaluate <i>Assertion</i> to obtain an AssertionTester <i>t</i>.</li>
<li>Call <i>t</i>(<i>x</i>) and let <i>r</i> be the resulting Boolean value.</li>
<li>If <i>r</i> is <b>false</b>, return <b>failure</b>.</li>
<li>Call <i>c</i>(<i>x</i>) and return its result.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Term</span> <span class="geq">::</span> <span class="nt">Atom</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the Matcher that is the result of evaluating <i>Atom</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Term</span> <span class="geq">::</span> <span class="nt">Atom</span> <span class="nt">Quantifier</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>Atom</i> to obtain a Matcher <i>m</i>.</li>
<li>Evaluate <i>Quantifier</i> to obtain the three results: an integer <i>min</i>, an integer (or ∞) <i>max</i>,
and Boolean <i>greedy</i>.</li>
<li>If <i>max</i> is finite and less than <i>min</i>, then throw a <b>SyntaxError</b> exception.</li>
<li>Let <i>parenIndex</i> be the number of left capturing parentheses in the entire regular expression that occur to
the left of this production expansion's <i>Term</i>. This is the total number of times the <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> production is expanded prior to this production's
<i>Term</i> plus the total number of <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span>
<code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> productions enclosing
this <i>Term</i>.</li>
<li>Let <i>parenCount</i> be the number of left capturing parentheses in the expansion of this production's
<i>Atom</i>. This is the total number of <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span>
productions enclosed by this production's <i>Atom</i>.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following:
<ol class="nested proc">
<li>Call RepeatMatcher(<i>m</i>, <i>min</i>, <i>max</i>, <i>greedy</i>, <i>x</i>, <i>c</i>, <i>parenIndex</i>,
<i>parenCount</i>) and return its result.</li>
</ol>
</li>
</ol>
</div>
<section id="sec-runtime-semantics-repeatmatcher-abstract-operation">
<h1><span class="secnum" id="sec-21.2.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-repeatmatcher-abstract-operation" title="link to this section">21.2.2.5.1</a></span> Runtime Semantics: RepeatMatcher Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">RepeatMatcher</span> takes eight parameters, a
Matcher <var>m</var>, an integer <var>min</var>, an integer (or ∞) <var>max</var>, a Boolean <var>greedy</var>, a
State <var>x</var>, a Continuation <var>c</var>, an integer <var>parenIndex</var>, and an integer <var>parenCount</var>,
and performs the following:</p>
<ol class="proc">
<li>If <i>max</i> is zero, then call <i>c</i>(<i>x</i>) and return its result.</li>
<li>Create an internal Continuation closure <i>d</i> that takes one State argument <i>y</i> and performs the
following:
<ol class="nested proc">
<li>If <i>min</i> is zero and <i>y</i>'s <i>endIndex</i> is equal to <i>x</i>'s <i>endIndex</i>, then return
<b>failure</b>.</li>
<li>If <i>min</i> is zero then let <i>min2</i> be zero; otherwise let <i>min2</i> be <i>min</i>–1.</li>
<li>If <i>max</i> is ∞, then let <i>max2</i> be ∞; otherwise let <i>max2</i> be
<i>max</i>–1.</li>
<li>Call RepeatMatcher(<i>m</i>, <i>min2</i>, <i>max2</i>, <i>greedy</i>, <i>y</i>, <i>c</i>, <i>parenIndex</i>,
<i>parenCount</i>) and return its result.</li>
</ol>
</li>
<li>Let <i>cap</i> be a fresh copy of <i>x</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For every integer <i>k</i> that satisfies <i>parenIndex</i> &lt; <i>k</i> and <i>k</i> ≤
<i>parenIndex</i>+<i>parenCount</i>, set <i>cap</i>[<i>k</i>] to <b>undefined</b>.</li>
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>Let <i>xr</i> be the State (<i>e</i>, <i>cap</i>).</li>
<li>If <i>min</i> is not zero, then call <i>m</i>(<i>xr</i>, <i>d</i>) and return its result.</li>
<li>If <i>greedy</i> is <b>false</b>, then
<ol class="block">
<li>Call <i>c</i>(<i>x</i>) and let <i>z</i> be its result.</li>
<li>If <i>z</i> is not <b>failure</b>, return <i>z</i>.</li>
<li>Call <i>m</i>(<i>xr</i>, <i>d</i>) and return its result.</li>
</ol>
</li>
<li>Call <i>m</i>(<i>xr</i>, <i>d</i>) and let <i>z</i> be its result.</li>
<li>If <i>z</i> is not <b>failure</b>, return <i>z</i>.</li>
<li>Call <i>c</i>(<i>x</i>) and return its result.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> An <i>Atom</i> followed by a <i>Quantifier</i> is repeated the number of times
specified by the <i>Quantifier</i>. A <i>Quantifier</i> can be non-greedy, in which case the <i>Atom</i> pattern is
repeated as few times as possible while still matching the sequel, or it can be greedy, in which case the <i>Atom</i>
pattern is repeated as many times as possible while still matching the sequel. The <i>Atom</i> pattern is repeated
rather than the input character sequence that it matches, so different repetitions of the <i>Atom</i> can match
different input substrings.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> If the <i>Atom</i> and the sequel of the regular expression all have choice points,
the <i>Atom</i> is first matched as many (or as few, if non-greedy) times as possible. All choices in the sequel are
tried before moving on to the next choice in the last repetition of <i>Atom</i>. All choices in the last
(n<sup>th</sup>) repetition of <i>Atom</i> are tried before moving on to the next choice in the next-to-last
(n–1)<sup>st</sup> repetition of <i>Atom</i>; at which point it may turn out that more or fewer repetitions of
<i>Atom</i> are now possible; these are exhausted (again, starting with either as few or as many as possible) before
moving on to the next choice in the (n-1)<sup>st</sup> repetition of <i>Atom</i> and so on.</p>
<p>Compare</p>
<pre>/a[a-z]{2,4}/.exec("abcdefghi")</pre>
<p>which returns <code>"abcde"</code> with</p>
<pre>/a[a-z]{2,4}?/.exec("abcdefghi")</pre>
<p>which returns <code>"abc"</code>.</p>
<p>Consider also</p>
<pre>/(aa|aabaac|ba|b|c)*/.exec("aabaac")</pre>
<p>which, by the choice point ordering above, returns the array</p>
<pre>["aaba", "ba"]</pre>
<p>and not any of:</p>
<pre>["aabaac", "aabaac"]</pre>
<pre>["aabaac", "c"]</pre>
<p>The above ordering of choice points can be used to write a regular expression that calculates the greatest common
divisor of two numbers (represented in unary notation). The following example calculates the gcd of 10 and 15:</p>
<pre>"aaaaaaaaaa,aaaaaaaaaaaaaaa".replace(/^(a+)\1*,\1+$/,"$1")</pre>
<p>which returns the gcd in unary notation <code>"aaaaa"</code>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> Step 5 of the RepeatMatcher clears <i>Atom's</i> captures each time <i>Atom</i> is
repeated. We can see its behaviour in the regular expression</p>
<pre>/(z)((a+)?(b+)?(c))*/.exec("zaacbbbcac")</pre>
<p>which returns the array</p>
<pre>["zaacbbbcac", "z", "ac", "a", undefined, "c"]</pre>
<p>and not</p>
<pre>["zaacbbbcac", "z", "ac", "a", "bbb", "c"]</pre>
<p>because each iteration of the outermost <code>*</code> clears all captured Strings contained in the quantified
<span class="nt">Atom</span>, which in this case includes capture Strings numbered 2, 3, 4, and 5.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 4</span> Step 1 of the RepeatMatcher's <i>d</i> closure states that, once the minimum number
of repetitions has been satisfied, any more expansions of <i>Atom</i> that match the empty character sequence are not
considered for further repetitions. This prevents the regular expression engine from falling into an infinite loop on
patterns such as:</p>
<pre>/(a*)*/.exec("b")</pre>
<p>or the slightly more complicated:</p>
<pre>/(a*)b\1+/.exec("baaaac")</pre>
<p>which returns the array</p>
<pre>["b", ""]</pre>
</div>
</section>
</section>
<section id="sec-assertion">
<div class="front">
<h1><span class="secnum" id="sec-21.2.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assertion" title="link to this section">21.2.2.6</a></span>
Assertion</h1>
<p>The production <span class="prod"><span class="nt">Assertion</span> <span class="geq">::</span> <code class="t">^</code></span> evaluates by returning an internal AssertionTester closure that takes a State argument
<var>x</var> and performs the following:</p>
<ol class="proc">
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>If <i>e</i> is zero, return <b>true</b>.</li>
<li>If <i>Multiline</i> is <b>false</b>, return <b>false</b>.</li>
<li>If the character <i>Input</i>[<i>e</i>–1] is one of <i>LineTerminator</i>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Even when the <code>y</code> flag is used with a pattern, <code>^</code> always
matches only at the beginning of <i>Input</i>, or (if <i>Multiline</i> is <b>true</b>) at the beginning of a line.</p>
</div>
<p>The production <span class="prod"><span class="nt">Assertion</span> <span class="geq">::</span> <code class="t">$</code></span> evaluates by returning an internal AssertionTester closure that takes a State argument
<var>x</var> and performs the following:</p>
<ol class="proc">
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>If <i>e</i> is equal to <i>InputLength</i>, return <b>true</b>.</li>
<li>If <i>Multiline</i> is <b>false</b>, return <b>false</b>.</li>
<li>If the character <i>Input</i>[<i>e</i>] is one of <i>LineTerminator</i>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Assertion</span> <span class="geq">::</span> <code class="t">\</code> <code class="t">b</code></span> evaluates by returning an internal AssertionTester closure that takes
a State argument <var>x</var> and performs the following:</p>
<ol class="proc">
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>Call IsWordChar(<i>e</i>–1) and let <i>a</i> be the Boolean result.</li>
<li>Call IsWordChar(<i>e</i>) and let <i>b</i> be the Boolean result.</li>
<li>If <i>a</i> is <b>true</b> and <i>b</i> is <b>false</b>, return <b>true</b>.</li>
<li>If <i>a</i> is <b>false</b> and <i>b</i> is <b>true</b>, return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Assertion</span> <span class="geq">::</span> <code class="t">\</code> <code class="t">B</code></span> evaluates by returning an internal AssertionTester closure that takes
a State argument <var>x</var> and performs the following:</p>
<ol class="proc">
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>Call IsWordChar(<i>e</i>–1) and let <i>a</i> be the Boolean result.</li>
<li>Call IsWordChar(<i>e</i>) and let <i>b</i> be the Boolean result.</li>
<li>If <i>a</i> is <b>true</b> and <i>b</i> is <b>false</b>, return <b>false</b>.</li>
<li>If <i>a</i> is <b>false</b> and <i>b</i> is <b>true</b>, return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Assertion</span> <span class="geq">::</span> <code class="t">(</code> <code class="t">?</code> <code class="t">=</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>Disjunction</i> to obtain a Matcher <i>m</i>.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following steps:
<ol class="nested proc">
<li>Let <i>d</i> be a Continuation that always returns its State argument as a successful MatchResult.</li>
<li>Call <i>m</i>(<i>x</i>, <i>d</i>) and let <i>r</i> be its result.</li>
<li>If <i>r</i> is <b>failure</b>, return <b>failure</b>.</li>
<li>Let <i>y</i> be <i>r</i>'s State.</li>
<li>Let <i>cap</i> be <i>y</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>xe</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>Let <i>z</i> be the State (<i>xe</i>, <i>cap</i>).</li>
<li>Call <i>c</i>(<i>z</i>) and return its result.</li>
</ol>
</li>
</ol>
<p>The production <span class="prod"><span class="nt">Assertion</span> <span class="geq">::</span> <code class="t">(</code> <code class="t">?</code> <code class="t">!</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>Disjunction</i> to obtain a Matcher <i>m</i>.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following steps:
<ol class="nested proc">
<li>Let <i>d</i> be a Continuation that always returns its State argument as a successful MatchResult.</li>
<li>Call <i>m</i>(<i>x</i>, <i>d</i>) and let <i>r</i> be its result.</li>
<li>If <i>r</i> isn't <b>failure</b>, return <b>failure</b>.</li>
<li>Call <i>c</i>(<i>x</i>) and return its result.</li>
</ol>
</li>
</ol>
</div>
<section id="sec-runtime-semantics-iswordchar-abstract-operation">
<h1><span class="secnum" id="sec-21.2.2.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-iswordchar-abstract-operation" title="link to this section">21.2.2.6.1</a></span> Runtime Semantics: IsWordChar Abstract Operation</h1>
<p>The abstract operation IsWordChar takes an integer parameter <var>e</var> and performs the following:</p>
<ol class="proc">
<li>If <i>e</i> is –1 or <i>e</i> is <i>InputLength</i>, return <b>false</b>.</li>
<li>Let <i>c</i> be the character <i>Input</i>[<i>e</i>].</li>
<li>If <i>c</i> is one of the sixty-three characters below, return <b>true</b>.
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">a</span></td>
<td><span style="font-family: monospace">b</span></td>
<td><span style="font-family: monospace">c</span></td>
<td><span style="font-family: monospace">d</span></td>
<td><span style="font-family: monospace">e</span></td>
<td><span style="font-family: monospace">f</span></td>
<td><span style="font-family: monospace">g</span></td>
<td><span style="font-family: monospace">h</span></td>
<td><span style="font-family: monospace">i</span></td>
<td><span style="font-family: monospace">j</span></td>
<td><span style="font-family: monospace">k</span></td>
<td><span style="font-family: monospace">l</span></td>
<td><span style="font-family: monospace">m</span></td>
<td><span style="font-family: monospace">n</span></td>
<td><span style="font-family: monospace">o</span></td>
<td><span style="font-family: monospace">p</span></td>
<td><span style="font-family: monospace">q</span></td>
<td><span style="font-family: monospace">r</span></td>
<td><span style="font-family: monospace">s</span></td>
<td><span style="font-family: monospace">t</span></td>
<td><span style="font-family: monospace">u</span></td>
<td><span style="font-family: monospace">v</span></td>
<td><span style="font-family: monospace">w</span></td>
<td><span style="font-family: monospace">x</span></td>
<td><span style="font-family: monospace">y</span></td>
<td><span style="font-family: monospace">z</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">A</span></td>
<td><span style="font-family: monospace">B</span></td>
<td><span style="font-family: monospace">C</span></td>
<td><span style="font-family: monospace">D</span></td>
<td><span style="font-family: monospace">E</span></td>
<td><span style="font-family: monospace">F</span></td>
<td><span style="font-family: monospace">G</span></td>
<td><span style="font-family: monospace">H</span></td>
<td><span style="font-family: monospace">I</span></td>
<td><span style="font-family: monospace">J</span></td>
<td><span style="font-family: monospace">K</span></td>
<td><span style="font-family: monospace">L</span></td>
<td><span style="font-family: monospace">M</span></td>
<td><span style="font-family: monospace">N</span></td>
<td><span style="font-family: monospace">O</span></td>
<td><span style="font-family: monospace">P</span></td>
<td><span style="font-family: monospace">Q</span></td>
<td><span style="font-family: monospace">R</span></td>
<td><span style="font-family: monospace">S</span></td>
<td><span style="font-family: monospace">T</span></td>
<td><span style="font-family: monospace">U</span></td>
<td><span style="font-family: monospace">V</span></td>
<td><span style="font-family: monospace">W</span></td>
<td><span style="font-family: monospace">X</span></td>
<td><span style="font-family: monospace">Y</span></td>
<td><span style="font-family: monospace">Z</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">0</span></td>
<td><span style="font-family: monospace">1</span></td>
<td><span style="font-family: monospace">2</span></td>
<td><span style="font-family: monospace">3</span></td>
<td><span style="font-family: monospace">4</span></td>
<td><span style="font-family: monospace">5</span></td>
<td><span style="font-family: monospace">6</span></td>
<td><span style="font-family: monospace">7</span></td>
<td><span style="font-family: monospace">8</span></td>
<td><span style="font-family: monospace">9</span></td>
<td><span style="font-family: monospace">_</span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
</section>
<section id="sec-quantifier">
<h1><span class="secnum" id="sec-21.2.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-quantifier" title="link to this section">21.2.2.7</a></span>
Quantifier</h1>
<p>The production <span class="prod"><span class="nt">Quantifier</span> <span class="geq">::</span> <span class="nt">QuantifierPrefix</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>QuantifierPrefix</i> to obtain the two results: an integer <i>min</i> and an integer (or ∞)
<i>max</i>.</li>
<li>Return the three results <i>min</i>, <i>max</i>, and <b>true</b>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Quantifier</span> <span class="geq">::</span> <span class="nt">QuantifierPrefix</span> <code class="t">?</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>QuantifierPrefix</i> to obtain the two results: an integer <i>min</i> and an integer (or ∞)
<i>max</i>.</li>
<li>Return the three results <i>min</i>, <i>max</i>, and <b>false</b>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> <code class="t">*</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the two results 0 and ∞.</li>
</ol>
<p>The production <span class="prod"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> <code class="t">+</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the two results 1 and ∞.</li>
</ol>
<p>The production <span class="prod"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> <code class="t">?</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the two results 0 and 1.</li>
</ol>
<p>The production <span class="prod"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> <code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">}</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>i</i> be the MV of <i>DecimalDigits</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">see 11.8.3</a>).</li>
<li>Return the two results <i>i</i> and <i>i</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> <code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">,</code> <code class="t">}</code></span>
evaluates as follows:</p>
<ol class="proc">
<li>Let <i>i</i> be the MV of <i>DecimalDigits</i>.</li>
<li>Return the two results <i>i</i> and ∞.</li>
</ol>
<p>The production <span class="prod"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> <code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">,</code> <span class="nt">DecimalDigits</span>
<code class="t">}</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>i</i> be the MV of the first <i>DecimalDigits</i>.</li>
<li>Let <i>j</i> be the MV of the second <i>DecimalDigits</i>.</li>
<li>Return the two results <i>i</i> and <i>j</i>.</li>
</ol>
</section>
<section id="sec-atom">
<div class="front">
<h1><span class="secnum" id="sec-21.2.2.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-atom" title="link to this section">21.2.2.8</a></span>
Atom</h1>
<p>The production <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <span class="nt">PatternCharacter</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>ch</i> be the character represented by <i>PatternCharacter</i>.</li>
<li>Let <i>A</i> be a one-element CharSet containing the character <i>ch</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <b>false</b>) and return its Matcher result.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">.</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>A</i> be the set of all characters except <i>LineTerminator</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <b>false</b>) and return its Matcher result.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">\</code>
<span class="nt">AtomEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the Matcher that is the result of evaluating <i>AtomEscape</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <span class="nt">CharacterClass</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>CharacterClass</i> to obtain a CharSet <i>A</i> and a Boolean <i>invert</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <i>invert</i>) and return its Matcher result.</li>
</ol>
<p>The production <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code>
<span class="nt">Disjunction</span> <code class="t">)</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>Disjunction</i> to obtain a Matcher <i>m</i>.</li>
<li>Let <i>parenIndex</i> be the number of left capturing parentheses in the entire regular expression that occur to
the left of this production expansion's initial left parenthesis. This is the total number of times the <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> production is expanded prior to this production's
<i>Atom</i> plus the total number of <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span>
<code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> productions enclosing
this <i>Atom</i>.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following steps:
<ol class="nested proc">
<li>Create an internal Continuation closure <i>d</i> that takes one State argument <i>y</i> and performs the
following steps:
<ol class="nested proc">
<li>Let <i>cap</i> be a fresh copy of <i>y</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>xe</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>Let <i>ye</i> be <i>y</i>'s <i>endIndex</i>.</li>
<li>Let <i>s</i> be a fresh <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose characters are
the characters of <i>Input</i> at positions <i>xe</i> (inclusive) through <i>ye</i> (exclusive).</li>
<li>Set <i>cap</i>[<i>parenIndex</i>+1] to <i>s</i>.</li>
<li>Let <i>z</i> be the State (<i>ye</i>, <i>cap</i>).</li>
<li>Call <i>c</i>(<i>z</i>) and return its result.</li>
</ol>
</li>
<li>Call <i>m</i>(<i>x</i>, <i>d</i>) and return its result.</li>
</ol>
</li>
</ol>
<p>The production <span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code>
<code class="t">?</code> <code class="t">:</code> <span class="nt">Disjunction</span> <code class="t">)</code></span>
evaluates as follows:</p>
<ol class="proc">
<li>Return the Matcher that is the result of evaluating <i>Disjunction</i>.</li>
</ol>
</div>
<section id="sec-runtime-semantics-charactersetmatcher-abstract-operation">
<h1><span class="secnum" id="sec-21.2.2.8.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-charactersetmatcher-abstract-operation" title="link to this section">21.2.2.8.1</a></span> Runtime Semantics: CharacterSetMatcher Abstract Operation</h1>
<p>The abstract operation CharacterSetMatcher takes two arguments, a CharSet <var>A</var> and a Boolean flag
<var>invert</var>, and performs the following:</p>
<ol class="proc">
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following steps:
<ol class="nested proc">
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>If <i>e</i> is <i>InputLength</i>, return <b>failure</b>.</li>
<li>Let <i>ch</i> be the character <i>Input</i>[<i>e</i>].</li>
<li>Let <i>cc</i> be the result of Canonicalize(<i>ch</i>).</li>
<li>If <i>invert</i> is <b>false</b>, then
<ol class="block">
<li>If there does not exist a member <i>a</i> of set <i>A</i> such that Canonicalize(<i>a</i>) is <i>cc</i>,
return <b>failure</b>.</li>
</ol>
</li>
<li>Else <i>invert</i> is <b>true</b>,
<ol class="block">
<li>If there exists a member <i>a</i> of set <i>A</i> such that Canonicalize(<i>a</i>) is <i>cc</i>, return
<b>failure.</b></li>
</ol>
</li>
<li>Let <i>cap</i> be <i>x</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>y</i> be the State (<i>e</i>+1, <i>cap</i>).</li>
<li>Call <i>c</i>(<i>y</i>) and return its result.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-runtime-semantics-canonicalize-abstract-operation">
<h1><span class="secnum" id="sec-21.2.2.8.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-canonicalize-abstract-operation" title="link to this section">21.2.2.8.2</a></span> Runtime Semantics: Canonicalize Abstract Operation</h1>
<p>The abstract operation Canonicalize takes a character parameter <var>ch</var> and performs the following steps:</p>
<ol class="proc">
<li>If <i>IgnoreCase</i> is <b>false</b>, return <i>ch</i>.</li>
<li>If <i>Unicode</i> is <b>true</b>,
<ol class="block">
<li>If the file CaseFolding.txt of the Unicode Character Database does not provides a simple or common case
folding mapping for <i>ch</i>, return <i>ch.</i></li>
<li>Return the result of apply that mapping to <i>ch</i>.</li>
</ol>
</li>
<li>Else,.
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>ch</i> is a UTF-16 code unit.</li>
<li>Let <i>s</i> be the ECMAScript String value consistings of the single code unit <i>ch</i>.</li>
<li>Let <i>u</i> be the same result produced as if by applying the algorithm for
<code>Stirng.prototype.toUpperCase</code> using <i>s</i> as the <b>this</b> value..</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>u</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>u</i> is a String value.</li>
<li>If <i>u</i> does not consist of a single code unit, then return <i>ch</i>.</li>
<li>Let <i>cu</i> be <i>u</i>’s single code unit element.</li>
<li>If <i>ch</i>'s code unit value ≥ 128 and <i>cu</i>'s code unit value &lt; 128, then return <i>ch</i>.</li>
<li>Return <i>cu</i>.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> Parentheses of the form <code>(</code> <i>Disjunction</i> <code>)</code> serve both
to group the components of the <i>Disjunction</i> pattern together and to save the result of the match. The result can
be used either in a backreference (<code>\</code> followed by a nonzero decimal number), referenced in a replace
String, or returned as part of an array from the regular expression matching internal procedure. To inhibit the
capturing behaviour of parentheses, use the form <code>(?:</code> <i>Disjunction</i> <code>)</code> instead.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The form <code>(?=</code> <i>Disjunction</i> <code>)</code> specifies a zero-width
positive lookahead. In order for it to succeed, the pattern inside <i>Disjunction</i> must match at the current
position, but the current position is not advanced before matching the sequel. If <i>Disjunction</i> can match at the
current position in several ways, only the first one is tried. Unlike other regular expression operators, there is no
backtracking into a <code>(?=</code> form (this unusual behaviour is inherited from Perl). This only matters when the
<i>Disjunction</i> contains capturing parentheses and the sequel of the pattern contains backreferences to those
captures.</p>
<p>For example,</p>
<pre>/(?=(a+))/.exec("baaabac")</pre>
<p>matches the empty String immediately after the first <code>b</code> and therefore returns the array:</p>
<pre>["", "aaa"]</pre>
<p>To illustrate the lack of backtracking into the lookahead, consider:</p>
<pre>/(?=(a+))a*b\1/.exec("baaabac")</pre>
<p>This expression returns</p>
<pre>["aba", "a"]</pre>
<p>and not:</p>
<pre>["aaaba", "a"]</pre>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> The form <code>(?!</code> <i>Disjunction</i> <code>)</code> specifies a zero-width
negative lookahead. In order for it to succeed, the pattern inside <i>Disjunction</i> must fail to match at the
current position. The current position is not advanced before matching the sequel. <i>Disjunction</i> can contain
capturing parentheses, but backreferences to them only make sense from within <i>Disjunction</i> itself.
Backreferences to these capturing parentheses from elsewhere in the pattern always return <b>undefined</b> because the
negative lookahead must fail for the pattern to succeed. For example,</p>
<pre>/(.*?)a(?!(a+)b\2c)\2(.*)/.exec("baaabaac")</pre>
<p>looks for an <code>a</code> not immediately followed by some positive number n of <code>a</code>'s, a
<code>b</code>, another n <code>a</code>'s (specified by the first <code>\2</code>) and a <code>c</code>. The second
<code>\2</code> is outside the negative lookahead, so it matches against <b>undefined</b> and therefore always
succeeds. The whole expression returns the array:</p>
<pre>["baaabaac", "ba", undefined, "abaac"]</pre>
</div>
<p>In case-insignificant matches when <span class="nt">Unicode</span> is <span class="value">true</span>, all
characters are implicitly case-folded using the simple mapping provided by the Unicode standard immediately before they
are compared. The simple mapping always maps to a single code point, so it does not map, for example,
<code>"ß"</code> (U+00DF to <code>"SS"</code>. It may however map a code point outside the Basic Latin range to a
character within, for example, “ſ” (U+017F) to “s”. Such characters are not mapped if
<span class="nt">Unicode</span> is <span class="value">false</span>. This prevents Unicode code points such as U+0131
and U+017F from matching regular expressions such as <code>/[a‑z]/i</code>, but they will match
<code>/[a‑z]/ui</code></p>
</section>
</section>
<section id="sec-atomescape">
<h1><span class="secnum" id="sec-21.2.2.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-atomescape" title="link to this section">21.2.2.9</a></span>
AtomEscape</h1>
<p>The production <span class="prod"><span class="nt">AtomEscape</span> <span class="geq">::</span> <span class="nt">DecimalEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>DecimalEscape</i> to obtain an EscapeValue <i>E</i>.</li>
<li>If <i>E</i> is a character, then
<ol class="block">
<li>Let <i>ch</i> be <i>E</i>'s character.</li>
<li>Let <i>A</i> be a one-element CharSet containing the character <i>ch</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <b>false</b>) and return its Matcher result.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>E</i> must be an integer.</li>
<li>Let <i>n</i> be that integer.</li>
<li>If <i>n</i>=0 or <i>n</i>&gt;<i>NcapturingParens</i> then throw a <b>SyntaxError</b> exception.</li>
<li>Return an internal Matcher closure that takes two arguments, a State <i>x</i> and a Continuation <i>c</i>, and
performs the following steps:
<ol class="nested proc">
<li>Let <i>cap</i> be <i>x</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>s</i> be <i>cap</i>[<i>n</i>].</li>
<li>If <i>s</i> is <b>undefined</b>, then call <i>c</i>(<i>x</i>) and return its result.</li>
<li>Let <i>e</i> be <i>x</i>'s <i>endIndex</i>.</li>
<li>Let <i>len</i> be <i>s</i>'s length.</li>
<li>Let <i>f</i> be <i>e</i>+<i>len</i>.</li>
<li>If <i>f</i>&gt;<i>InputLength</i>, return <b>failure</b>.</li>
<li>If there exists an integer <i>i</i> between 0 (inclusive) and <i>len</i> (exclusive) such that
Canonicalize(<i>s</i>[<i>i</i>]) is not the same character value as Canonicalize(<i>Input</i>
[<i>e</i>+<i>i</i>]), then return <b>failure</b>.</li>
<li>Let <i>y</i> be the State (<i>f</i>, <i>cap</i>).</li>
<li>Call <i>c</i>(<i>y</i>) and return its result.</li>
</ol>
</li>
</ol>
<p>The production <span class="prod"><span class="nt">AtomEscape</span> <span class="geq">::</span> <span class="nt">CharacterEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>CharacterEscape</i> to obtain a character <i>ch</i>.</li>
<li>Let <i>A</i> be a one-element CharSet containing the character <i>ch</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <b>false</b>) and return its Matcher result.</li>
</ol>
<p>The production <span class="prod"><span class="nt">AtomEscape</span> <span class="geq">::</span> <span class="nt">CharacterClassEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>CharacterClassEscape</i> to obtain a CharSet <i>A</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <b>false</b>) and return its Matcher result.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> An escape sequence of the form <code>\</code> followed by a nonzero decimal number
<i>n</i> matches the result of the <i>n</i>th set of capturing parentheses (see 1). It is an error if the regular
expression has fewer than <i>n</i> capturing parentheses. If the regular expression has <i>n</i> or more capturing
parentheses but the <i>n</i>th one is <b>undefined</b> because it has not captured anything, then the backreference
always succeeds.</p>
</div>
</section>
<section id="sec-characterescape">
<h1><span class="secnum" id="sec-21.2.2.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-characterescape" title="link to this section">21.2.2.10</a></span> CharacterEscape</h1>
<p>The production <span class="prod"><span class="nt">CharacterEscape</span> <span class="geq">::</span> <span class="nt">ControlEscape</span></span> evaluates by returning the character according to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-42">Table
42</a>.</p>
<figure>
<figcaption><span id="table-42">Table 42</span> — ControlEscape Character Values</figcaption>
<table class="real-table">
<tbody><tr>
<th>ControlEscape</th>
<th>Character Value</th>
<th>Code Point</th>
<th>Name</th>
<th>Symbol</th>
</tr>
<tr>
<td><code>t</code></td>
<td>9</td>
<td><code>U+0009</code></td>
<td>horizontal tab</td>
<td>&lt;HT&gt;</td>
</tr>
<tr>
<td><code>n</code></td>
<td>10</td>
<td><code>U+000A</code></td>
<td>line feed (new line)</td>
<td>&lt;LF&gt;</td>
</tr>
<tr>
<td><code>v</code></td>
<td>11</td>
<td><code>U+000B</code></td>
<td>vertical tab</td>
<td>&lt;VT&gt;</td>
</tr>
<tr>
<td><code>f</code></td>
<td>12</td>
<td><code>U+000C</code></td>
<td>form feed</td>
<td>&lt;FF&gt;</td>
</tr>
<tr>
<td><code>r</code></td>
<td>13</td>
<td><code>U+000D</code></td>
<td>carriage return</td>
<td>&lt;CR&gt;</td>
</tr>
</tbody></table>
</figure>
<p>The production <span class="prod"><span class="nt">CharacterEscape</span> <span class="geq">::</span> <code class="t">c</code> <span class="nt">ControlLetter</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>ch</i> be the character represented by <i>ControlLetter</i>.</li>
<li>Let <i>i</i> be <i>ch</i>'s character value.</li>
<li>Let <i>j</i> be the remainder of dividing <i>i</i> by 32.</li>
<li>Return the character whose character value is <i>j</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">CharacterEscape</span> <span class="geq">::</span> <span class="nt">HexEscapeSequence</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the character whose code is the CV of <i>HexEscapeSequence</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">CharacterEscape</span> <span class="geq">::</span> <span class="nt">RegExpUnicodeEscapeSequence</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the result of evaluating <i>RegExpUnicodeEscapeSequence</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">CharacterEscape</span> <span class="geq">::</span> <span class="nt">IdentityEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the character represented by <i>IdentityEscape</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">RegExpUnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u</code> <span class="nt">LeadSurragate</span> <code class="t">\u</code> <span class="nt">TrailSurragate</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>lead</i> be the result of evaluating <i>LeadSurragate</i>.</li>
<li>Let <i>trail</i> be the result of evaluating <i>TrailSurragate</i>.</li>
<li>Let <i>cp</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-utf16decode">UTF16Decode</a>(<i>lead</i>, <i>trail</i>).</li>
<li>Return the character whose character value is <i>cp</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">RegExpUnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u</code> <span class="nt">Hex4Digits</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the character whose code is the CV of <i>Hex4Digits</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">RegExpUnicodeEscapeSequence</span> <span class="geq">::</span> <code class="t">u{</code> <span class="nt">HexDigits</span> <code class="t">}</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the character whose code is the MV of <i>Hex4Digits</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">LeadSurragate</span> <span class="geq">::</span> <span class="nt">Hex4Digits</span></span> evaluates by evaluating as follows:</p>
<ol class="proc">
<li>Return the character whose code is the CV of <i>Hex4Digits</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">TailSurragate</span> <span class="geq">::</span> <span class="nt">Hex4Digits</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the character whose code is the CV of <i>Hex4Digits</i>.</li>
</ol>
</section>
<section id="sec-decimalescape">
<h1><span class="secnum" id="sec-21.2.2.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-decimalescape" title="link to this section">21.2.2.11</a></span>
DecimalEscape</h1>
<p>The production <span class="prod"><span class="nt">DecimalEscape</span> <span class="geq">::</span> <span class="nt">DecimalIntegerLiteral</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>i</i> be the MV of <i>DecimalIntegerLiteral</i>.</li>
<li>If <i>i</i> is zero, return the EscapeValue consisting of the character U+0000 (NULL).</li>
<li>Return the EscapeValue consisting of the integer <i>i</i>.</li>
</ol>
<p>The definition of “the MV of <span class="nt">DecimalIntegerLiteral</span>” is in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a>.</p>
<div class="note">
<p><span class="nh">NOTE</span> If <code>\</code> is followed by a decimal number <i>n</i> whose first digit is not
<code>0</code>, then the escape sequence is considered to be a backreference. It is an error if <i>n</i> is greater than
the total number of left capturing parentheses in the entire regular expression. <code>\0</code> represents the
&lt;NUL&gt; character and cannot be followed by a decimal digit.</p>
</div>
</section>
<section id="sec-characterclassescape">
<h1><span class="secnum" id="sec-21.2.2.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-characterclassescape" title="link to this section">21.2.2.12</a></span> CharacterClassEscape</h1>
<p>The production <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">d</code></span> evaluates by returning the ten-element set of characters containing the characters
<code>0</code> through <code>9</code> inclusive.</p>
<p>The production <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">D</code></span> evaluates by returning the set of all characters not included in the set returned by <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">d</code></span>
.</p>
<p>The production <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">s</code></span> evaluates by returning the set of characters containing the characters that are on the
right-hand side of the <span class="nt">WhiteSpace</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">11.2</a>) or <span class="nt">LineTerminator</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-line-terminators">11.3</a>) productions.</p>
<p>The production <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">S</code></span> evaluates by returning the set of all characters not included in the set returned by <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">s</code></span>
.</p>
<p>The production <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">w</code></span> evaluates by returning the set of characters containing the sixty-three characters:</p>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">a</span></td>
<td><span style="font-family: monospace">b</span></td>
<td><span style="font-family: monospace">c</span></td>
<td><span style="font-family: monospace">d</span></td>
<td><span style="font-family: monospace">e</span></td>
<td><span style="font-family: monospace">f</span></td>
<td><span style="font-family: monospace">g</span></td>
<td><span style="font-family: monospace">h</span></td>
<td><span style="font-family: monospace">i</span></td>
<td><span style="font-family: monospace">j</span></td>
<td><span style="font-family: monospace">k</span></td>
<td><span style="font-family: monospace">l</span></td>
<td><span style="font-family: monospace">m</span></td>
<td><span style="font-family: monospace">n</span></td>
<td><span style="font-family: monospace">o</span></td>
<td><span style="font-family: monospace">p</span></td>
<td><span style="font-family: monospace">q</span></td>
<td><span style="font-family: monospace">r</span></td>
<td><span style="font-family: monospace">s</span></td>
<td><span style="font-family: monospace">t</span></td>
<td><span style="font-family: monospace">u</span></td>
<td><span style="font-family: monospace">v</span></td>
<td><span style="font-family: monospace">w</span></td>
<td><span style="font-family: monospace">x</span></td>
<td><span style="font-family: monospace">y</span></td>
<td><span style="font-family: monospace">z</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">A</span></td>
<td><span style="font-family: monospace">B</span></td>
<td><span style="font-family: monospace">C</span></td>
<td><span style="font-family: monospace">D</span></td>
<td><span style="font-family: monospace">E</span></td>
<td><span style="font-family: monospace">F</span></td>
<td><span style="font-family: monospace">G</span></td>
<td><span style="font-family: monospace">H</span></td>
<td><span style="font-family: monospace">I</span></td>
<td><span style="font-family: monospace">J</span></td>
<td><span style="font-family: monospace">K</span></td>
<td><span style="font-family: monospace">L</span></td>
<td><span style="font-family: monospace">M</span></td>
<td><span style="font-family: monospace">N</span></td>
<td><span style="font-family: monospace">O</span></td>
<td><span style="font-family: monospace">P</span></td>
<td><span style="font-family: monospace">Q</span></td>
<td><span style="font-family: monospace">R</span></td>
<td><span style="font-family: monospace">S</span></td>
<td><span style="font-family: monospace">T</span></td>
<td><span style="font-family: monospace">U</span></td>
<td><span style="font-family: monospace">V</span></td>
<td><span style="font-family: monospace">W</span></td>
<td><span style="font-family: monospace">X</span></td>
<td><span style="font-family: monospace">Y</span></td>
<td><span style="font-family: monospace">Z</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">0</span></td>
<td><span style="font-family: monospace">1</span></td>
<td><span style="font-family: monospace">2</span></td>
<td><span style="font-family: monospace">3</span></td>
<td><span style="font-family: monospace">4</span></td>
<td><span style="font-family: monospace">5</span></td>
<td><span style="font-family: monospace">6</span></td>
<td><span style="font-family: monospace">7</span></td>
<td><span style="font-family: monospace">8</span></td>
<td><span style="font-family: monospace">9</span></td>
<td><span style="font-family: monospace">_</span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
<p>The production <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">W</code></span> evaluates by returning the set of all characters not included in the set returned by <span class="prod"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <code class="t">w</code></span>
.</p>
</section>
<section id="sec-characterclass">
<h1><span class="secnum" id="sec-21.2.2.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-characterclass" title="link to this section">21.2.2.13</a></span> CharacterClass</h1>
<p>The production <span class="prod"><span class="nt">CharacterClass</span> <span class="geq">::</span> <code class="t">[</code> <span class="nt">ClassRanges</span> <code class="t">]</code></span> evaluates by evaluating <span class="nt">ClassRanges</span> to obtain a CharSet and returning that CharSet and the Boolean <b>false</b>.</p>
<p>The production <span class="prod"><span class="nt">CharacterClass</span> <span class="geq">::</span> <code class="t">[</code> <code class="t">^</code> <span class="nt">ClassRanges</span> <code class="t">]</code></span> evaluates
by evaluating <span class="nt">ClassRanges</span> to obtain a CharSet and returning that CharSet and the Boolean
<b>true</b>.</p>
</section>
<section id="sec-classranges">
<h1><span class="secnum" id="sec-21.2.2.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-classranges" title="link to this section">21.2.2.14</a></span>
ClassRanges</h1>
<p>The production <span class="prod"><span class="nt">ClassRanges</span> <span class="geq">::</span> <span class="grhsannot">[empty]</span></span> evaluates by returning the empty CharSet.</p>
<p>The production <span class="prod"><span class="nt">ClassRanges</span> <span class="geq">::</span> <span class="nt">NonemptyClassRanges</span></span> evaluates by evaluating <span class="nt">NonemptyClassRanges</span> to obtain
a CharSet and returning that CharSet.</p>
</section>
<section id="sec-nonemptyclassranges">
<div class="front">
<h1><span class="secnum" id="sec-21.2.2.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nonemptyclassranges" title="link to this section">21.2.2.15</a></span> NonemptyClassRanges</h1>
<p>The production <span class="prod"><span class="nt">NonemptyClassRanges</span> <span class="geq">::</span> <span class="nt">ClassAtom</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet that is the result of evaluating <i>ClassAtom</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">NonemptyClassRanges</span> <span class="geq">::</span> <span class="nt">ClassAtom</span> <span class="nt">NonemptyClassRangesNoDash</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>ClassAtom</i> to obtain a CharSet <i>A</i>.</li>
<li>Evaluate <i>NonemptyClassRangesNoDash</i> to obtain a CharSet <i>B</i>.</li>
<li>Return the union of CharSets <i>A</i> and <i>B</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">NonemptyClassRanges</span> <span class="geq">::</span> <span class="nt">ClassAtom</span> <code class="t">-</code> <span class="nt">ClassAtom</span></span> ClassRanges evaluates as
follows:</p>
<ol class="proc">
<li>Evaluate the first <i>ClassAtom</i> to obtain a CharSet <i>A</i>.</li>
<li>Evaluate the second <i>ClassAtom</i> to obtain a CharSet <i>B</i>.</li>
<li>Evaluate <i>ClassRanges</i> to obtain a CharSet <i>C</i>.</li>
<li>Call CharacterRange(<i>A</i>, <i>B</i>) and let <i>D</i> be the resulting CharSet.</li>
<li>Return the union of CharSets <i>D</i> and <i>C</i>.</li>
</ol>
</div>
<section id="sec-runtime-semantics-characterrange-abstract-operation">
<h1><span class="secnum" id="sec-21.2.2.15.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-characterrange-abstract-operation" title="link to this section">21.2.2.15.1</a></span> Runtime Semantics: CharacterRange Abstract Operation</h1>
<p>The abstract operation CharacterRange takes two CharSet parameters <var>A</var> and <var>B</var> and performs the
following:</p>
<ol class="proc">
<li>If <i>A</i> does not contain exactly one character or <i>B</i> does not contain exactly one character then throw a
<b>SyntaxError</b> exception.</li>
<li>Let <i>a</i> be the one character in CharSet <i>A</i>.</li>
<li>Let <i>b</i> be the one character in CharSet <i>B</i>.</li>
<li>Let <i>i</i> be the character value of character <i>a</i>.</li>
<li>Let <i>j</i> be the character value of character <i>b</i>.</li>
<li>If <i>i</i> &gt; <i>j</i> then throw a <b>SyntaxError</b> exception.</li>
<li>Return the set containing all characters numbered <i>i</i> through <i>j</i>, inclusive.</li>
</ol>
</section>
</section>
<section id="sec-nonemptyclassrangesnodash">
<h1><span class="secnum" id="sec-21.2.2.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-nonemptyclassrangesnodash" title="link to this section">21.2.2.16</a></span> NonemptyClassRangesNoDash</h1>
<p>The production <span class="prod"><span class="nt">NonemptyClassRangesNoDash</span> <span class="geq">::</span> <span class="nt">ClassAtom</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet that is the result of evaluating <i>ClassAtom</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">NonemptyClassRangesNoDash</span> <span class="geq">::</span> <span class="nt">ClassAtomNoDash</span> <span class="nt">NonemptyClassRangesNoDash</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>ClassAtomNoDash</i> to obtain a CharSet <i>A</i>.</li>
<li>Evaluate <i>NonemptyClassRangesNoDash</i> to obtain a CharSet <i>B</i>.</li>
<li>Return the union of CharSets <i>A</i> and <i>B</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">NonemptyClassRangesNoDash</span> <span class="geq">::</span> <span class="nt">ClassAtomNoDash</span> <code class="t">-</code> <span class="nt">ClassAtom</span> <span class="nt">ClassRanges</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>ClassAtomNoDash</i> to obtain a CharSet <i>A</i>.</li>
<li>Evaluate <i>ClassAtom</i> to obtain a CharSet <i>B</i>.</li>
<li>Evaluate <i>ClassRanges</i> to obtain a CharSet <i>C</i>.</li>
<li>Call CharacterRange(<i>A</i>, <i>B</i>) and let <i>D</i> be the resulting CharSet.</li>
<li>Return the union of CharSets <i>D</i> and <i>C</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> <i>ClassRanges</i> can expand into single <i>ClassAtoms</i> and/or ranges of two
<i>ClassAtoms</i> separated by dashes. In the latter case the <i>ClassRanges</i> includes all characters between the
first <i>ClassAtom</i> and the second <i>ClassAtom</i>, inclusive; an error occurs if either <i>ClassAtom</i> does not
represent a single character (for example, if one is <code>\w</code>) or if the first <i>ClassAtom's</i> character value
is greater than the second <i>ClassAtom's</i> character value.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Even if the pattern ignores case, the case of the two ends of a range is significant
in determining which characters belong to the range. Thus, for example, the pattern <code>/[E-F]/i</code> matches only
the letters <code>E</code>, <code>F</code>, <code>e</code>, and <code>f</code>, while the pattern <code>/[E-f]/i</code>
matches all upper and lower-case letters in the Unicode Basic Latin block as well as the symbols <code>[</code>,
<code>\</code>, <code>]</code>, <code>^</code>, <code>_</code>, and <code>`</code>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 3</span> A <code>-</code> character can be treated literally or it can denote a range. It is
treated literally if it is the first or last character of <span class="nt">ClassRanges</span>, the beginning or end
limit of a range specification, or immediately follows a range specification.</p>
</div>
</section>
<section id="sec-classatom">
<h1><span class="secnum" id="sec-21.2.2.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-classatom" title="link to this section">21.2.2.17</a></span>
ClassAtom</h1>
<p>The production <span class="prod"><span class="nt">ClassAtom</span> <span class="geq">::</span> <code class="t">-</code></span> evaluates by returning the CharSet containing the one character <code>-</code>.</p>
<p>The production <span class="prod"><span class="nt">ClassAtom</span> <span class="geq">::</span> <span class="nt">ClassAtomNoDash</span></span> evaluates by evaluating <span class="nt">ClassAtomNoDash</span> to obtain a
CharSet and returning that CharSet.</p>
</section>
<section id="sec-classatomnodash">
<h1><span class="secnum" id="sec-21.2.2.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-classatomnodash" title="link to this section">21.2.2.18</a></span> ClassAtomNoDash</h1>
<p>The production <span class="prod"><span class="nt">ClassAtomNoDash</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">-</code></span>
evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet containing the character that is <i>SourceCharacter</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">ClassAtomNoDash</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">ClassEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet that is the result of evaluating <i>ClassEscape</i>.</li>
</ol>
</section>
<section id="sec-classescape">
<h1><span class="secnum" id="sec-21.2.2.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-classescape" title="link to this section">21.2.2.19</a></span>
ClassEscape</h1>
<p>The production <span class="prod"><span class="nt">ClassEscape</span> <span class="geq">::</span> <span class="nt">DecimalEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Evaluate <i>DecimalEscape</i> to obtain an EscapeValue <i>E</i>.</li>
<li>If <i>E</i> is not a character then throw a <b>SyntaxError</b> exception.</li>
<li>Let <i>ch</i> be <i>E</i>'s character.</li>
<li>Return the one-element CharSet containing the character <i>ch</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">ClassEscape</span> <span class="geq">::</span> <code class="t">b</code></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet containing the single character &lt;BS&gt; U+0008 (BACKSPACE).</li>
</ol>
<p>The production <span class="prod"><span class="nt">ClassEscape</span> <span class="geq">::</span> <span class="nt">CharacterEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet containing the single character that is the result of evaluating <i>CharacterEscape</i>.</li>
</ol>
<p>The production <span class="prod"><span class="nt">ClassEscape</span> <span class="geq">::</span> <span class="nt">CharacterClassEscape</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Return the CharSet that is the result of evaluating <i>CharacterClassEscape</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> A <i>ClassAtom</i> can use any of the escape sequences that are allowed in the rest of
the regular expression except for <code>\b</code>, <code>\B</code>, and backreferences. Inside a <i>CharacterClass</i>,
<code>\b</code> means the backspace character, while <code>\B</code> and backreferences raise errors. Using a
backreference inside a <i>ClassAtom</i> causes an error.</p>
</div>
</section>
</section>
<section id="sec-regexp-constructor">
<div class="front">
<h1><span class="secnum" id="sec-21.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-constructor" title="link to this section">21.2.3</a></span>
The RegExp Constructor</h1>
<p>The RegExp constructor is the %RegExp% intrinsic object and the initial value of the <code>RegExp</code> property of
the global object. When <code>RegExp</code> is called as a function rather than as a constructor, it creates and
initializes a new RegExp object. Thus the function call <span style="font-family:
monospace"><b>RegExp(</b>…<b>)</b></span> is equivalent to the object creation expression <span style="font-family:
monospace"><b>new&nbsp;RegExp(</b>…<b>)</b></span> with the same arguments. However, if the <b>this</b> value
passed in the call is an Object with a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined</span>, it initializes the <b>this</b> value using the argument values. This permits
<code>RegExp</code> to be used both as factory method and to perform constructor instance initialisation.</p>
<p>The <code>RegExp</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>RegExp</code> behaviour must include a <code>super</code> call to the <code>RegExp</code> constructor to initialize
subclass instances.</p>
</div>
<section id="sec-regexp-pattern-flags">
<h1><span class="secnum" id="sec-21.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-pattern-flags" title="link to this section">21.2.3.1</a></span> RegExp ( pattern, flags )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>func</i> be this <code>RegExp</code> function object.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> does not have a
[[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the value of [[RegExpMatcher]] is not
<b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>pattern</i>) is Object and <i>O</i> has a
[[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and <i>flags</i>
is <b>undefined</b>, then
<ol class="block">
<li>Return <i>pattern</i>;</li>
</ol>
</li>
<li>Let <i>O</i> be the result of calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpalloc">RegExpAlloc</a> with
argument <i>func</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>pattern</i>) is Object and <i>pattern</i> has a
[[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>If the value of <i>pattern’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>flags</i> is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>P</i> be the value of <i>pattern’s</i> [[OriginalSource]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>F</i> be the value of <i>pattern’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>P</i> be <i>pattern</i>.</li>
<li>Let <i>F</i> be <i>flags</i>.</li>
</ol>
</li>
<li>Return the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpinitialize">RegExpInitialize</a> with arguments
<i>O,</i> <i>P</i>, and <i>F</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> If pattern is supplied using a <i>StringLiteral</i>, the usual escape sequence
substitutions are performed before the String is processed by RegExp. If pattern must contain an escape sequence to be
recognized by RegExp, any backslash <code>\</code> characters must be escaped within the <i>StringLiteral</i> to prevent
them being removed when the contents of the <i>StringLiteral</i> are formed.</p>
</div>
</section>
<section id="sec-new-regexp-argumentslist">
<h1><span class="secnum" id="sec-21.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-regexp-argumentslist" title="link to this section">21.2.3.2</a></span> new RegExp( ...argumentsList )</h1>
<p>When <code>RegExp</code> is called as part of a new expression with argument list <var>argumentsList</var> it performs
the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>RegExp</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>RegExp</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
<section id="sec-abstract-operations-for-the-regexp-constructor">
<div class="front">
<h1><span class="secnum" id="sec-21.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-the-regexp-constructor" title="link to this section">21.2.3.3</a></span> Abstract Operations for the RegExp Constructor</h1>
</div>
<section id="sec-regexpalloc">
<h1><span class="secnum" id="sec-21.2.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpalloc" title="link to this section">21.2.3.3.1</a></span> Runtime Semantics: RegExpAlloc Abstract Operation</h1>
<p>When the abstract operation RegExpAlloc with argument <var>constructor</var> is called, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>constructor</i>,
<code>"%RegExpPrototype%"</code>, ( [[RegExpMatcher]], [[OriginalSource]], [[OriginalFlags]])).</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>obj</i>,
<code>"lastIndex"</code>, PropertyDescriptor {[[Writable]]: <b>true</b>, [[Enumberable]]: <b>false</b>,
[[Configurable]]: <b>false}).</b></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> [[RegExpMatcher]] is initially assigned the value <b>undefined</b> as a flag to
indicate that the instance has not yet been initialized by the <b>RegExp</b> constructor. This flag value is never
directly exposed to ECMAScript code; hence implementations may choose to encode the flag in some other manner.</p>
</div>
</section>
<section id="sec-regexpinitialize">
<h1><span class="secnum" id="sec-21.2.3.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpinitialize" title="link to this section">21.2.3.3.2</a></span> Runtime Semantics: RegExpInitialize Abstract Operation</h1>
<p>When the abstract operation RegExpInitialize with arguments <i><span style="font-family: Times New
Roman">obj</span>,</i> <var>pattern</var>, and <var>flags</var> is called, the following steps are taken:</p>
<ol class="proc">
<li>If <i>pattern</i> is <b>undefined</b>, then let <i>P</i> be the empty String.</li>
<li>Else, let <i>P</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>pattern</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>If <i>flags</i> is <b>undefined</b>, then let <i>F</i> be the empty String.</li>
<li>Else, let <i>F</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>flags</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>F</i>).</li>
<li>If <i>F</i> contains any character other than <code>"g"</code>, <code>"i"</code>, <code>"m"</code>,
<code>"u"</code>, or <code>"y"</code> or if it contains the same character more than once, then throw a
<b>SyntaxError</b> exception.</li>
<li>If <i>F</i> contains<code>"u"</code> then let <i>BMP</i> be <b>false</b>, else let <i>BMP</i> be <b>true</b>.</li>
<li>If <i>BMP</i> is <b>true</b>, then
<ol class="block">
<li>Parse <i>P</i> interpreted as UTF-16 encoded Unicode code points using the grammars in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a>. The goal symbol for the parse is <i>Pattern</i>.Throw a <b>SyntaxError</b>
exception if <i>P</i> did not conform to the grammar or if all characters of <i>P</i> where not matched by the
parse.</li>
<li>Let <i>patternCharacters</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements
are the code unit elements of <i>P.</i></li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Parse <i>P</i> interpreted as UTF-16 encoded Unicode code points using the grammars in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a>. The goal symbol for the parse is <i>Pattern</i><sub>[U]</sub>. Throw a
<b>SyntaxError</b> exception if <i>P</i> did not conform to the grammar or if all characters of <i>P</i> where
not matched by the parse.</li>
<li>Let <i>patternCharacters</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements
are the code points of <i>P</i> interpreted as sequence of UTF-16 encoded Unicode code points<i>.</i></li>
</ol>
</li>
<li>Set the value of <i>obj’s</i> [[OriginalSource]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>P</i>.</li>
<li>Set the value of <i>obj’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>F</i>.</li>
<li>Set <i>obj’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to the internal procedure that evaluates the above parse of <i>P</i> by applying the semantics provided
in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics">21.2.2</a> using <i>patternCharacters</i> as the pattern’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <i>SourceCharacter</i> values.and <i>F</i> as the flag
parameters..</li>
<li>Let <i>putStatus</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>obj</i>, <code>"lastIndex"</code>,
0, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
<section id="sec-regexpcreate">
<h1><span class="secnum" id="sec-21.2.3.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpcreate" title="link to this section">21.2.3.3.3</a></span> Runtime Semantics: RegExpCreate Abstract Operation</h1>
<p>When the abstract operation RegExpCreate with arguments <var>P</var> and <var>F</var> is called, the following steps
are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be the result of calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpalloc">RegExpAlloc</a> with
argument <span style="font-family: sans-serif">%RegExp%</span>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Return the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpinitialize">RegExpInitialize</a> with arguments
<i>obj,</i> <i>P</i>, and <i>F</i> .</li>
</ol>
</section>
<section id="sec-escaperegexppattern">
<h1><span class="secnum" id="sec-21.2.3.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-escaperegexppattern" title="link to this section">21.2.3.3.4</a></span> Runtime Semantics: EscapeRegExpPattern Abstract Operation</h1>
<p>When the abstract operation EscapeRegExpPattern with arguments <var>P</var> and <var>F</var> is called, the following
occurs:</p>
<p>Let <var>S</var> be a String in the form of a <span class="nt">Pattern</span> (<span class="nt">Pattern</span><sub>[<span style="font-family: Times New Roman">U</span>]</sub> if <var>F</var> contains
<code>"u"</code>) equivalent to <var>P</var> interpreted as UTF-16 encoded Unicode code points, in which certain code
points are escaped as described below. <var>S</var> may or may not be identical to <var>P</var>; however, the internal
procedure that would result from evaluating <var>S</var> as a <span class="nt">Pattern</span> (<span class="nt">Pattern</span><sub>[<span style="font-family: Times New Roman">U</span>]</sub> if <var>F</var> contains
<code>"u"</code>) must behave identically to the internal procedure given by the constructed object's [[RegExpMatcher]]
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. Separate calls to this abstract operation
using the same values for <var>P</var> and <var>F</var> must produce identical results.</p>
<p>The characters <code>/</code> or any <span class="nt">LineTerminator</span> occurring in the pattern shall be escaped
in <var>S</var> as necessary to ensure that the String value formed by concatenating the Strings <code>"/"</code>,
<var>S</var>, <code>"/"</code>, and <var>F</var> can be parsed (in an appropriate lexical context) as a <span class="nt">RegularExpressionLiteral</span> that behaves identically to the constructed regular expression. For example,
if <var>P</var> is <code>"/"</code>, then <var>S</var> could be <code>"\/"</code> or <code>"\u002F"</code>, among other
possibilities, but not <code>"/"</code>, because <code>///</code> followed by <var>F</var> would be parsed as a <span class="nt">SingleLineComment</span> rather than a <span class="nt">RegularExpressionLiteral</span>. If <var>P</var> is
the empty String, this specification can be met by letting <var>S</var> be <code>"(?:)"</code>.</p>
<p>Return <var>S</var>.</p>
</section>
</section>
</section>
<section id="sec-properties-of-the-regexp-constructor">
<div class="front">
<h1><span class="secnum" id="sec-21.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-constructor" title="link to this section">21.2.4</a></span> Properties of the RegExp Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
RegExp constructor is the standard built-in Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>2</b>), the RegExp constructor has the following
properties:</p>
</div>
<section id="sec-regexp.prototype">
<h1><span class="secnum" id="sec-21.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype" title="link to this section">21.2.4.1</a></span> RegExp.prototype</h1>
<p>The initial value of <code>RegExp.prototype</code> is the RegExp prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-prototype-object">21.2.5</a>).</p>
<p>This property shall have the attributes {&nbsp;[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>,
[[Configurable]]: <b>false</b>&nbsp;}.</p>
</section>
<section id="sec-regexp-@@create">
<h1><span class="secnum" id="sec-21.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp-@@create" title="link to this section">21.2.4.2</a></span>
RegExp[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following:</p>
<ol class="proc">
<li>Return the result of calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpalloc">RegExpAlloc</a> with argument
<i>F</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-the-regexp-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-21.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-prototype-object" title="link to this section">21.2.5</a></span> Properties of the RegExp Prototype Object</h1>
<p>The RegExp prototype object is an ordinary object. It is not a RegExp instance and does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or any of the other internal slots of RegExp
instance objects.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
RegExp prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>The RegExp prototype object does not have a <code>valueOf</code> property of its own; however, it inherits the
<code>valueOf</code> property from the Object prototype object.</p>
</div>
<section id="sec-regexp.prototype.constructor">
<h1><span class="secnum" id="sec-21.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.constructor" title="link to this section">21.2.5.1</a></span> RegExp.prototype.constructor</h1>
<p>The initial value of <code>RegExp.prototype.constructor</code> is the standard built-in <code>RegExp</code>
constructor.</p>
</section>
<section id="sec-regexp.prototype.exec">
<div class="front">
<h1><span class="secnum" id="sec-21.2.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.exec" title="link to this section">21.2.5.2</a></span> RegExp.prototype.exec ( string )</h1>
<p>Performs a regular expression match of <var>string</var> against the regular expression and returns an Array object
containing the results of the match, or <b>null</b> if <var>string</var> did not match.</p>
<p>The String <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>)</span> is
searched for an occurrence of the regular expression pattern as follows:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>R’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>S</i> be the value of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Return the result of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpexec">RegExpExec</a>(<i>R</i>, <i>S</i><b>)</b>.</li>
</ol>
</div>
<section id="sec-regexpexec">
<h1><span class="secnum" id="sec-21.2.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpexec" title="link to this section">21.2.5.2.1</a></span> Runtime Semantics: RegExpExec Abstract Operation</h1>
<p>The abstract operation RegExpExec with arguments <var>R</var>, <var>S</var> and optional argument <var>ignore</var>
performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>R</i> is an initialized RegExp instance.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S</i>) is String.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If <i>ignore</i> is present, then <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>ignore</i>) is Boolean.</li>
<li>If <i>ignore</i> was not passed, let <i>ignore</i> be <b>false</b>..</li>
<li>Let <i>length</i> be the number of code units in <i>S</i>.</li>
<li>If <i>ignore</i> is <b>true<i>,</i></b> then let <i>global</i> be <b>false</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>lastIndex</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>,<span style="font-family:
monospace">"<b>lastIndex</b>"</span>).</li>
<li>Let <i>i</i> be the value of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>lastIndex</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>i</i>).</li>
<li>Let <i>global</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>, <span style="font-family:
monospace">"<b>global"</b></span><b>))</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>global</i>).</li>
</ol>
</li>
<li>Let <i>sticky</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>,
<span style="font-family: monospace">"<b>sticky"</b></span><b>))</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>sticky</i>).</li>
<li>If <i>global</i> is <b>false</b> and <i>sticky</i> is <b>false</b>, then let <i>i</i> = 0.</li>
<li>Let <i>matcher</i> be the value of <i>R’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a></li>
<li>If <i>flags</i> contains <code>"u"</code> then let <i>fullUnicode</i> be <b>true</b>, else let <i>fullUnicode</i>
be <b>false.</b></li>
<li>Let <i>matchSucceeded</i> be <b>false</b>.</li>
<li>Repeat, while <i>matchSucceeded</i> is <b>false</b>
<ol class="block">
<li>If <i>i</i> &lt; 0 or <i>i</i> &gt; <i>length</i>, then
<ol class="block">
<li>If <i>ignore</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>putStatus</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>R</i>, <span style="font-family: monospace">"<b>lastIndex"</b></span>, 0, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Return <b>null</b>.</li>
</ol>
</li>
<li>Let <i>r</i> be the result of calling <i>matcher</i> with arguments <i>S</i> and <i>i</i>.</li>
<li>If <i>r</i> is <b>failure</b>, then
<ol class="block">
<li>If <i>sticky</i> is <b>true</b>, then
<ol class="block">
<li>If <i>ignore</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>putStatus</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>R</i>, <span style="font-family: monospace">"<b>lastIndex"</b></span>, 0, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Return <b>null</b>.</li>
</ol>
</li>
<li>Let <i>i</i> = <i>i</i>+1.</li>
</ol>
</li>
<li>else
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>r</i> is a State.</li>
<li>Set <i>matchSucceeded</i> to <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>e</i> be <i>r</i>'s <i>endIndex</i> value.</li>
<li>If <i>fullUnicode</i> is <b>true</b>, then
<ol class="block">
<li><i>e</i> is a index into the <i>Input</i> character list, derived from <i>S</i>, matched by <i>matcher</i>.
Let <i>eUTF</i> be the smallest index into <i>S</i> that corresponds to the character at element <i>e</i> of
<i>Input</i>. If <i>e</i> isgreater than the length of <i>Input</i>, then <i>eUTF</i> is 1 + the number of
code units in <i>S.</i></li>
<li>Let <i>e</i> be <i>eUTF</i>.<i>.</i></li>
</ol>
</li>
<li>If <i>global</i> is <b>true</b> or <i>sticky</i> is <b>true</b>,
<ol class="block">
<li>Let <i>putStatus</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>R</i>, <span style="font-family: monospace">"<b>lastIndex"</b></span>, <i>e</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Let <i>n</i> be the length of <i>r</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>. (This is the same value as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-notation">21.2.2.1</a>'s <i>NcapturingParens</i>.)</li>
<li>Let <i>A</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>n</i> +
1).</li>
<li>Let <i>matchIndex</i> be <i>i</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The following <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a> calls will not result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>index"</b></span>, <i>matchIndex</i>).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>input"</b></span>, <i>S</i>).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>length"</b></span>, <i>n</i> + 1).</li>
<li>Let <i>matchedSubstr</i> be the matched substring (i.e. the portion of <i>S</i> between offset <i>i</i> inclusive
and offset <i>e</i> exclusive).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>0"</b></span>, <i>matchedSubstr</i>).</li>
<li>For each integer <i>i</i> such that <i>i</i> &gt; 0 and <i>i</i> ≤ <i>n</i>
<ol class="block">
<li>Let <i>captureI</i> be <i>i</i><sup>th</sup> element of <i>r</i>'s <i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>fullUnicode</i> is <b>true</b>,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>captureI</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of code points.</li>
<li>Let <i>captureString</i> be a string whose elsments are the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">UTF-16 encoding</a> of the code points of
<i>capture.</i></li>
</ol>
</li>
<li>Else, <i>fullUnicode</i> is <b>false</b>,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>captureI</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of code units.</li>
<li>Let <i>captureString</i> be a string whose elements are the code units of <i>capture.</i></li>
</ol>
</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>i</i>) , <i>captureString</i>).</li>
</ol>
</li>
<li>Return <i>A</i>.</li>
</ol>
</section>
</section>
<section id="sec-get-regexp.prototype.global">
<h1><span class="secnum" id="sec-21.2.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.global" title="link to this section">21.2.5.3</a></span> get RegExp.prototype.global</h1>
<p><code>RegExp.prototype.global</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have an [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>flags</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>flags</i> contains the character <code>"g"</code>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-get-regexp.prototype.ignorecase">
<h1><span class="secnum" id="sec-21.2.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.ignorecase" title="link to this section">21.2.5.4</a></span> get RegExp.prototype.ignoreCase</h1>
<p><code>RegExp.prototype.ignoreCase</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have an [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>flags</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>flags</i> contains the character <code>"i"</code>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-regexp.prototype.match">
<h1><span class="secnum" id="sec-21.2.5.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.match" title="link to this section">21.2.5.5</a></span> RegExp.prototype.match ( string )</h1>
<p>When the <code>match</code> method is called with argument <var>string</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>rx</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rx)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>rx</i> does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>rx’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>global</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>rx</i>,
<code>"global"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>global</i>).</li>
<li>If <i>global</i> is not <b>true</b>, then
<ol class="block">
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpexec">RegExpExec</a>(<i>rx</i>, <i>S</i>) (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.exec">see 21.2.5.2</a>).</li>
</ol>
</li>
<li>Else <i>global</i> is <b>true</b>,
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>rx</i>, <code>"lastIndex"</code>, 0,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>previousLastIndex</i> be 0.</li>
<li>Let <i>n</i> be 0.</li>
<li>Let <i>lastMatch</i> be <b>true</b>.</li>
<li>Repeat, while <i>lastMatch</i> is <b>true</b>
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpexec">RegExpExec</a>(<i>rx</i>, <i>S</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <i>result</i> is <b>null</b>, then set <i>lastMatch</i> to <b>false</b>.</li>
<li>Else <i>result</i> is not <b>null</b>,
<ol class="block">
<li>Let <i>thisIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>rx</i>, <code>"lastIndex"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>thisIndex</i>).</li>
<li>If <i>thisIndex</i> = <i>previousLastIndex</i> then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>rx</i>, <code>"lastIndex"</code>,
<i>thisIndex</i>+1, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Set <i>previousLastIndex</i> to <i>thisIndex</i>+1.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Set <i>previousLastIndex</i> to <i>thisIndex</i>.</li>
</ol>
</li>
<li>Let <i>matchStr</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>result</i>, <code>"0"</code>).</li>
<li>Let <i>defineStatus</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>,
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>matchStr</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Increment <i>n</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>n</i> = 0, then return <b>null</b>.</li>
<li>Return <i>A</i>.</li>
</ol>
</li>
</ol>
</section>
<section id="sec-get-regexp.prototype.multiline">
<h1><span class="secnum" id="sec-21.2.5.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.multiline" title="link to this section">21.2.5.6</a></span> get RegExp.prototype.multiline</h1>
<p><code>RegExp.prototype.multiline</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have an [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>flags</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>flags</i> contains the character <code>"m"</code>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-regexp.prototype.replace">
<h1><span class="secnum" id="sec-21.2.5.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.replace" title="link to this section">21.2.5.7</a></span> RegExp.prototype.replace ( string, replaceValue )</h1>
<p>When the <code>replace</code> method is called with arguments <var>string</var> and <var>replaceValue</var> the
following steps are taken:</p>
<ol class="proc">
<li>Let <i>rx</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rx)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>rx</i> does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>rx’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>nCaptures</i> be the number of left capturing parentheses in <i>rx</i> (using <i>NcapturingParens</i> as
specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-notation">21.2.2.1</a>)</li>
<li>Let <i>S</i> be the value of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>functionalReplace</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>replaceValue</i>).</li>
<li>Let <i>global</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>rx</i>,
<code>"global"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>global</i>).</li>
<li>Let <i>accumulatedResult</i> be the empty Sring value.</li>
<li>Let <i>nextSrcPosition</i> be 0.</li>
<li>If <i>global</i> is <b>true</b>,then
<ol class="block">
<li>Let <i>putStatus</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>rx</i>,
<code>"lastIndex"</code>, 0, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Let <i>previousLastIndex</i> be 0.</li>
<li>Let <i>done</i> be <b>false</b>.</li>
<li>Repeat, while <i>done</i> is <b>false</b>
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpexec">RegExpExec</a>(<i>rx</i>, <i>S</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <i>result</i> is <b>null</b>, then set <i>done</i> to <b>true</b>.</li>
<li>Else <i>result</i> is not <b>null</b>,
<ol class="block">
<li>If <i>global</i> is <b>true</b>,then
<ol class="block">
<li>Let <i>thisIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>rx</i>, <code>"lastIndex"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>thisIndex</i>).</li>
<li>If <i>thisIndex</i> = <i>previousLastIndex</i> then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>rx</i>, <code>"lastIndex"</code>,
<i>thisIndex</i>+1, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Set <i>previousLastIndex</i> to <i>thisIndex</i>+1.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Set <i>previousLastIndex</i> to <i>thisIndex</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>sub</i> be GetRegExpSubstitution(<i>result</i>).</li>
<li>Let <i>matched</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>result</i>, <code>"0"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>matched</i>).</li>
<li>Let <i>position</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>result</i>,
<code>"index"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>position</i>).</li>
<li>Let <i>n</i> be 0.</li>
<li>Let <i>captures</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Repeat while <i>n</i>&lt; <i>nCaptures</i>
<ol class="block">
<li>Let <i>capN</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>result</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>capN</i>).</li>
<li>Append <i>capN</i> as the last element of <i>captures.</i></li>
<li>Let <i>n</i> be <i>n</i>+1</li>
</ol>
</li>
<li>If <i>functionalReplace</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>replacerArgs</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
(<i>matched</i>).</li>
<li>Append in list order the elements of <i>captures</i> to the end of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> <i>replacerArgs</i>.</li>
<li>Append <i>position</i> and <i>string</i> as the last two element of <i>replacerArgs.</i></li>
<li>Let <i>replValue</i> be the result of calling the [[Call]] internal method of <i>replaceValue</i>
passing <b>undefined</b> as the <b>this</b> value and <i>replacerArgs</i> as the argument list.</li>
<li>Let <i>replacement</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>replValue</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>replacement</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getreplacesubstitution">GetReplaceSubstitution</a>(<i>matched</i>, <i>string</i>,
<i>position</i>, <i>captures</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>re</i> replacement <i>plStr</i>).</li>
<li>Let <i>matchLength</i> be the number of code units in <i>matched</i>.</li>
<li>Return the Record {[[position]]: <i>position</i>, [[matchLength]]: <i>matchLength</i>, [[replacement]]:
<i>replString</i>]].</li>
<li>Let <i>accumulatedResult</i> be the String formed by concatenating the code units of the current value of
<i>accumulatedResult</i> with the substring of <i>S</i> consisting of the code units from
<i>nextSrcPosition</i> (inclusive) up to <i>position</i> (exclusive) and with the code units of
<i>sub</i>.[[ replacement]].</li>
<li>Let <i>nextSrcPosition</i> be <i>position</i> + <i>matchLength</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Return the String formed by concatenating the code units of <i>accumulatedResult</i> with the substring of <i>S</i>
consisting of the code units from <i>nextSrcPosition</i> (inclusive) up through the final code unit of <i>S</i>
(inclusive). The substring may be empty.</li>
</ol>
<p class="Note">If the <code>global</code> flag of this RegExp object is <b>true</b>, the search is done in the same
manner as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.match">RegExp.prototype.match</a></code>, including the update of
<b>lastIndex</b>.</p>
</section>
<section id="sec-regexp.prototype.search">
<h1><span class="secnum" id="sec-21.2.5.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.search" title="link to this section">21.2.5.8</a></span> RegExp.prototype.search ( S )</h1>
<p>When the search method is called with argument <var>S</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>rx</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rx)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>rx</i> does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>rx’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>string</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>S</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>string</i>).</li>
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpexec">RegExpExec</a>(<i>rx</i>, <i>string</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>If <i>result</i> is <b>null</b>, return –1.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>result</i>, <code>"index"</code>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>lastIndex</code> and <code>global</code> properties of this RegExp object are
ignored when performing the search. The <code>lastIndex</code> property is left unchanged.</p>
</div>
</section>
<section id="sec-get-regexp.prototype.source">
<h1><span class="secnum" id="sec-21.2.5.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.source" title="link to this section">21.2.5.9</a></span> get RegExp.prototype.source</h1>
<p><code>RegExp.prototype.source</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have an [[OriginalSource]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>R</i> does not have an [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>src</i> be the value of <i>R’s</i> [[OriginalSource]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If either <i>src</i> or <i>flags</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-escaperegexppattern">EscapeRegExpPattern</a> with
arguments <i>src</i> and <i>flags</i>.</li>
</ol>
</section>
<section id="sec-regexp.prototype.split">
<h1><span class="secnum" id="sec-21.2.5.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.split" title="link to this section">21.2.5.10</a></span> RegExp.prototype.split ( string, limit )</h1>
<p>Returns an Array object into which substrings of the result of converting <var>string</var> to a String have been
stored. The substrings are determined by searching from left to right for matches of the <b>this</b> value regular
expression; these occurrences are not part of any substring in the returned array, but serve to divide up the String
value.</p>
<p>The <b>this</b> value may be an empty regular expression or a regular expression that can match an empty String. In
this case, regular expression does not match the empty substring at the beginning or end of the input String, nor does it
match the empty substring at the end of the previous separator match. (For example, if the regular expression matches the
empty String, the String is split up into individual code unit elements; the length of the result array equals the length
of the String, and each substring contains one code unit.) Only the first match at a given position of the <b>this</b>
String is considered, even if backtracking could yield a non-empty-substring match at that position. (For example,
<code>/a*?/.split("ab")</code> evaluates to the array <code>["a","b"]</code>, while <code>/a*/.split("ab")</code>
evaluates to the array<code>["","b"]</code>.)</p>
<p>If the <var>string</var> is (or converts to) the empty String, the result depends on whether the regular expression can
match the empty String. If it can, the result array contains no elements. Otherwise, the result array contains one
element, which is the empty String.</p>
<p>If the regular expression that contains capturing parentheses, then each time <var>separator</var> is matched the
results (including any <b>undefined</b> results) of the capturing parentheses are spliced into the output array.
For&nbsp;example,</p>
<pre>/&lt;(\/)?([^&lt;&gt;]+)&gt;/.split("A&lt;B&gt;bold&lt;/B&gt;and&lt;CODE&gt;coded&lt;/CODE&gt;")</pre>
<p>evaluates to the array</p>
<pre>["A", undefined, "B", "bold", "/", "B", "and", undefined,<br> "CODE", "coded", "/", "CODE", ""]</pre>
<p>If <var>limit</var> is not <b>undefined</b>, then the output array is truncated so that it contains no more than
<var>limit</var> elements.</p>
<p>When the <code>split</code> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>rx</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>rx)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>rx</i> does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>rx’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>matcher</i> be the value of <i>rx’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>A</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a> with argument
0.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>lengthA</i> be 0.</li>
<li>If <i>limit</i> is <b>undefined</b>, let <i>lim</i> = 2<sup>53</sup>–1; else let <i>lim</i> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>limit</i>).</li>
<li>Let <i>s</i> be the number of elements in <i>S</i>.</li>
<li>Let <i>p</i> = 0.</li>
<li>If <i>lim</i> = 0, return <i>A</i>.</li>
<li>If <i>s</i> = 0, then
<ol class="block">
<li>Let <i>z</i> be the result of calling the <i>matcher</i> with arguments <i>S</i> and 0.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>z</i>).</li>
<li>If <i>z</i> is not <b>failure</b>, return <i>A</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The following call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <span style="font-family:
monospace">"<b>0</b>"</span>, <i>S</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
</li>
<li>Let <i>q</i> = <i>p</i>.</li>
<li>Repeat, while <i>q</i> ≠ <i>s</i>
<ol class="block">
<li>Let <i>z</i> be the result of calling the <i>matcher</i> with arguments <i>S</i> and <i>q</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>z</i>).</li>
<li>If <i>z</i> is <b>failure</b>, then let <i>q</i> = <i>q</i>+1.</li>
<li>Else <i>z</i> is not <b>failure</b>,
<ol class="block">
<li><i>z</i> must be a State. Let <i>e</i> be <i>z</i>'s <i>endIndex</i> and let <i>cap</i> be <i>z</i>'s
<i>captures</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>e</i> = <i>p</i>, then let <i>q</i> = <i>q</i>+1.</li>
<li>Else <i>e</i> ≠ <i>p</i>,
<ol class="block">
<li>Let <i>T</i> be a String value equal to the substring of <i>S</i> consisting of the elements at
positions <i>p</i> (inclusive) through <i>q</i> (exclusive).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The following call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lengthA</i>), <i>T</i>).</li>
<li>If <i>lengthA</i> = <i>lim</i>, return <i>A</i>.</li>
<li>Let <i>p</i> = <i>e</i>.</li>
<li>Let <i>i</i> = 0.</li>
<li>Repeat, while <i>i</i> is not equal to the number of elements in <i>cap</i>.
<ol class="block">
<li>Let <i>i</i> = <i>i</i>+1.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The following call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lengthA</i>), <i>cap</i>[<i>i</i>]).</li>
<li>Increment <i>lengthA</i> by 1.</li>
<li>If <i>lengthA</i> = <i>lim</i>, return <i>A</i>.</li>
</ol>
</li>
<li>Let <i>q</i> = <i>p</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>T</i> be a String value equal to the substring of <i>S</i> consisting of the elements at positions <i>p</i>
(inclusive) through <i>s</i> (exclusive).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The following call will never result in an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lengthA</i>), <i>T</i> ).</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>split</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The <code>split</code> method ignores the value of the <code>global</code> property of
this RegExp object.</p>
</div>
</section>
<section id="sec-get-regexp.prototype.sticky">
<h1><span class="secnum" id="sec-21.2.5.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.sticky" title="link to this section">21.2.5.11</a></span> get RegExp.prototype.sticky</h1>
<p><code>RegExp.prototype.sticky</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have an [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>flags</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>flags</i> contains the character <code>"y"</code>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-regexp.prototype.test">
<h1><span class="secnum" id="sec-21.2.5.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.test" title="link to this section">21.2.5.12</a></span> RegExp.prototype.test( string )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>match</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>R</i>, <code>"exec"</code>,
(<i>string</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>match</i>).</li>
<li>If <i>match</i> is not <b>null</b>, then return <b>true</b>; else return <b>false</b>.</li>
</ol>
</section>
<section id="sec-regexp.prototype.tostring">
<h1><span class="secnum" id="sec-21.2.5.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.tostring" title="link to this section">21.2.5.13</a></span> RegExp.prototype.toString ( )</h1>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have a [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>R’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>pattern</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>,
<code>"source"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>pattern</i>).</li>
<li>Let <i>result</i> be the String value formed by concatenating <span style="font-family:
monospace">"<b>/</b>"</span>, <i>pattern</i>, and <span style="font-family: monospace">"<b>/</b>"</span>.</li>
<li>Let <i>global</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>,
<code>"global"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>global</i>).</li>
<li>If <i>global</i> is <b>true</b>, then append <code>"g"</code> as the last character of <i>result</i>.</li>
<li>Let <i>ignoreCase</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>, <code>"ignoreCase"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>ignoreCase</i>).</li>
<li>If <i>ignoreCase</i> is <b>true</b>, then append <code>"i"</code> as the last character of <i>result</i>.</li>
<li>Let <i>multiline</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>, <code>"multiline"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>multiline</i>).</li>
<li>If <i>multiline</i> is <b>true</b>, then append <code>"m"</code> as the last character of <i>result</i>.</li>
<li>Let <i>unicode</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>,
<code>"unicode"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>unicode</i>).</li>
<li>If <i>unicode</i> is <b>true</b>, then append <code>"u"</code> as the last character of <i>result</i>.</li>
<li>Let <i>sticky</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>R</i>,
<code>"sticky"</code>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>sticky</i>).</li>
<li>If <i>sticky</i> is <b>true</b>, then append <code>"y"</code> as the last character of <i>result</i>.</li>
<li>Return <i>result</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The returned String has the form of a <i>RegularExpressionLiteral</i> that evaluates to
another RegExp object with the same behaviour as this object.</p>
</div>
</section>
<section id="sec-get-regexp.prototype.unicode">
<h1><span class="secnum" id="sec-21.2.5.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.unicode" title="link to this section">21.2.5.14</a></span> get RegExp.prototype.unicode</h1>
<p><code>RegExp.prototype.unicode</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>R</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>R)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>R</i> does not have an [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>flags</i> be the value of <i>R’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>flags</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>flags</i> contain the character <code>"u"</code>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-regexp.prototype-@@isregexp">
<h1><span class="secnum" id="sec-21.2.5.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype-@@isregexp" title="link to this section">21.2.5.15</a></span> RegExp.prototype [ @@isRegExp ]</h1>
<p>The initial value of the @@isRegExp property is <span class="value">true</span>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-regexp-instances">
<div class="front">
<h1><span class="secnum" id="sec-21.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-regexp-instances" title="link to this section">21.2.6</a></span> Properties of RegExp Instances</h1>
<p>RegExp instances are ordinary objects that inherit properties from the RegExp prototype object. RegExp instances have
internal slots [[RegExpMatcher]], [[OriginalSource]], and [[OriginalFlags]]. The value of the [[RegExpMatcher]] internal
slot is an implementation dependent representation of the <span class="nt">Pattern</span> of the RegExp object.</p>
<div class="note">
<p><span class="nh">NOTE</span> Prior to the 6<sup>th</sup> Edition, <code>RegExp</code> instances were specified as
having the own data properties <code>source</code>, <code>global</code>, <code>ignoreCase</code>, and
<code>multiline</code>. Those properties are now specified as accessor properties of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype">RegExp.prototype</a>.</p>
</div>
<p>RegExp instances also have the following property:</p>
</div>
<section id="sec-lastindex">
<h1><span class="secnum" id="sec-21.2.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lastindex" title="link to this section">21.2.6.1</a></span>
lastIndex</h1>
<p>The value of the <code>lastIndex</code> property specifies the String position at which to start the next match. It is
coerced to an integer when used (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.exec">see 21.2.5.2</a>). This property shall have the
attributes {&nbsp;[[Writable]]: <b>true</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b>&nbsp;}.</p>
</section>
</section>
</section>
</section>
<section id="sec-indexed-collections">
<div class="front">
<h1><span class="secnum" id="sec-22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-indexed-collections" title="link to this section">22</a></span> Indexed
Collections</h1>
</div>
<section id="sec-array-objects">
<div class="front">
<h1><span class="secnum" id="sec-22.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-objects" title="link to this section">22.1</a></span> Array
Objects</h1>
<p>Array objects are exotic objects that give special treatment to a certain class of property names. See <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects">9.4.2</a> for a definition of this special treatment.</p>
<p>An Array object, <var>O</var>, is said to be <i>sparse</i> if the following algorithm returns <b>true</b>:</p>
<ol class="proc">
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>For each integer <i>i</i> in the range 0≤<i>i</i>&lt;<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>len</i>)
<ol class="block">
<li>Let <i>elem</i> be the result of calling the [[GetOwnProperty]] internal method of <i>O</i> with argument <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>i</i>).</li>
<li>If <i>elem</i> is <b>undefined</b>, return <b>true</b>.</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</div>
<section id="sec-array-constructor">
<div class="front">
<h1><span class="secnum" id="sec-22.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-constructor" title="link to this section">22.1.1</a></span>
The Array Constructor</h1>
<p>The Array constructor is the %Array% intrinsic object and the initial value of the <code>Array</code> property of the
global object. When <code>Array</code> is called as a function rather than as a constructor, it creates and initializes a
new Array object. Thus the function call <span style="font-family: monospace"><b>Array(</b>…<b>)</b></span> is
equivalent to the object creation expression <span style="font-family:
monospace"><b>new&nbsp;Array(</b>…<b>)</b></span> with the same arguments. However, if the <b>this</b> value passed
in the call is an Object with an [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined</span>, it initiallizes the <b>this</b> value using the argument values. This permits
<code>Array</code> to be used both as factory method and to perform constructor instance initialisation.</p>
<p>The <code>Array</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>Array</code> behaviour must include a <code>super</code> call to the <code>Array</code> constructor to initiallize
subclass instances.</p>
</div>
<section id="sec-array-constructor-array">
<h1><span class="secnum" id="sec-22.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-constructor-array" title="link to this section">22.1.1.1</a></span> Array ( )</h1>
<p>This description applies if and only if the Array constructor is called with no arguments.</p>
<ol class="proc">
<li>Let <i>numberOfArgs</i> be the number of arguments passed to this constructor call.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numberOfArgs</i> = 0.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has an
[[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the
value of [[ArrayInitialisationState]] is <b>false</b>, then
<ol class="block">
<li>Set the value of <i>O’s</i> [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>true</b>.</li>
<li>Let <i>array</i> be <i>O</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>F</i> be this function.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%ArrayPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0, <i>proto</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>array</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>array</i>, <code>"length"</code>, 0,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>array</i>.</li>
</ol>
</section>
<section id="sec-array-len">
<h1><span class="secnum" id="sec-22.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-len" title="link to this section">22.1.1.2</a></span> Array
(len)</h1>
<p>This description applies if and only if the Array constructor is called with exactly one argument.</p>
<ol class="proc">
<li>Let <i>numberOfArgs</i> be the number of arguments passed to this constructor call.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numberOfArgs</i> = 1.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has an
[[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the
value of [[ArrayInitialisationState]] is <b>false</b>, then
<ol class="block">
<li>Set the value of <i>O’s</i> [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>true</b>.</li>
<li>Let <i>array</i> be <i>O</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>F</i> be this function.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%ArrayPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0, <i>proto</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>array</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>len</i>) is not Number, then
<ol class="block">
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>array</i>,
<span style="font-family: monospace">"<b>0</b>"</span>, <i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Let <i>intLen</i> be 1.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>intLen</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a>(<i>len</i>).</li>
<li>If <i>intLen</i> ≠ <i>len</i>, then throw a <b>RangeError</b> exception.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>array</i>, <code>"length"</code>, <i>intLen</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>array</i>.</li>
</ol>
</section>
<section id="sec-array-items">
<h1><span class="secnum" id="sec-22.1.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-items" title="link to this section">22.1.1.3</a></span>
Array (...items )</h1>
<p>This description applies if and only if the Array constructor is called with at least two arguments.</p>
<p>When the <code>Array</code> function is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>numberOfArgs</i> be the number of arguments passed to this constructor call.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>numberOfArgs</i> ≥ 2.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> has an
[[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and the
value of [[ArrayInitialisationState]] is <b>false</b>, then
<ol class="block">
<li>Set the value of <i>O’s</i> [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>true</b>.</li>
<li>Let <i>array</i> be <i>O</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>F</i> be this function.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%ArrayPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>array</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>numberOfArgs</i>, <i>proto</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>array</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Let <i>items</i> be a zero-origined <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the
argument items in order.</li>
<li>Repeat, while <i>k</i> &lt; <i>numberOfArgs</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>itemK</i> be <i>k</i><sup>th</sup> element of <i>items</i>.</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>array</i>,
<i>Pk</i>, <i>itemK</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>array</i>, <code>"length"</code>,
<i>numberOfArgs</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>array</i>.</li>
</ol>
</section>
<section id="sec-new-array-argumentslist">
<h1><span class="secnum" id="sec-22.1.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-array-argumentslist" title="link to this section">22.1.1.4</a></span> new Array ( ... argumentsList)</h1>
<p>When <code>Array</code> is called as part of a <code>new</code> expression, it initiallizes a newly created object.</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>Array</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Array</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-array-constructor">
<div class="front">
<h1><span class="secnum" id="sec-22.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-constructor" title="link to this section">22.1.2</a></span> Properties of the Array Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Array
constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>1</b>), the Array constructor has the following
properties:</p>
</div>
<section id="sec-array.from">
<h1><span class="secnum" id="sec-22.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from" title="link to this section">22.1.2.1</a></span>
Array.from ( arrayLike [ , mapfn [ , thisArg ] ] )</h1>
<p>When the <code>from</code> method is called with argument <var>arrayLike</var> and optional arguments <var>mapfn</var>
and <var>thisArg</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>Let <i>items</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>arrayLike</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>items</i>).</li>
<li>If <i>mapfn</i> is <b>undefined</b>, then let <i>mapping</i> be <b>false.</b></li>
<li>else
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>mapfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>mapping</i> be <b>true</b></li>
</ol>
</li>
<li>Let <i>usingIterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isiterable">IsIterable</a>(<i>items</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>usingIterator</i>).</li>
<li>If <i>usingIterator</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with an empty argument
list.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>items</i>, <i>usingIterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <code>"length"</code>,
<i>k</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>If <i>mapping</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>mappedValue</i> be the result of calling the [[Call]] internal method of <i>mapfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
containing <i>nextValue</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>mappedValue</i>).</li>
</ol>
</li>
<li>Else, let <i>mappedValue</i> be <i>nextValue</i>.</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>,
<i>Pk</i>, <i>mappedValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>items</i> is not an Iterator so assume it is an array-like
object.</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with an argument list
containing the single item <i>len</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>len</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>If <i>mapping</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>mappedValue</i> be the result of calling the [[Call]] internal method of <i>mapfn</i> with <i>T</i>
as <i>thisArgument</i> and (<i>kValue</i>, <i>k</i>, <i>items</i>) as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>mappedValue</i>).</li>
</ol>
</li>
<li>Else, let <i>mappedValue</i> be <i>kValue</i>.</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>,
<i>Pk</i>, <i>mappedValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <code>"length"</code>, <i>len</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>from</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>from</code> function is an intentionally generic factory method; it does not
require that its <b>this</b> value be the Array constructor. Therefore it can be transferred to or inherited by any
other constructors that may be called with a single numeric argument.</p>
</div>
</section>
<section id="sec-array.isarray">
<h1><span class="secnum" id="sec-22.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.isarray" title="link to this section">22.1.2.2</a></span>
Array.isArray ( arg )</h1>
<p>The <code>isArray</code> function takes one argument <var>arg</var>, and performs the following:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>arg</i>) is not Object, return <b>false</b>.</li>
<li>If <i>arg</i> is an exotic Array object, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-array.of">
<h1><span class="secnum" id="sec-22.1.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.of" title="link to this section">22.1.2.3</a></span>
Array.of ( ...items )</h1>
<p>When the <code>of</code> method is called with any number of arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with an argument list
containing the single item <i>len</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>len</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <i>Pk</i>).</li>
<li>Let <i>defineStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>,<i>Pk</i>,
<i>kValue</i>.[[value]]).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>defineStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <code>"length"</code>, <i>len</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>of</code> method is <b>0</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The <i>items</i> argument is assumed to be a well-formed rest argument value.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>of</code> function is an intentionally generic factory method; it does not
require that its <b>this</b> value be the Array constructor. Therefore it can be transferred to or inherited by other
constructors that may be called with a single numeric argument.</p>
</div>
</section>
<section id="sec-array.prototype">
<h1><span class="secnum" id="sec-22.1.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype" title="link to this section">22.1.2.4</a></span>
Array.prototype</h1>
<p>The value of <code>Array.prototype</code> is %ArrayPrototype%, the intrinsic Array prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-prototype-object">22.1.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-array-@@create">
<h1><span class="secnum" id="sec-22.1.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-@@create" title="link to this section">22.1.2.5</a></span>
Array[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%ArrayPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<b>undefined</b>, <i>proto</i>).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> Passing <b>undefined</b> as the first argument to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a> causes the [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the array to be initially assigned the value
<b>false</b>. This is a flag used to indicate that the instance has not yet been initiallized by the <code>Array</code>
constructor. This flag value is never directly exposed to ECMAScript code; hence implementations may choose to encode
the flag in any unobservable manner.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The Array <code>@@create</code> function is intentionally generic; it does not require
that its <b>this</b> value be the Array constructor object. It can be transferred to other constructor functions for use
as a <code>@@create</code> method. When used with other constructors, this function will create an exotic Array object
whose [[Prototype]] value is obtained from the associated constructor.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-array-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-22.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-prototype-object" title="link to this section">22.1.3</a></span> Properties of the Array Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Array
prototype object is the intrinsic object %ObjectPrototype%.</p>
<p>The Array prototype object is itself an ordinary object. It is not an Array instance and does not have a
<code>length</code> property .</p>
<div class="note">
<p><span class="nh">NOTE</span> The Array prototype object does not have a <code>valueOf</code> property of its own;
however, it inherits the <code>valueOf</code> property from the standard built-in Object prototype Object.</p>
</div>
</div>
<section id="sec-array.prototype.concat">
<div class="front">
<h1><span class="secnum" id="sec-22.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.concat" title="link to this section">22.1.3.1</a></span> Array.prototype.concat ( ...arguments )</h1>
<p>When the <code>concat</code> method is called with zero or more arguments, it returns an array containing the array
elements of the object followed by the array elements of each argument in order.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>A</i> be <b>undefined</b>.</li>
<li>If <i>O</i> is an exotic Array object, then
<ol class="block">
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>thisRealm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>If <i>thisRealm</i> and the value of <i>C’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> are the same value, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(0).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>A</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>n</i> be 0.</li>
<li>Let <i>items</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose first element is <i>O</i>
and whose subsequent elements are, in left to right order, the arguments that were passed to this function
invocation.</li>
<li>Repeat, while <i>items</i> is not empty
<ol class="block">
<li>Remove the first element from <i>items</i> and let <i>E</i> be the value of the element.</li>
<li>Let <i>spreadable</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconcatspreadable">IsConcatSpreadable</a>(<i>E</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>spreadable</i>).</li>
<li>If <i>spreadable</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>k</i> be 0.</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>E</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>P</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>exists</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>E</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>exists</i>).</li>
<li>If <i>exists</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>subElement</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>E</i>, <i>P</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>subElement</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>
(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>subElement</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Increase <i>n</i> by 1.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>Else <i>E</i> is added as a single item rather than spread,
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a> (<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>E</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Increase <i>n</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <code>"length"</code>, <i>n</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>concat</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The explicit setting of the <code>length</code> property in step 10 is necessary to
ensure that its value is correct in situations where the trailing elements of the result Array are not present.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>concat</code> function is intentionally generic; it does not require that
its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a
method. Whether the <code>concat</code> function can be applied successfully to an exotic object that is not an Array
is implementation-dependent.</p>
</div>
</div>
<section id="sec-isconcatspreadable">
<h1><span class="secnum" id="sec-22.1.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconcatspreadable" title="link to this section">22.1.3.1.1</a></span> IsConcatSpreadable ( O ) Abstract Operation</h1>
<p>The abstract operation IsConcatSpreadable with argument <i>O</i> performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, then return
<b>false</b>.</li>
<li>Let <i>spreadable</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, @@isConcatSpreadable).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>spreadable</i>).</li>
<li>If <i>spreadable</i> is not <b>undefined</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>spreadable</i>).</li>
<li>If <i>O</i> is an exotic Array object, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
</section>
<section id="sec-array.prototype.constructor">
<h1><span class="secnum" id="sec-22.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.constructor" title="link to this section">22.1.3.2</a></span> Array.prototype.constructor</h1>
<p>The initial value of <code>Array.prototype.constructor</code> is the standard built-in <code>Array</code>
constructor.</p>
</section>
<section id="sec-array.prototype.copywithin">
<h1><span class="secnum" id="sec-22.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.copywithin" title="link to this section">22.1.3.3</a></span> Array.prototype.copyWithin (target, start [ , end ] )</h1>
<p>The <code>copyWithin</code> method takes up to three arguments <var>target</var>, <var>start</var> and
<var>end</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <i>end</i> argument is optional with the length of the <b>this</b> object as its
default value. If <i>target</i> is negative, it is treated as <i>length</i>+<i>target</i> where <i>length</i> is the
length of the array. If <i>start</i> is negative, it is treated as <i>length</i>+<i>start</i>. If <i>end</i> is
negative, it is treated as <i>length</i>+<i>end</i>.</p>
</div>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>relativeTarget</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeTarget</i>).</li>
<li>If <i>relativeTarget</i> is negative, let <i>to</i> be max((<i>len</i> + <i>relativeTarget</i>),0); else let
<i>to</i> be min(<i>relativeTarget</i>, <i>len</i>).</li>
<li>Let <i>relativeStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeStart</i>).</li>
<li>If <i>relativeStart</i> is negative, let <i>from</i> be max((<i>len</i> + <i>relativeStart</i>),0); else let
<i>from</i> be min(<i>relativeStart</i>, <i>len</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>relativeEnd</i> be <i>len</i>; else let <i>relativeEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeEnd</i>).</li>
<li>If <i>relativeEnd</i> is negative, let <i>final</i> be max((<i>len</i> + <i>relativeEnd</i>),0); else let
<i>final</i> be min(<i>relativeEnd</i>, <i>len</i>).</li>
<li>Let <i>count</i> be min(<i>final</i>-<i>from</i>, <i>len</i>-<i>to</i>).</li>
<li>If <i>from</i>&lt;<i>to</i> and <i>to</i>&lt;<i>from</i>+<i>count</i>
<ol class="block">
<li>Let <i>direction</i> = -1.</li>
<li>Let <i>from</i> = <i>from</i> + <i>count</i> -1.</li>
<li>Let <i>to</i> = <i>to</i> + <i>count</i> -1.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>direction</i> = 1.</li>
</ol>
</li>
<li>Repeat, while <i>count</i> &gt; 0
<ol class="block">
<li>Let <i>fromKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>from</i>).</li>
<li>Let <i>toKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>to</i>).</li>
<li>Let <i>fromPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>fromKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromPresent</i>).</li>
<li>If <i>fromPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>fromVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>fromKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromVal</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>toKey</i>, <i>fromVal</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else <i>fromPresent</i> is <b>false</b>,
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>,
<i>toKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
</ol>
</li>
<li>Let <i>from</i> be <i>from</i> + <i>direction</i>.</li>
<li>Let <i>to</i> be <i>to</i> + <i>direction</i>.</li>
<li>Let <i>count</i> be <i>count</i> − 1.</li>
</ol>
</li>
<li>Return <i>O</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>copyWithin</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The <code>copyWithin</code> function is intentionally generic; it does not require
that its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a
method. Whether the <code>copyWithin</code> function can be applied successfully to an exotic object that is not an
Array is implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.entries">
<h1><span class="secnum" id="sec-22.1.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.entries" title="link to this section">22.1.3.4</a></span> Array.prototype.entries ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> with the <b>this</b> value as its
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayiterator">CreateArrayIterator</a>(<i>O</i>, <code>"key+value"</code>).</li>
</ol>
</section>
<section id="sec-array.prototype.every">
<h1><span class="secnum" id="sec-22.1.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.every" title="link to this section">22.1.3.5</a></span> Array.prototype.every ( callbackfn [ , thisArg] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that accepts
three arguments and returns a value that is coercible to the Boolean value <b>true</b> or <b>false</b>. <code>every</code>
calls <i>callbackfn</i> once for each element present in the array, in ascending order, until it finds one where
<i>callbackfn</i> returns <b>false</b>. If such an element is found, <code>every</code> immediately returns <b>false</b>.
Otherwise, if <i>callbackfn</i> returned <b>true</b> for all elements, <code>every</code> will return <b>true</b>.
<i>callbackfn</i> is called only for elements of the array which actually exist; it is not called for missing elements of
the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>callbackfn</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>every</code> does not directly mutate the object on which it is called but the object may be mutated
by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>every</code> is set before the first call to <i>callbackfn</i>.
Elements which are appended to the array after the call to <code>every</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed, their value as passed to <i>callbackfn</i> will be the
value at the time <code>every</code> visits them; elements that are deleted after the call to <code>every</code> begins
and before being visited are not visited. <code>every</code> acts like the "for all" quantifier in mathematics. In
particular, for an empty array, it returns <b>true</b>.</p>
<p>When the <code>every</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>testResult</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>testResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>testResult)</i> is <b>false</b>, return <b>false</b>.</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <b>true</b>.</li>
</ol>
<p>The <code>length</code> property of the <code>every</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>every</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>every</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.fill">
<h1><span class="secnum" id="sec-22.1.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.fill" title="link to this section">22.1.3.6</a></span> Array.prototype.fill (value [ , start [ , end ] ] )</h1>
<p>The <code>fill</code> method takes up to three arguments <var>value</var>, <var>start</var> and <var>end</var>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <i>start</i> and <i>end</i> arguments are optional with default values of 0 and the
length of the <b>this</b> object. If <i>start</i> is negative, it is treated as <i>length</i>+<i>start</i> where
<i>length</i> is the length of the array. If <i>end</i> is negative, it is treated as <i>length</i>+<i>end</i>.</p>
</div>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>relativeStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeStart</i>).</li>
<li>If <i>relativeStart</i> is negative, let <i>k</i> be max((<i>len</i> + <i>relativeStart</i>),0); else let <i>k</i>
be min(<i>relativeStart</i>, <i>len</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>relativeEnd</i> be <i>len</i>; else let <i>relativeEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeEnd</i>).</li>
<li>If <i>relativeEnd</i> is negative, let <i>final</i> be max((<i>len</i> + <i>relativeEnd</i>),0); else let
<i>final</i> be min(<i>relativeEnd</i>, <i>len</i>).</li>
<li>Repeat, while <i>k</i> &lt; <i>final</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>Pk</i>, <i>value</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>O</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>fill</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The <code>fill</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>fill</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.filter">
<h1><span class="secnum" id="sec-22.1.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.filter" title="link to this section">22.1.3.7</a></span> Array.prototype.filter ( callbackfn [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that accepts
three arguments and returns a value that is coercible to the Boolean value <b>true</b> or <b>false</b>.
<code>filter</code> calls <i>callbackfn</i> once for each element in the array, in ascending order, and constructs a new
array of all the values for which <i>callbackfn</i> returns <b>true</b>. <i>callbackfn</i> is called only for elements of
the array which actually exist; it is not called for missing elements of the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>callbackfn</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>filter</code> does not directly mutate the object on which it is called but the object may be
mutated by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>filter</code> is set before the first call to <i>callbackfn</i>.
Elements which are appended to the array after the call to <code>filter</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed their value as passed to <i>callbackfn</i> will be the
value at the time <code>filter</code> visits them; elements that are deleted after the call to <code>filter</code> begins
and before being visited are not visited.</p>
<p>When the <code>filter</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>A</i> be <b>undefined</b>.</li>
<li>If <i>O</i> is an exotic Array object, then
<ol class="block">
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>thisRealm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>If <i>thisRealm</i> and the value of <i>C’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> are the same value, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with an argument
list containing the single item 0.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>A</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Let <i>to</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>selected</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with <i>T</i>
as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>selected</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>selected</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a> (<i>A</i>,
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>to</i>), <i>kValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Increase <i>to</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>filter</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>filter</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>filter</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.find">
<h1><span class="secnum" id="sec-22.1.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.find" title="link to this section">22.1.3.8</a></span> Array.prototype.find ( predicate [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>predicate</i> should be a function that accepts
three arguments and returns a value that is coercible to the Boolean value <b>true</b> or <b>false</b>. <code>find</code>
calls <i>predicate</i> once for each element present in the array, in ascending order, until it finds one where
<i>predicate</i> returns <b>true</b>. If such an element is found, <code>find</code> immediately returns that element
value. Otherwise, <code>find</code> returns <b>undefined</b>. <i>predicate</i> is called only for elements of the array
which actually exist; it is not called for missing elements of the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>predicate</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>predicate</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>find</code> does not directly mutate the object on which it is called but the object may be mutated
by the calls to <i>predicate</i>.</p>
<p class="Note">The range of elements processed by <code>find</code> is set before the first call to <i>callbackfn</i>.
Elements that are appended to the array after the call to <code>find</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed, their value as passed to <i>predicate</i> will be the
value at the time that <code>find</code> visits them; elements that are deleted after the call to <code>find</code> begins
and before being visited are not visited.</p>
<p>When the <code>find</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>predicate</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>testResult</i> be the result of calling the [[Call]] internal method of <i>predicate</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>testResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>testResult)</i> is <b>true</b>, return <i>kValue</i>.</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
<p>The <code>length</code> property of the <code>find</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>find</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>find</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.findindex">
<h1><span class="secnum" id="sec-22.1.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.findindex" title="link to this section">22.1.3.9</a></span> Array.prototype.findIndex ( predicate [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>predicate</i> should be a function that accepts
three arguments and returns a value that is coercible to the Boolean value <b>true</b> or <b>false</b>.
<code>findIndex</code> calls <i>predicate</i> once for each element present in the array, in ascending order, until it
finds one where <i>predicate</i> returns <b>true</b>. If such an element is found, <code>findIndex</code> immediately
returns the index of that element value. Otherwise, <code>findIndex</code> returns -1. <i>predicate</i> is called only for
elements of the array which actually exist; it is not called for missing elements of the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>predicate</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>predicate</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>findIndex</code> does not directly mutate the object on which it is called but the object may be
mutated by the calls to <i>predicate</i>.</p>
<p class="Note">The range of elements processed by <code>findIndex</code> is set before the first call to
<i>callbackfn</i>. Elements that are appended to the array after the call to <code>findIndex</code> begins will not be
visited by <i>callbackfn</i>. If existing elements of the array are changed, their value as passed to <i>predicate</i>
will be the value at the time that <code>findIndex</code> visits them; elements that are deleted after the call to
<code>findIndex</code> begins and before being visited are not visited.</p>
<p>When the <code>findIndex</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>predicate</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>testResult</i> be the result of calling the [[Call]] internal method of <i>predicate</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>testResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>testResult)</i> is <b>true</b>, return <i>k</i>.</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return -1.</li>
</ol>
<p>The <code>length</code> property of the <code>findIndex</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>findIndex</code> function is intentionally generic; it does not require that
its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>findIndex</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.foreach">
<h1><span class="secnum" id="sec-22.1.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.foreach" title="link to this section">22.1.3.10</a></span> Array.prototype.forEach ( callbackfn [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that accepts
three arguments. <code>forEach</code> calls <i>callbackfn</i> once for each element present in the array, in ascending
order. <i>callbackfn</i> is called only for elements of the array which actually exist; it is not called for missing
elements of the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>callbackfn</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>forEach</code> does not directly mutate the object on which it is called but the object may be
mutated by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>forEach</code> is set before the first call to <i>callbackfn</i>.
Elements which are appended to the array after the call to <code>forEach</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed, their value as passed to callback will be the value at
the time <code>forEach</code> visits them; elements that are deleted after the call to <code>forEach</code> begins and
before being visited are not visited.</p>
<p>When the <code>forEach</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>funcResult</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>funcResult</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
<p>The <code>length</code> property of the <code>forEach</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>forEach</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>forEach</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.indexof">
<h1><span class="secnum" id="sec-22.1.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.indexof" title="link to this section">22.1.3.11</a></span> Array.prototype.indexOf ( searchElement [ , fromIndex ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <code>indexOf</code> compares <i>searchElement</i>
to the elements of the array, in ascending order, using the Strict Equality Comparison algorithm (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-equality-comparison">7.2.11</a>), and if found at one or more positions, returns the index of the first
such position; otherwise, −1is returned.</p>
<p class="Note">The optional second argument <i>fromIndex</i> defaults to 0 (i.e. the whole array is searched). If it is
greater than or equal to the length of the array, −1is returned, i.e. the array will not be searched. If it is
negative, it is used as the offset from the end of the array to compute <i>fromIndex</i>. If the computed index is less
than 0, the whole array will be searched.</p>
<p>When the <code>indexOf</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <i>len</i> is 0, return −1.</li>
<li>If argument <i>fromIndex</i> was passed let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>fromIndex</i>);
else let <i>n</i> be 0.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>If <i>n</i> ≥ <i>len</i>, return −1.</li>
<li>If <i>n</i> ≥ 0, then
<ol class="block">
<li>Let <i>k</i> be <i>n</i>.</li>
</ol>
</li>
<li>Else <i>n</i>&lt;0,
<ol class="block">
<li>Let <i>k</i> be <i>len</i> - <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>n</i>).</li>
<li>If <i>k</i> &lt; 0, then let <i>k</i> be 0.</li>
</ol>
</li>
<li>Repeat, while <i>k</i>&lt;<i>len</i>
<ol class="block">
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>elementK</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>elementK</i>).</li>
<li>Let <i>same</i> be the result of performing Strict Equality Comparison <i>searchElement</i> ===
<i>elementK</i>.</li>
<li>If <i>same</i> is <b>true,</b> return <i>k</i>.</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return -1.</li>
</ol>
<p>The <code>length</code> property of the <code>indexOf</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>indexOf</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>indexOf</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.join">
<h1><span class="secnum" id="sec-22.1.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.join" title="link to this section">22.1.3.12</a></span> Array.prototype.join (separator)</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The elements of the array are converted to Strings,
and these Strings are then concatenated, separated by occurrences of the <i>separator</i>. If no separator is provided, a
single comma is used as the separator.</p>
<p>The <code>join</code> method takes one argument, <var>separator</var>, and performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <i>separator</i> is <b>undefined</b>, let <i>separator</i> be the single-element String <code>","</code>.</li>
<li>Let <i>sep</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>separator</i>).</li>
<li>If <i>len</i> is zero, return the empty String.</li>
<li>Let <i>element0</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"0"</code>).</li>
<li>If <i>element0</i> is <b>undefined</b> or <b>null</b>, let <i>R</i> be the empty String; otherwise, let <i>R</i> be
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>element0</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>R</i>).</li>
<li>Let <i>k</i> be <code>1</code>.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>S</i> be the String value produced by concatenating <i>R</i> and <i>sep</i>.</li>
<li>Let <i>element</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>)).</li>
<li>If <i>element</i> is <b>undefined</b> or <b>null</b>, then let <i>next</i> be the empty String; otherwise, let
<i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>element</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>Let <i>R</i> be a String value produced by concatenating <i>S</i> and <i>next</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>R</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>join</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>join</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore, it can be transferred to other kinds of objects for use as a method.
Whether the <code>join</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.keys">
<h1><span class="secnum" id="sec-22.1.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.keys" title="link to this section">22.1.3.13</a></span> Array.prototype.keys ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> with the <b>this</b> value as its
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Return the result <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayiterator">CreateArrayIterator</a>(<i>O</i> and <code>"key"</code>).</li>
</ol>
</section>
<section id="sec-array.prototype.lastindexof">
<h1><span class="secnum" id="sec-22.1.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.lastindexof" title="link to this section">22.1.3.14</a></span> Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <code>lastIndexOf</code> compares
<i>searchElement</i> to the elements of the array in descending order using the Strict Equality Comparison algorithm (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-equality-comparison">7.2.11</a>), and if found at one or more positions, returns the index of the last
such position; otherwise, −1is returned.</p>
<p class="Note">The optional second argument <i>fromIndex</i> defaults to the array's length minus one (i.e. the whole
array is searched). If it is greater than or equal to the length of the array, the whole array will be searched. If it is
negative, it is used as the offset from the end of the array to compute <i>fromIndex</i>. If the computed index is less
than 0, −1is returned.</p>
<p>When the <code>lastIndexOf</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <i>len</i> is 0, return -1.</li>
<li>If argument <i>fromIndex</i> was passed let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>fromIndex</i>);
else let <i>n</i> be <i>len</i>-1.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>If <i>n</i> ≥ 0, then let <i>k</i> be min(<i>n</i>, <i>len</i> – 1).</li>
<li>Else <i>n</i> &lt; 0,
<ol class="block">
<li>Let <i>k</i> be <i>len</i> - <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">abs</a>(<i>n</i>).</li>
</ol>
</li>
<li>Repeat, while <i>k</i>≥ 0
<ol class="block">
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>elementK</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>elementK</i>).</li>
<li>Let <i>same</i> be the result of performing Strict Equality Comparison <br><i>searchElement</i> ===
<i>elementK</i>.</li>
<li>If <i>same</i> is <b>true,</b> return <i>k</i>.</li>
</ol>
</li>
<li>Decrease <i>k</i> by 1.</li>
</ol>
</li>
<li>Return -1.</li>
</ol>
<p>The <code>length</code> property of the <code>lastIndexOf</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>lastIndexOf</code> function is intentionally generic; it does not require that
its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>lastIndexOf</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.map">
<h1><span class="secnum" id="sec-22.1.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.map" title="link to this section">22.1.3.15</a></span> Array.prototype.map ( callbackfn [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that accepts
three arguments. <code>map</code> calls <i>callbackfn</i> once for each element in the array, in ascending order, and
constructs a new Array from the results. <i>callbackfn</i> is called only for elements of the array which actually exist;
it is not called for missing elements of the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>callbackfn</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>map</code> does not directly mutate the object on which it is called but the object may be mutated
by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>map</code> is set before the first call to <i>callbackfn</i>.
Elements which are appended to the array after the call to <code>map</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed, their value as passed to <i>callbackfn</i> will be the
value at the time <code>map</code> visits them; elements that are deleted after the call to <code>map</code> begins and
before being visited are not visited.</p>
<p>When the <code>map</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>A</i> be <b>undefined</b>.</li>
<li>If <i>O</i> is an exotic Array object, then
<ol class="block">
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>thisRealm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>If <i>thisRealm</i> and the value of <i>C’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> are the same value, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with an argument
list containing the single item <i>len</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>A</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>len</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>mappedValue</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>mappedValue</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a> (<i>A</i>,
<i>Pk</i>, <i>mappedValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>map</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>map</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>map</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.pop">
<h1><span class="secnum" id="sec-22.1.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.pop" title="link to this section">22.1.3.16</a></span> Array.prototype.pop ( )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The last element of the array is removed from the
array and returned.</p>
<p>When the <code>pop</code> method is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <i>len</i> is zero,
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>, 0,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <b>undefined</b>.</li>
</ol>
</li>
<li>Else <i>len</i> &gt; 0,
<ol class="block">
<li>Let <i>newLen</i> be <i>len</i>–1.</li>
<li>Let <i>indx</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>newLen</i>).</li>
<li>Let <i>element</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>indx</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>element</i>).</li>
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>,
<i>indx</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>, <i>newLen</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>element</i>.</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>pop</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>pop</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.push">
<h1><span class="secnum" id="sec-22.1.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.push" title="link to this section">22.1.3.17</a></span> Array.prototype.push ( ...items )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The arguments are appended to the end of the array,
in the order in which they appear. The new length of the array is returned as the result of the call.</p>
<p>When the <code>push</code> method is called with zero or more arguments the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>n</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>n</i>).</li>
<li>Let <i>items</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements are, in left to
right order, the arguments that were passed to this function invocation.</li>
<li>Repeat, while <i>items</i> is not empty
<ol class="block">
<li>Remove the first element from <i>items</i> and let <i>E</i> be the value of the element.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>E</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>n</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>, <i>n</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>n</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>push</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>push</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>push</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.reduce">
<h1><span class="secnum" id="sec-22.1.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduce" title="link to this section">22.1.3.18</a></span> Array.prototype.reduce ( callbackfn [ , initialValue ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that takes
four arguments. <code>reduce</code> calls the callback, as a function, once for each element present in the array, in
ascending order.</p>
<p class="Note"><i>callbackfn</i> is called with four arguments: the <i>previousValue</i> (or value from the previous call
to <i>callbackfn</i>), the <i>currentValue</i> (value of the current element), the <i>currentIndex</i>, and the object
being traversed. The first time that callback is called, the <i>previousValue</i> and <i>currentValue</i> can be one of
two values. If an <i>initialValue</i> was provided in the call to <code>reduce</code>, then <i>previousValue</i> will be
equal to <i>initialValue</i> and <i>currentValue</i> will be equal to the first value in the array. If no
<i>initialValue</i> was provided, then <i>previousValue</i> will be equal to the first value in the array and
<i>currentValue</i> will be equal to the second. It is a <b>TypeError</b> if the array contains no elements and
<i>initialValue</i> is not provided.</p>
<p class="Note"><code>reduce</code> does not directly mutate the object on which it is called but the object may be
mutated by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>reduce</code> is set before the first call to <i>callbackfn</i>.
Elements that are appended to the array after the call to <code>reduce</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed, their value as passed to <i>callbackfn</i> will be the
value at the time <code>reduce</code> visits them; elements that are deleted after the call to <code>reduce</code> begins
and before being visited are not visited.</p>
<p>When the <code>reduce</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>len</i> is 0 and <i>initialValue</i> is not present, throw a <b>TypeError</b> exception.</li>
<li>Let <i>k</i> be 0.</li>
<li>If <i>initialValue</i> is present, then
<ol class="block">
<li>Set <i>accumulator</i> to <i>initialValue</i>.</li>
</ol>
</li>
<li>Else <i>initialValue</i> is not present,
<ol class="block">
<li>Let <i>kPresent</i> be <b>false</b>.</li>
<li>Repeat, while <i>kPresent</i> is <b>false</b> and <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>accumulator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>accumulator</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>If <i>kPresent</i> is <b>false</b>, throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>accumulator</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<b>undefined</b> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
containing <i>accumulator</i>, <i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>accumulator</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>accumulator</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>reduce</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>reduce</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>reduce</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.reduceright">
<h1><span class="secnum" id="sec-22.1.3.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduceright" title="link to this section">22.1.3.19</a></span> Array.prototype.reduceRight ( callbackfn [ , initialValue ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that takes
four arguments. <code>reduceRight</code> calls the callback, as a function, once for each element present in the array, in
descending order.</p>
<p class="Note"><i>callbackfn</i> is called with four arguments: the <i>previousValue</i> (or value from the previous call
to <i>callbackfn</i>), the <i>currentValue</i> (value of the current element), the <i>currentIndex</i>, and the object
being traversed. The first time the function is called, the <i>previousValue</i> and <i>currentValue</i> can be one of two
values. If an <i>initialValue</i> was provided in the call to <code>reduceRight</code>, then <i>previousValue</i> will be
equal to <i>initialValue</i> and <i>currentValue</i> will be equal to the last value in the array. If no
<i>initialValue</i> was provided, then <i>previousValue</i> will be equal to the last value in the array and
<i>currentValue</i> will be equal to the second-to-last value. It is a <b>TypeError</b> if the array contains no elements
and <i>initialValue</i> is not provided.</p>
<p class="Note"><code>reduceRight</code> does not directly mutate the object on which it is called but the object may be
mutated by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>reduceRight</code> is set before the first call to
<i>callbackfn</i>. Elements that are appended to the array after the call to <code>reduceRight</code> begins will not be
visited by <i>callbackfn</i>. If existing elements of the array are changed by <i>callbackfn</i>, their value as passed to
<i>callbackfn</i> will be the value at the time <code>reduceRight</code> visits them; elements that are deleted after the
call to <code>reduceRight</code> begins and before being visited are not visited.</p>
<p>When the <code>reduceRight</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>len</i> is 0 and <i>initialValue</i> is not present, throw a <b>TypeError</b> exception.</li>
<li>Let <i>k</i> be <i>len</i>-1.</li>
<li>If <i>initialValue</i> is present, then
<ol class="block">
<li>Set <i>accumulator</i> to <i>initialValue</i>.</li>
</ol>
</li>
<li>Else <i>initialValue</i> is not present,
<ol class="block">
<li>Let <i>kPresent</i> be <b>false</b>.</li>
<li>Repeat, while <i>kPresent</i> is <b>false</b> and <i>k</i> ≥ 0
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>accumulator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>accumulator</i>).</li>
</ol>
</li>
<li>Decrease <i>k</i> by 1.</li>
</ol>
</li>
<li>If <i>kPresent</i> is <b>false</b>, throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Repeat, while <i>k</i> ≥ 0
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>accumulator</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<b>undefined</b> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
containing <i>accumulator</i>, <i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>accumulator</i>).</li>
</ol>
</li>
<li>Decrease <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>accumulator</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>reduceRight</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>reduceRight</code> function is intentionally generic; it does not require that
its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>reduceRight</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.reverse">
<h1><span class="secnum" id="sec-22.1.3.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reverse" title="link to this section">22.1.3.20</a></span> Array.prototype.reverse ( )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The elements of the array are rearranged so as to
reverse their order. The object is returned as the result of the call.</p>
<p>When the <code>reverse</code> method is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>middle</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">floor</a>(<i>len</i>/2).</li>
<li>Let <i>lower</i> be <b>0</b>.</li>
<li>Repeat, while <i>lower</i> ≠ <i>middle</i>
<ol class="block">
<li>Let <i>upper</i> be <i>len</i>− <i>lower</i> −1.</li>
<li>Let <i>upperP</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>upper</i>).</li>
<li>Let <i>lowerP</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>lower</i>).</li>
<li>Let <i>lowerValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>lowerP</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lowerValue</i>).</li>
<li>Let <i>upperValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>upper</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>upperValue</i>).</li>
<li>Let <i>lowerExists</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>lowerP</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>lowerExists</i>).</li>
<li>Let <i>upperExists</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>upperP</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>upperExists</i>).</li>
<li>If <i>lowerExists</i> is <b>true</b> and <i>upperExists</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>lowerP</i>, <i>upperValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>upperP</i>, <i>lowerValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else if <i>lowerExists</i> is <b>false</b> and <i>upperExists</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>lowerP</i>, <i>upperValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a> (<i>O</i>,
<i>upperP</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
</ol>
</li>
<li>Else if <i>lowerExists</i> is <b>true</b> and <i>upperExists</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a> (<i>O</i>,
<i>lowerP</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>upperP</i>, <i>lowerValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else both <i>lowerExists</i> and <i>upperExists</i> are <b>false</b>,
<ol class="block">
<li>No action is required.</li>
</ol>
</li>
<li>Increase <i>lower</i> by 1.</li>
</ol>
</li>
<li>Return <i>O</i> .</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>reverse</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore, it can be transferred to other kinds of objects for use as a method.
Whether the <code>reverse</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.shift">
<h1><span class="secnum" id="sec-22.1.3.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.shift" title="link to this section">22.1.3.21</a></span> Array.prototype.shift ( )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The first element of the array is removed from the
array and returned.</p>
<p>When the <code>shift</code> method is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <i>len</i> is zero, then
<ol class="block">
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>, 0,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <b>undefined</b>.</li>
</ol>
</li>
<li>Let <i>first</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <span style="font-family:
monospace">"<b>0</b>"</span>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>first</i>).</li>
<li>Let <i>k</i> be 1.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>from</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>to</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>–1).</li>
<li>Let <i>fromPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromPresent</i>).</li>
<li>If <i>fromPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>fromVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromVal</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>to</i>, <i>fromVal</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else <i>fromPresent</i> is <b>false</b>,
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>,
<i>to</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>len</i>–1)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>, <i>len</i>–1,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>first</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>shift</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>shift</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.slice">
<h1><span class="secnum" id="sec-22.1.3.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.slice" title="link to this section">22.1.3.22</a></span> Array.prototype.slice (start, end)</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The <code>slice</code> method takes two arguments,
<i>start</i> and <i>end</i>, and returns an array containing the elements of the array from element <i>start</i> up to,
but not including, element <i>end</i> (or through the end of the array if <i>end</i> is <b>undefined</b>). If <i>start</i>
is negative, it is treated as <i>length</i>+<i>start</i> where <i>length</i> is the length of the array. If <i>end</i> is
negative, it is treated as <i>length</i>+<i>end</i> where <i>length</i> is the length of the array.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>relativeStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeStart</i>).</li>
<li>If <i>relativeStart</i> is negative, let <i>k</i> be max((<i>len</i> + <i>relativeStart</i>),0); else let <i>k</i>
be min(<i>relativeStart</i>, <i>len</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>relativeEnd</i> be <i>len</i>; else let <i>relativeEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeEnd</i>).</li>
<li>If <i>relativeEnd</i> is negative, let <i>final</i> be max((<i>len</i> + <i>relativeEnd</i>),0); else let
<i>final</i> be min(<i>relativeEnd</i>, <i>len</i>).</li>
<li>Let <i>count</i> be max(<i>final</i> – <i>k</i>, 0).</li>
<li>Let <i>A</i> be <b>undefined</b>.</li>
<li>If <i>O</i> is an exotic Array object, then
<ol class="block">
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>thisRealm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>If <i>thisRealm</i> and the value of <i>C’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> are the same value, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>count</i>).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>A</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>count</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>n</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>final</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>kValue</i> ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
<li>Increase <i>n</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <code>"length"</code>, <i>n</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>slice</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The explicit setting of the <code>length</code> property of the result Array in step
19 is necessary to ensure that its value is correct in situations where the trailing elements of the result Array are
not present.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>slice</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>slice</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.some">
<h1><span class="secnum" id="sec-22.1.3.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.some" title="link to this section">22.1.3.23</a></span> Array.prototype.some ( callbackfn [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that accepts
three arguments and returns a value that is coercible to the Boolean value <b>true</b> or <b>false</b>. <code>some</code>
calls <i>callbackfn</i> once for each element present in the array, in ascending order, until it finds one where
<i>callbackfn</i> returns <b>true</b>. If such an element is found, <code>some</code> immediately returns <b>true</b>.
Otherwise, <code>some</code> returns <b>false</b>. <i>callbackfn</i> is called only for elements of the array which
actually exist; it is not called for missing elements of the array.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>callbackfn</i> is called with three arguments: the value of the element, the index of the element, and
the object being traversed.</p>
<p class="Note"><code>some</code> does not directly mutate the object on which it is called but the object may be mutated
by the calls to <i>callbackfn</i>.</p>
<p class="Note">The range of elements processed by <code>some</code> is set before the first call to <i>callbackfn</i>.
Elements that are appended to the array after the call to <code>some</code> begins will not be visited by
<i>callbackfn</i>. If existing elements of the array are changed, their value as passed to <i>callbackfn</i> will be the
value at the time that <code>some</code> visits them; elements that are deleted after the call to <code>some</code> begins
and before being visited are not visited. <code>some</code> acts like the "exists" quantifier in mathematics. In
particular, for an empty array, it returns <b>false</b>.</p>
<p>When the <code>some</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kPresent</i>).</li>
<li>If <i>kPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>testResult</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>testResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>testResult)</i> is <b>true</b>, return <b>true</b>.</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
<p>The <code>length</code> property of the <code>some</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>some</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>some</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.sort">
<div class="front">
<h1><span class="secnum" id="sec-22.1.3.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort" title="link to this section">22.1.3.24</a></span> Array.prototype.sort (comparefn)</h1>
<p>The elements of this array are sorted. The sort is not necessarily stable (that is, elements that compare equal do
not necessarily remain in their original order). If <var>comparefn</var> is not <b>undefined</b>, it should be a
function that accepts two arguments <var>x</var> and <var>y</var> and returns a negative value if <var>x</var> <span style="font-family: Times New Roman">&lt;</span> <var>y</var>, zero if <var>x</var> <span style="font-family: Times New
Roman">=</span> <var>y</var>, or a positive value if <var>x</var> <span style="font-family: Times New Roman">&gt;</span>
<var>y</var>.</p>
<p>Upon entry, the following steps are performed to initiallize evaluation of the <code>sort</code> function:</p>
<ol class="proc">
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
</ol>
<p>The result of the <code>sort</code> function is then determined as follows:</p>
<p>If <var>comparefn</var> is not <b>undefined</b> and is not a consistent comparison function for the elements of this
array (see below), the behaviour of <code>sort</code> is implementation-defined.</p>
<p>Let <var>proto</var> be the result of calling the [[GetPrototypeOf]] internal method of <var>obj</var>. If
<var>proto</var> is not <b>null</b> and there exists an integer <var>j</var> such that all of the conditions below are
satisfied then the behaviour of <code>sort</code> is implementation-defined:</p>
<ul>
<li><var>obj</var> is sparse (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-objects">22.1</a>)</li>
<li>0 ≤ <var>j</var> &lt; <var>len</var></li>
<li>The result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<var>proto</var>, <span style="font-family: Times New
Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>j</i>))</span> is <b>true</b>.</li>
</ul>
<p>The behaviour of <code>sort</code> is also implementation defined if <var>obj</var> is sparse and any of the
following conditions are true:</p>
<ul>
<li>
<p>The result of the predicate <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o">IsExtensible</a>(<span style="font-family: Times New
Roman"><i>obj</i>)</span> is <b>false</b>.</p>
</li>
<li>
<p>Any array index property of <var>obj</var> whose name is a nonnegative integer less than <var>len</var> is a data
property whose [[Configurable]] attribute is <b>false</b>.</p>
</li>
</ul>
<p>The behaviour of <code>sort</code> is also implementation defined if any array index property of <var>obj</var> whose
name is a nonnegative integer less than <var>len</var> is an accessor property or is a data property whose [[Writable]]
attribute is <b>false</b>.</p>
<p>Otherwise, the following steps are taken:</p>
<ol class="proc">
<li>Perform an implementation-dependent sequence of calls to the [[Get]] and [[Set]] internal methods of <i>obj</i>,
to the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a> abstract operation with <i>obj</i> as the
first argument, and to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a> (described below), where the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> argument for each call to [[Get]], [[Set]], or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a> is the string representation of a nonnegative integer
less than <i>len</i> and where the arguments for calls to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a> are results
of previous calls to the [[Get]] internal method. If <i>obj</i> is not sparse then <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a> must not be called. If any [[Set]] call returns
<b>false</b> a <b>TypeError</b> exception is thrown. If an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> is returned from any of these operations,
it is immediately returned as the value of this function.</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The returned object must have the following two characteristics:</p>
<ul>
<li>
<p>There must be some mathematical permutation <span style="font-family: Times New Roman">π</span> of the
nonnegative integers less than <var>len</var>, such that for every nonnegative integer <var>j</var> less than
<var>len</var>, if property <span style="font-family: Times New Roman">old[<i>j</i>]</span> existed, then <span style="font-family: Times New Roman">new[π(<i>j</i>)]</span> is exactly the same value as <span style="font-family: Times New Roman">old[<i>j</i>]</span><b>,</b>. But if property <span style="font-family: Times
New Roman">old[<i>j</i>]</span> did not exist, then <span style="font-family: Times New
Roman">new[π(<i>j</i>)]</span> does not exist.</p>
</li>
<li>
<p>Then for all nonnegative integers <var>j</var> and <var>k</var>, each less than <var>len</var>, if <span style="font-family: Times New Roman"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a>(<i>j</i>,<i>k</i>) &lt; 0</span>
(see <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a> below), then <span style="font-family: Times New
Roman"><b>π</b>(<i>j</i>) &lt;</span> <span style="font-family: Times New
Roman"><b>π</b>(<i>k</i>)</span>.</p>
</li>
</ul>
<p>Here the notation <span style="font-family: Times New Roman">old[<i>j</i>]</span> is used to refer to the
hypothetical result of calling the [[Get]] internal method of <var>obj</var> with argument <var>j</var> before this
function is executed, and the notation <span style="font-family: Times New Roman">new[<i>j</i>]</span> to refer to the
hypothetical result of calling the [[Get]] internal method of <var>obj</var> with argument <var>j</var> after this
function has been executed.</p>
<p>A function <var>comparefn</var> is a consistent comparison function for a set of values <var>S</var> if all of the
requirements below are met for all values <var>a</var>, <var>b</var>, and <var>c</var> (possibly the same value) in the
set <var>S</var>: The notation <span style="font-family: Times New
Roman"><i>a</i>&nbsp;&lt;<sub>CF</sub></span>&nbsp;<var>b</var> means <span style="font-family: Times New
Roman"><i>comparefn</i>(<i>a</i>,<i>b</i>)&nbsp;&lt;&nbsp;0</span>; <span style="font-family: Times New
Roman"><i>a</i>&nbsp;=<sub>CF</sub></span>&nbsp;<var>b</var> means <span style="font-family: Times New
Roman"><i>comparefn</i>(<i>a</i>,<i>b</i>)&nbsp;=&nbsp;0</span> (of either sign); and <span style="font-family: Times
New Roman"><i>a</i>&nbsp;&gt;<sub>CF</sub></span>&nbsp;<var>b</var> means <span style="font-family: Times New
Roman"><i>comparefn</i>(<i>a</i>,<i>b</i>)&nbsp;&gt;&nbsp;0</span>.</p>
<ul>
<li>
<p>Calling <i>comparefn</i>(<i>a</i>,<i>b</i>) always returns the same value <i>v</i> when given a specific pair of
values <i>a</i> and <i>b</i> as its two arguments. Furthermore, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is Number, and <i>v</i> is not NaN. Note that this
implies that exactly one of <i>a</i>&nbsp;&lt;<sub>CF</sub>&nbsp;<i>b</i>,
<i>a</i>&nbsp;=<sub>CF</sub>&nbsp;<i>b</i>, and <i>a</i>&nbsp;&gt;<sub>CF</sub>&nbsp;<i>b</i> will be true for a
given pair of <i>a</i> and <i>b</i>.</p>
</li>
<li>
<p>Calling <i>comparefn</i>(<i>a</i>,<i>b</i>) does not modify <i>obj</i>.</p>
</li>
<li>
<p><i>a</i>&nbsp;=<sub>CF</sub>&nbsp;<i>a</i> (reflexivity)</p>
</li>
<li>
<p>If <i>a</i>&nbsp;=<sub>CF</sub>&nbsp;<i>b</i>, then <i>b</i>&nbsp;=<sub>CF</sub>&nbsp;<i>a</i> (symmetry)</p>
</li>
<li>
<p>If <i>a</i>&nbsp;=<sub>CF</sub>&nbsp;<i>b</i> and <i>b</i>&nbsp;=<sub>CF</sub>&nbsp;<i>c</i>, then
<i>a</i>&nbsp;=<sub>CF</sub>&nbsp;<i>c</i> (transitivity of =<sub>CF</sub>)</p>
</li>
<li>
<p>If <i>a</i>&nbsp;&lt;<sub>CF</sub>&nbsp;<i>b</i> and <i>b</i>&nbsp;&lt;<sub>CF</sub>&nbsp;<i>c</i>, then
<i>a</i>&nbsp;&lt;<sub>CF</sub>&nbsp;<i>c</i> (transitivity of &lt;<sub>CF</sub>)</p>
</li>
<li>
<p>If <i>a</i>&nbsp;&gt;<sub>CF</sub>&nbsp;<i>b</i> and <i>b</i>&nbsp;&gt;<sub>CF</sub>&nbsp;<i>c</i>, then
<i>a</i>&nbsp;&gt;<sub>CF</sub>&nbsp;<i>c</i> (transitivity of &gt;<sub>CF</sub>)</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE 1</span> The above conditions are necessary and sufficient to ensure that <i>comparefn</i>
divides the set <i>S</i> into equivalence classes and that these equivalence classes are totally ordered.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>sort</code> function is intentionally generic; it does not require that
its <b>this</b> value be an Array object. Therefore, it can be transferred to other kinds of objects for use as a
method. Whether the <code>sort</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</div>
<section id="sec-sortcompare">
<h1><span class="secnum" id="sec-22.1.3.24.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare" title="link to this section">22.1.3.24.1</a></span> Runtime Semantics: SortCompare Abstract Operation</h1>
<p>When the SortCompare abstract operation is called with two arguments <var>j</var> and <var>k</var>, the following
steps are taken:</p>
<ol class="proc">
<li>Let <i>jString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>j</i>).</li>
<li>Let <i>kString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>hasj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>obj</i>, <i>jString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasj</i>).</li>
<li>Let <i>hask</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>obj</i>, <i>kString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hask</i>).</li>
<li>If <i>hasj</i> and <i>hask</i> are both <b>false</b>, then return <b>+0</b>.</li>
<li>If <i>hasj</i> is <b>false</b>, then return 1.</li>
<li>If <i>hask</i> is <b>false</b>, then return –1.</li>
<li>Let <i>x</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>,<i>jString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>kString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>y</i>).</li>
<li>If <i>x</i> and <i>y</i> are both <b>undefined</b>, return <b>+0</b>.</li>
<li>If <i>x</i> is <b>undefined</b>, return 1.</li>
<li>If <i>y</i> is <b>undefined</b>, return −1.</li>
<li>If the argument <i>comparefn</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>comparefn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>Return the result of calling the [[Call]] internal method of <i>comparefn</i> passing <b>undefined</b> as
<i>thisArgument</i> and with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the
values of <i>x</i> and <i>y</i> as the <i>argumentsList</i>.</li>
</ol>
</li>
<li>Let <i>xString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>xString</i>).</li>
<li>Let <i>yString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>y</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>yString</i>).</li>
<li>If <i>xString</i> &lt; <i>yString</i>, return −1.</li>
<li>If <i>xString</i> &gt; <i>yString</i>, return 1.</li>
<li>Return <b>+0</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE </span> Because non-existent property values always compare greater than <b>undefined</b>
property values, and <b>undefined</b> always compares greater than any other value, <b>undefined</b> property values
always sort to the end of the result, followed by non-existent property values.</p>
</div>
</section>
</section>
<section id="sec-array.prototype.splice">
<h1><span class="secnum" id="sec-22.1.3.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.splice" title="link to this section">22.1.3.25</a></span> Array.prototype.splice (start, deleteCount [ , ...items ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> When the <code>splice</code> method is called with
two or more arguments <i>start</i>, <i>deleteCount</i> and (optionally) one or more <i>items</i>,., the <i>deleteCount</i>
elements of the array starting at integer index <i>start</i> are replaced by the arguments <i>items</i>,. An Array object
containing the deleted elements (if any) is returned.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>relativeStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeStart</i>).</li>
<li>If <i>relativeStart</i> is negative, let <i>actualStart</i> be max((<i>len</i> + <i>relativeStart</i>),0); else let
<i>actualStart</i> be min(<i>relativeStart</i>, <i>len</i>).</li>
<li>If the number of actual arguments is 0, then
<ol class="block">
<li>Let <i>actualDeleteCount</i> be 0.</li>
</ol>
</li>
<li>Else if the number of actual arguments is 1, then
<ol class="block">
<li>Let <i>actualDeleteCount</i> be <i>len</i> - <i>actualStart</i></li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>dc</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>deleteCount</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>dc</i>).</li>
<li>Let <i>actualDeleteCount</i> be min(max(<i>dc</i>,0), <i>len</i> – <i>actualStart</i>).</li>
</ol>
</li>
<li>Let <i>A</i> be <b>undefined</b>.</li>
<li>If <i>O</i> is an exotic Array object, then
<ol class="block">
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>thisRealm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</li>
<li>If <i>thisRealm</i> and the value of <i>C’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> are the same value, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>actualDeleteCount</i>).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <i>A</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>A</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(<i>actualDeleteCount</i>).</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>actualDeleteCount</i>
<ol class="block">
<li>Let <i>from</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>actualStart</i>+<i>k</i>).</li>
<li>Let <i>fromPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromPresent</i>).</li>
<li>If <i>fromPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>fromValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O,</i> <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromValue</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>), <i>fromValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Increment <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <code>"length"</code>,
<i>actualDeleteCount</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Let <i>items</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements are, in left to
right order, the portion of the actual argument list starting with <i>item1</i>. The list will be empty if no such
items are present.</li>
<li>Let <i>itemCount</i> be the number of elements in <i>items</i>.</li>
<li>If <i>itemCount</i> &lt; <i>actualDeleteCount</i>, then
<ol class="block">
<li>Let <i>k</i> be <i>actualStart</i>.</li>
<li>Repeat, while <i>k</i> &lt; (<i>len</i> – <i>actualDeleteCount</i>)
<ol class="block">
<li>Let <i>from</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>+<i>actualDeleteCount</i>).</li>
<li>Let <i>to</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>+<i>itemCount</i>).</li>
<li>Let <i>fromPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromPresent</i>).</li>
<li>If <i>fromPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>fromValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromValue</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>to</i>, <i>fromValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else <i>fromPresent</i> is <b>false</b>,
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>,
<i>to</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>k</i> be <i>len</i>.</li>
<li>Repeat, while <i>k</i> &gt; (<i>len</i> – <i>actualDeleteCount</i> + <i>itemCount</i>)
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>–1)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
<li>Decrease <i>k</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>Else if <i>itemCount</i> &gt; <i>actualDeleteCount</i>, then
<ol class="block">
<li>Let <i>k</i> be (<i>len</i> – <i>actualDeleteCount</i>).</li>
<li>Repeat, while <i>k</i> &gt; <i>actualStart</i>
<ol class="block">
<li>Let <i>from</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i> + <i>actualDeleteCount</i> – 1).</li>
<li>Let <i>to</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i> + <i>itemCount</i> – 1)</li>
<li>Let <i>fromPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromPresent</i>).</li>
<li>If <i>fromPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>fromValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromValue</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>to</i>, <i>fromValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else <i>fromPresent</i> is <b>false</b>,
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>,
<i>to</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
</ol>
</li>
<li>Decrease <i>k</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>k</i> be <i>actualStart</i>.</li>
<li>Repeat, while <i>items</i> is not empty
<ol class="block">
<li>Remove the first element from <i>items</i> and let <i>E</i> be the value of that element.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>), <i>E</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>, <i>len</i> –
<i>actualDeleteCount</i> + <i>itemCount</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>A</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>splice</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The explicit setting of the <code>length</code> property of the result Array in step
18 is necessary to ensure that its value is correct in situations where its trailing elements are not present.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>splice</code> function is intentionally generic; it does not require that
its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>splice</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.tolocalestring">
<h1><span class="secnum" id="sec-22.1.3.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.tolocalestring" title="link to this section">22.1.3.26</a></span> Array.prototype.toLocaleString ( )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The elements of the array are converted to Strings
using their <code>toLocaleString</code> methods, and these Strings are then concatenated, separated by occurrences of a
separator String that has been derived in an implementation-defined locale-specific way. The result of calling this
function is intended to be analogous to the result of <code>toString</code>, except that the result of this function is
intended to be locale-specific.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>array</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>array</i>).</li>
<li>Let <i>arrayLen</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>array</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>arrayLen</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>separator</i> be the String value for the list-separator String appropriate for the host environment’s
current locale (this is derived in an implementation-defined way).</li>
<li>If <i>len</i> is zero, return the empty String.</li>
<li>Let <i>firstElement</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>array</i>, <code>"0"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>firstElement</i>).</li>
<li>If <i>firstElement</i> is <b>undefined</b> or <b>null</b>, then
<ol class="block">
<li>Let <i>R</i> be the empty String.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>R</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>firstElement</i>, <code>"toLocaleString"</code>).</li>
<li>Let <i>R</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>R</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>R</i>).</li>
</ol>
</li>
<li>Let <i>k</i> be <code>1</code>.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>S</i> be a String value produced by concatenating <i>R</i> and <i>separator</i>.</li>
<li>Let <i>nextElement</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>array</i>,<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextElement</i>).</li>
<li>If <i>nextElement</i> is <b>undefined</b> or <b>null</b>, then
<ol class="block">
<li>Let <i>R</i> be the empty String.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>R</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>nextElement</i>, <code>"toLocaleString"</code>).</li>
<li>Let <i>R</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>R</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>R</i>).</li>
</ol>
</li>
<li>Let <i>R</i> be a String value produced by concatenating <i>S</i> and <i>R</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>R</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> The first parameter to this function is likely to be used in a future version of this
standard; it is recommended that implementations do not use this parameter position for anything else.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>toLocaleString</code> function is intentionally generic; it does not require
that its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a
method. Whether the <code>toLocaleString</code> function can be applied successfully to an exotic object that is not an
Array is implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.tostring">
<h1><span class="secnum" id="sec-22.1.3.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.tostring" title="link to this section">22.1.3.27</a></span> Array.prototype.toString ( )</h1>
<p>When the <code>toString</code> method is called, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>array</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> on the <b>this</b> value.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>array</i>).</li>
<li>Let <i>func</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>array</i>, <code>"join"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>func</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>func</i>) is <b>false</b>, then let <i>func</i> be the intrinsic
function %ObjectPrototypeToString% (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring">19.1.3.6</a>).</li>
<li>Return the result of calling the [[Call]] internal method of <i>func</i> providing <i>array</i> as
<i>thisArgument</i> and an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> as
<i>argumentsList</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>toString</code> function is intentionally generic; it does not require that
its <b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>toString</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.unshift">
<h1><span class="secnum" id="sec-22.1.3.28"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.unshift" title="link to this section">22.1.3.28</a></span> Array.prototype.unshift ( ...items )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> The arguments are prepended to the start of the
array, such that their order within the array is the same as the order in which they appear in the argument list.</p>
<p>When the <code>unshift</code> method is called with zero or more arguments <var>item1</var>, <var>item2</var>, etc.,
the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>lenVal</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>argCount</i> be the number of actual arguments.</li>
<li>Let <i>k</i> be <i>len</i>.</li>
<li>Repeat, while <i>k</i> &gt; 0,
<ol class="block">
<li>Let <i>from</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>–1).</li>
<li>Let <i>to</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>+<i>argCount</i> –1).</li>
<li>Let <i>fromPresent</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasproperty">HasProperty</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromPresent</i>).</li>
<li>If <i>fromPresent</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>fromValue</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>from</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fromValue</i>).</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <i>to</i>, <i>fromValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
</ol>
</li>
<li>Else <i>fromPresent</i> is <b>false</b>,
<ol class="block">
<li>Let <i>deleteStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-deletepropertyorthrow">DeletePropertyOrThrow</a>(<i>O</i>,
<i>to</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>deleteStatus</i>).</li>
</ol>
</li>
<li>Decrease <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>j</i> be 0.</li>
<li>Let <i>items</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements are, in left to
right order, the arguments that were passed to this function invocation.</li>
<li>Repeat, while <i>items</i> is not empty
<ol class="block">
<li>Remove the first element from <i>items</i> and let <i>E</i> be the value of that element.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>j</i>), <i>E</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>j</i> by 1.</li>
</ol>
</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>O</i>, <code>"length"</code>,
<i>len</i>+<i>argCount</i>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Return <i>len</i>+<i>argCount</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>unshift</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>unshift</code> function is intentionally generic; it does not require that its
<b>this</b> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.
Whether the <code>unshift</code> function can be applied successfully to an exotic object that is not an Array is
implementation-dependent.</p>
</div>
</section>
<section id="sec-array.prototype.values">
<h1><span class="secnum" id="sec-22.1.3.29"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values" title="link to this section">22.1.3.29</a></span> Array.prototype.values ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> with the <b>this</b> value as its
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayiterator">CreateArrayIterator</a> abstract operation with
arguments <i>O</i> and <code>"value"</code>.</li>
</ol>
</section>
<section id="sec-array.prototype-@@iterator">
<h1><span class="secnum" id="sec-22.1.3.30"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype-@@iterator" title="link to this section">22.1.3.30</a></span> Array.prototype [ @@iterator ] ( )</h1>
<p>The initial value of the @@iterator property is the same function object as the initial value of the <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values">Array.prototype.values</a></b> property.</p>
</section>
<section id="sec-array.prototype-@@unscopables">
<h1><span class="secnum" id="sec-22.1.3.31"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype-@@unscopables" title="link to this section">22.1.3.31</a></span> Array.prototype [ @@unscopables ]</h1>
<p>The initial value of the @@unscopables data property is an object created by the following steps:</p>
<ol class="proc">
<li>Let <i>blackList</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(7, <span style="font-family:
sans-serif">%ArrayPrototype%</span>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <code>"0"</code>,
<code>"find"</code>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <code>"1"</code>,
<code>"findIndex"</code>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <code>"2"</code>,
<code>"fill"</code>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <code>"3"</code>,
<code>"copyWithin"</code>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <code>"4"</code>,
<code>"entries"</code>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <code>"5"</code>,
<code>"keys"</code>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>blackList</i>, <b><span style="font-family:
monospace">"6</span>"</b>, <b>"<span style="font-family: monospace">values"</span></b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: Each of the above calls will return <b>true</b>.</li>
<li>Return <i>blackList</i>.</li>
</ol>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <span class="value">false</span>,
[[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The elements of this array are property names that were not included as standard
properties of <code>Array.prototype</code> prior to the sixth edition of this specification. These names are ignored for
<code>with</code> statement binding purposes in order to preserve the behaviour of existing code that might use one of
these names as a binding in an outer scope that is shadowed by a <code>with</code> statement whose binding object is an
Array object.</p>
</div>
</section>
</section>
<section id="sec-properties-of-array-instances">
<div class="front">
<h1><span class="secnum" id="sec-22.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-array-instances" title="link to this section">22.1.4</a></span> Properties of Array Instances</h1>
<p>Array instances are exotic Array objects and have the internal methods specified for such objects. Array instances
inherit properties from the Array prototype object. Array instances also have an [[ArrayInitialisationState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>Array instances have a <code>length</code> property, and a set of enumerable properties with array index names.</p>
</div>
<section id="sec-properties-of-array-instances-length">
<h1><span class="secnum" id="sec-22.1.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-array-instances-length" title="link to this section">22.1.4.1</a></span> length</h1>
<p>The <code>length</code> property of this Array object is a data property whose value is always numerically greater than
the name of every deletable property whose name is an array index.</p>
<p>The <code>length</code> property initially has the attributes <span style="font-family: Times New Roman">{
[[Writable]]: <b>true</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }</span>.</p>
<div class="note">
<p><span class="nh">NOTE</span> Attempting to set the length property of an Array object to a value that is numerically
less than or equal to the largest numeric property name of an existing array indexed non-deletable property of the array
will result in the length being set to a numeric value that is one greater than that largest numeric property name. See
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-exotic-objects-defineownproperty-p-desc">9.4.2.1</a>.</p>
</div>
</section>
</section>
<section id="sec-array-iterator-objects">
<div class="front">
<h1><span class="secnum" id="sec-22.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array-iterator-objects" title="link to this section">22.1.5</a></span> Array Iterator Objects</h1>
<p>An Array Iterator is an object, that represents a specific iteration over some specific Array instance object. There is
not a named constructor for Array Iterator objects. Instead, Array iterator objects are created by calling certain
methods of Array instance objects.</p>
</div>
<section id="sec-createarrayiterator">
<h1><span class="secnum" id="sec-22.1.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createarrayiterator" title="link to this section">22.1.5.1</a></span> CreateArrayIterator Abstract Operation</h1>
<p>Several methods of Array objects return Iterator objects. The abstract operation CreateArrayIterator with arguments
<var>array</var> and <var>kind</var> is used to create such iterator objects. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>array</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ArrayIteratorPrototype%, ([[IteratedObject]],
[[ArrayIteratorNextIndex]], [[ArrayIterationKind]])).</li>
<li>Set <i>iterator’s</i> [[IteratedObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>O</i>.</li>
<li>Set <i>iterator’s</i> [[ArrayIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to 0.</li>
<li>Set <i>iterator’s</i> [[ArrayIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>kind</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-%arrayiteratorprototype%-object">
<div class="front">
<h1><span class="secnum" id="sec-22.1.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%arrayiteratorprototype%-object" title="link to this section">22.1.5.2</a></span> The %ArrayIteratorPrototype% Object</h1>
<p>All Array Iterator Objects inherit properties from the %ArrayIteratorPrototype% intrinsic object. The
%ArrayIteratorPrototype% object is an ordinary object and its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the %ObjectPrototype% intrinsic object. In
addition, %ArrayIteratorPrototype% has the following properties:</p>
</div>
<section id="sec-%arrayiteratorprototype%-next">
<h1><span class="secnum" id="sec-22.1.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%arrayiteratorprototype%-next" title="link to this section">22.1.5.2.1</a></span> %ArrayIteratorPrototype%. next( )</h1>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have all of the internal slots of an Array Iterator Instance (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-array-iterator-instances">22.1.5.3</a>), throw a <b>TypeError</b> exception.</li>
<li>Let <i>a</i> be the value of the [[IteratedObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>a</i> is <b>undefined</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
<li>Let <i>index</i> be the value of the [[ArrayIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>itemKind</i> be the value of the [[ArrayIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>a</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>If <i>index</i> ≥ <i>len</i>, then
<ol class="block">
<li>Set the value of the [[IteratedObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>O</i> to <b>undefined</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
</ol>
</li>
<li>Set the value of the [[ArrayIteratorNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>O</i> to <i>index</i>+1.</li>
<li>If <i>itemKind</i> contains the substring <b>"<span style="font-family: monospace">value</span>"</b>, then
<ol class="block">
<li>Let <i>elementKey</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>).</li>
<li>Let <i>elementValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>a</i>, <i>elementKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>elementValue</i>).</li>
</ol>
</li>
<li>If <i>itemKind</i> contains the substring <b>"<span style="font-family: monospace">key+value</span>"</b>, then
<ol class="block">
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(2).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>result</i> is a new, well-formed Array object so the
following operations will never fail.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family:
monospace">0</span>"</b>, <i>index</i>).</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family:
monospace">1</span>"</b>, <i>elementValue</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>result</i>, <b>false</b>).</li>
</ol>
</li>
<li>Else If <i>itemKind</i> contains the substring <b>"<span style="font-family: monospace">key</span>"</b> then,
return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>index</i>, <b>false</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>itemKind</i> contains the substring <code>"value"</code>,</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>elementValue</i>, <b>false</b>).</li>
</ol>
</section>
<section id="sec-%arrayiteratorprototype%-@@iterator">
<h1><span class="secnum" id="sec-22.1.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%arrayiteratorprototype%-@@iterator" title="link to this section">22.1.5.2.2</a></span> %ArrayIteratorPrototype% [ @@iterator ] ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return the <b>this</b> value.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
<section id="sec-%arrayiteratorprototype%-@@tostringtag">
<h1><span class="secnum" id="sec-22.1.5.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%arrayiteratorprototype%-@@tostringtag" title="link to this section">22.1.5.2.3</a></span> %ArrayIteratorPrototype% [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family: monospace">Array
Iterator</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-array-iterator-instances">
<h1><span class="secnum" id="sec-22.1.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-array-iterator-instances" title="link to this section">22.1.5.3</a></span> Properties of Array Iterator Instances</h1>
<p>Array Iterator instances are ordinary objects that inherit properties from the %ArrayIteratorPrototype% intrinsic
object. Array Iterator instances are initially created with the internal slots listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-43">Table
43</a>.</p>
<figure>
<figcaption><span id="table-43">Table 43</span> — Internal Slots of Array Iterator Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[IteratedObject]]</td>
<td>The object whose array elements are being iterated.</td>
</tr>
<tr>
<td>[[ArrayIteratorNextIndex]]</td>
<td>The integer index of the next array index to be examined by this iteration.</td>
</tr>
<tr>
<td>[[ArrayIterationKind]]</td>
<td>A string value that identifies what is to be returned for each element of the iteration. The possible values are: <b>"<span style="font-family: monospace">key</span>"</b>, <b>"<span style="font-family: monospace">value</span>"</b>, <b>"<span style="font-family: monospace">key+value</span>"</b>.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-typedarray-objects">
<div class="front">
<h1><span class="secnum" id="sec-22.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-objects" title="link to this section">22.2</a></span>
<i>TypedArray</i> Objects</h1>
<p><i>TypedArray</i> objects present an array-like view of an underlying binary data buffer (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-objects">24.1</a>). Each element of a <i>TypedArray</i> instance has the same underlying binary
scalar data type. There is a distinct <i>TypedArray</i> constructor. Listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>, for each of
the nine supported element types. For each constructor in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> have a corresponding distinct
prototype object.</p>
<figure>
<figcaption><span id="table-44">Table 44</span> – The <i>TypedArray</i> Constructors</figcaption>
<table class="real-table">
<tbody><tr>
<th style="background-color: #BFBFBF">Constructor Name</th>
<th style="background-color: #BFBFBF">Element<br>Type</th>
<th style="background-color: #BFBFBF">Element Size</th>
<th style="background-color: #BFBFBF">Conversion Operation</th>
<th style="background-color: #BFBFBF">Description</th>
<th style="background-color: #BFBFBF">Equivalent C Type</th>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int8array">Int8Array</a></td>
<td>Int8</td>
<td>1</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8">ToInt8</a></td>
<td>8-bit 2’s complement signed integer</td>
<td>signed char</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint8array">Uint8Array</a></td>
<td>Uint8</td>
<td>1</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8">ToUint8</a></td>
<td>8-bit unsigned integer</td>
<td>unsigned char</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint8clampedarray">Uint8ClampedArray</a></td>
<td>Uint8C</td>
<td>1</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp">ToUint8Clamp</a></td>
<td>8-bit unsigned integer (clamped conversion)</td>
<td>unsigned char</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int16array">Int16Array</a></td>
<td>Int16</td>
<td>2</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint16">ToInt16</a></td>
<td>16-bit 2’s complement signed integer</td>
<td>Short</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint16array">Uint16Array</a></td>
<td>Uint16</td>
<td>2</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16">ToUint16</a></td>
<td>16-bit unsigned integer</td>
<td>unsigned short</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-int32array">Int32Array</a></td>
<td>Int32</td>
<td>4</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32">ToInt32</a></td>
<td>32-bit 2’s complement signed integer</td>
<td>Int</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-uint32array">Uint32Array</a></td>
<td>Uint32</td>
<td>4</td>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32">ToUint32</a></td>
<td>32-bit unsigned integer</td>
<td>unsigned int</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-float32array">Float32Array</a></td>
<td>Float32</td>
<td>4</td>
<td></td>
<td>32-bit IEEE floating point</td>
<td>Float</td>
</tr>
<tr>
<td><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-float64array">Float64Array</a></td>
<td>Float64</td>
<td>8</td>
<td></td>
<td>64-bit IEEE floating point</td>
<td>Double</td>
</tr>
</tbody></table>
</figure>
<p>In the definitions below, references to <i>TypedArray</i> should be replaced with the appropriate constructor name from
the above table. The phrase “the element size in bytes” refers to the value in the Element Size column of the
table in the row corresponding to the constructor. The phrase “element Type” refers to the value in the Element
Type column for that row.</p>
</div>
<section id="sec-%typedarray%-intrinsic-object">
<div class="front">
<h1><span class="secnum" id="sec-22.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-intrinsic-object" title="link to this section">22.2.1</a></span> The %TypedArray% Intrinsic Object</h1>
<p>The %TypedArray% intrinsic object is a constructor-like function object that all of the <i>TypedArray</i> constructor
object inherit from. %TypedArray% and its corresponding prototype object provide common properties that are inherited by
all <i>TypedArray</i> constructors and their instances. The %TypedArray% intrinsic does not have a global name or appear
as a property of the global object.</p>
<p>If the <b>this</b> value passed in the call is an Object with a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined</span>, it initiallizes the <b>this</b> value using the argument values. This permits super
invocation of the <i>TypedArray</i> constructors by <i>TypedArray</i> subclasses.</p>
<p>The %TypedArray% intrinsic function object is designed to act as the superclass of the various <i>TypedArray</i>
constructors. Those constructors use %TypedArray% to initiallize their instances by invoking %TypedArray% as if by making
a <code>super</code> call. The %TypedArray% intrinsic function is not designed to be directly called in any other way. If
%TypedArray% is directly called or called as part of a <code>new</code> expression an exception is thrown.</p>
<p>The actual behaviour of a <code>super</code> call of %TypedArray% depends upon the number and kind of arguments that
are passed to it.</p>
</div>
<section id="sec-%typedarray%-length">
<h1><span class="secnum" id="sec-22.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-length" title="link to this section">22.2.1.1</a></span> %TypedArray% ( length )</h1>
<p>This description applies if and only when %TypedArray% function is called and the Type of the first argument is not
Object.</p>
<p>%TypedArray% called with argument <var>length</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>length</i>) is not Object.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>O’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>constructorName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>numberLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>length</i>).</li>
<li>Let <i>elementLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>numberLength</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>elementLength</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>numberLength</i>, <i>elementLength</i>) is <b>false</b>, then
throw a <b>RangeError</b> exception.</li>
<li>Let <i>data</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatearraybuffer">AllocateArrayBuffer</a>(%ArrayBuffer%).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>data</i>).</li>
<li>Let <i>elementSize</i> be the Size Element value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>byteLength</i> be <i>elementSize</i> × <i>elementLength</i>.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setarraybufferdata">SetArrayBufferData</a>(<i>data</i>,
<i>byteLength</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Set <i>O’s</i> [[ViewedArrayBuffer]] to <i>data</i>.</li>
<li>Set <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>byteLength</i>.</li>
<li>Set <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
0.</li>
<li>Set <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>elementLength</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-%typedarray%-typedarray">
<h1><span class="secnum" id="sec-22.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-typedarray" title="link to this section">22.2.1.2</a></span> %TypedArray% ( typedArray )</h1>
<p>This description applies if and only if the %TypedArray% function is called with at least one argument and the Type of
the first argument is Object and that object has a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>%TypedArray%called with argument <var>typedArray</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>typedArray</i>) is Object and <i>typedArray</i> has a
[[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcArray</i> be <i>typedArray</i>.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or if <i>O</i> does not have a
[[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a
<b>TypeError</b> exception.</li>
<li>If the value of <i>O’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If the value of <i>srcArray’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>constructorName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>elementLength</i> be the value of <i>srcArray’s</i> [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcName</i> be the string value <i>srcArray’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>srcName</i>.</li>
<li>Let <i>srcElementSize</i> be the Size Element value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for <i>srcName</i>.</li>
<li>Let <i>srcData</i> be the value of <i>srcArray’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcByteOffset</i> be the value of <i>srcArray</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementSize</i> be the Size Element value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>byteLength</i> be <i>elementSize</i> × <i>elementLength</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>elementType</i>,<i>srcType</i>), then
<ol class="block">
<li>Let <i>data</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonearraybuffer">CloneArrayBuffer</a>(<i>srcData</i>,
<i>srcByteOffset</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>data</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>bufferConstructor</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>srcBuffer</i>,
<code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>bufferConstructor</i>).</li>
<li>If <i>bufferConstructor</i> is <b>undefined</b>, then let <i>bufferConstructor</i> be %ArrayBuffer%.</li>
<li>Let <i>data</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatearraybuffer">AllocateArrayBuffer</a>(<i>bufferConstructor</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setarraybufferdata">SetArrayBufferData</a>(<i>data</i>,
<i>byteLength</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>srcByteIndex</i> be <i>srcByteOffset</i>.</li>
<li>Let <i>targetByteIndex</i> be 0.</li>
<li>Let <i>count</i> be <i>elementLength</i>.</li>
<li>Repeat,while <i>count</i> &gt;0
<ol class="block">
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvaluefrombuffer">GetValueFromBuffer</a> (<i>srcData</i>,
<i>srcByteIndex</i>, <i>srcType</i>).</li>
<li>Let <i>status</i> be (<i>data</i>, <i>targetByteIndex</i>, <i>elementType</i>, <i>value</i>).</li>
<li>Set <i>srcByteIndex</i> to <i>srcByteIndex</i> + <i>srcElementSize</i>.</li>
<li>Set <i>targetByteIndex</i> to <i>targetByteIndex</i> + <i>elementSize</i>.</li>
<li>Decrement <i>count</i> by 1.</li>
</ol>
</li>
</ol>
</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has not been reentrantly initialized.</li>
<li>Set <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>data</i>.</li>
<li>Set <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>byteLength</i>.</li>
<li>Set <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
0.</li>
<li>Set <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>elementLength</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-%typedarray%-array">
<h1><span class="secnum" id="sec-22.2.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-array" title="link to this section">22.2.1.3</a></span> %TypedArray% ( array )</h1>
<p>This description applies if and only if the %TypedArray% function is called with at least one argument and the Type of
first argument is Object and that object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>%TypedArray% called with argument <var>array</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>array</i>) is Object and <i>array</i> does not have either
a [[TypedArrayName]] or an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>Let <i>srcArray</i> be <i>array</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or if <i>O</i> does not have a
[[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a
<b>TypeError</b> exception.</li>
<li>If the value of <i>O’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>constructorName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>arrayLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>srcArray</i>, <code>"length"</code>).</li>
<li>Let <i>elementLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>arrayLength</i> ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>elementLength</i>).</li>
<li>Let <i>data</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatearraybuffer">AllocateArrayBuffer</a>(<span style="font-family:
sans-serif">%ArrayBuffer%</span>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>data</i>).</li>
<li>Let <i>elementSize</i> be the Size Element value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>byteLength</i> be <i>elementSize</i> × <i>elementLength</i>.</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setarraybufferdata">SetArrayBufferData</a>(<i>data</i>, <i>byteLength</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>elementLength</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>srcArray</i>, <i>Pk</i>).</li>
<li>Let <i>kNumber</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>kValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kNumber</i>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer">SetValueInBuffer</a>(<i>data</i>, <i>k ×</i> <i>elementSize</i>,
<i>elementType</i>, <i>kNumber</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Note: Side-effects of preceding steps may have already initiallized <i>O</i>.</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Set <i>O’s</i> [[ViewedArrayBuffer]] to <i>data</i>.</li>
<li>Set <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>byteLength</i>.</li>
<li>Set <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
0.</li>
<li>Set <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>elementLength</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-%typedarray%-buffer-byteoffset-length">
<h1><span class="secnum" id="sec-22.2.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-buffer-byteoffset-length" title="link to this section">22.2.1.4</a></span> %TypedArray% ( buffer [ , byteOffset [ , length ] ] )</h1>
<p>This description applies if and only if the %TypedArray% function is called with at least one argument and the Type of
the first argument is Object and that object has an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>%TypedArray% called with arguments <span style="font-family: Times New Roman"><i>buffer</i>, <i>byteOffset</i>, and
<i>length</i></span> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>buffer</i>) is Object and <i>buffer</i> has an
[[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If the value of <i>buffer</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or if <i>O</i> does not have a
[[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a
<b>TypeError</b> exception.</li>
<li>If the value of <i>O’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>constructorName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>offset</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>byteOffset</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>offset</i>).</li>
<li>If <i>offset</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>If <i>offset</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> <i>elementSize</i> ≠ 0, then throw a
<b>RangeError</b> exception.</li>
<li>Let <i>bufferByteLength</i> be the value of <i>buffer’s</i> [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>length</i> is <b>undefined</b>, then
<ol class="block">
<li>If <i>bufferByteLength</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">modulo</a> <i>elementSize</i> ≠ 0, then throw
a <b>RangeError</b> exception.</li>
<li>Let <i>newByteLength</i> be <i>bufferByteLength</i> – <i>offset</i>.</li>
<li>If <i>newByteLength</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>newLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>length).</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>newLength</i>).</li>
<li>Let <i>newByteLength</i> be <i>newLength</i> × <i>elementSize</i>.</li>
<li>If <i>offset</i>+<i>newByteLength</i> &gt; <i>bufferByteLength</i>, then throw a <b>RangeError</b>
exception.</li>
</ol>
</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Set <i>O’s</i> [[ViewedArrayBuffer]] to <i>buffer</i>.</li>
<li>Set <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>newByteLength</i>.</li>
<li>Set <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>offset</i>.</li>
<li>Set <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>newByteLength /</i> <i>elementSize</i> .</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-%typedarray%-all-other-argument-combinations">
<h1><span class="secnum" id="sec-22.2.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-all-other-argument-combinations" title="link to this section">22.2.1.5</a></span> %TypedArray% ( all other argument combinations )</h1>
<p>If the %TypedArray% function is called with arguments that do not match any of the preceeding argument descriptions a
<b>TypeError</b> exception is thrown.</p>
</section>
</section>
<section id="sec-properties-of-the-%typedarray%-intrinsic-object">
<div class="front">
<h1><span class="secnum" id="sec-22.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarray%-intrinsic-object" title="link to this section">22.2.2</a></span> Properties of the %TypedArray% Intrinsic Object</h1>
<p>The %TypedArray% intrinsic object is a built-in function object. The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of %TypedArray% is the Function prototype object
(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides a <code>length</code> property whose value is 3 and a <code>name</code> property whose value is
<code>"TypedArray"</code>, %TypedArray% has the following properties:</p>
</div>
<section id="sec-%typedarray%.from">
<h1><span class="secnum" id="sec-22.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.from" title="link to this section">22.2.2.1</a></span> %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] )</h1>
<p>When the <code>from</code> method is called with argument <var>source</var>, and optional arguments <i>mapfn</i> and
<i>thisArg</i>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>items</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>source</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>items</i>).</li>
<li>If <i>mapfn</i> is <b>undefined</b>, then let <i>mapping</i> be <b>false.</b></li>
<li>else
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>mapfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>mapping</i> be <b>true</b></li>
</ol>
</li>
<li>Let <i>usingIterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isiterable">IsIterable</a>(<i>items</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>usingIterator</i>).</li>
<li>If <i>usingIterator</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>items</i>, <i>usingIterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iterator</i>).</li>
<li>Let <i>values</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>next</i> be <b>true</b>.</li>
<li>Repeat, while <i>next</i> is not <b>false</b>
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
</ol>
</li>
<li>If <i>next</i> is not <b>false</b>, then
<ol class="nested proc">
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Append <i>nextValue</i> to the end of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
<i>values</i>.</li>
</ol>
</li>
<li>Let <i>len</i> be the number of elements in <i>values</i>.</li>
<li>Let <i>newObj</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>newObj</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be the first element of <i>values</i> and remove that element from <i>list</i>.</li>
<li>If <i>mapping</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>mappedValue</i> be the result of calling the [[Call]] internal method of <i>mapfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>
containing <i>kValue</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>mappedValue</i>).</li>
</ol>
</li>
<li>Else, let <i>mappedValue</i> be <i>kValue</i>.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>newObj</i>, <i>Pk</i>, <i>mappedValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>values</i> is now an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return <i>newObj</i>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>items</i> is not an Iterator so assume it is an array-like
object.</li>
<li>Let <i>lenValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>newObj</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>newObj</i>).</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>If <i>mapping</i> is <b>true</b>, then
<ol class="block">
<li>Let <i>mappedValue</i> be the result of calling the [[Call]] internal method of <i>mapfn</i> with <i>T</i>
as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>items</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>mappedValue</i>).</li>
</ol>
</li>
<li>Else, let <i>mappedValue</i> be <i>kValue</i>.</li>
<li>Let <i>putStatus</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>newObj</i>, <i>Pk</i>, <i>mappedValue</i>,
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>putStatus</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>newObj</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>from</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>from</code> function is an intentionally generic factory method; it does not
require that its <b>this</b> value be a Typed Array constructor. Therefore it can be transferred to or inherited by any
other constructors that may be called with a single numeric argument. This function uses [[Put]] to store elements into
a newly created object and assume that the constructor sets the <code>length</code> property of the new object to the
argument value passed to it.</p>
</div>
</section>
<section id="sec-%typedarray%.of">
<h1><span class="secnum" id="sec-22.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.of" title="link to this section">22.2.2.2</a></span>
%TypedArray%.of ( ...items )</h1>
<p>When the <code>of</code> method is called with any number of arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>lenValue</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <code>"length"</code>).</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenValue</i>).</li>
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>newObj</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>newObj</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>items</i>, <i>Pk</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>newObj</i>,<i>Pk</i>, <i>kValue</i>.[[value]],
<b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>newObj</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>of</code> method is <b>0</b>.</p>
<div class="note">
<p><span class="nh">NOTE 1</span> The <i>items</i> argument is assumed to be a well-formed rest argument value.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> The <code>of</code> function is an intentionally generic factory method; it does not
require that its <b>this</b> value be a <i>TypedArray</i> constructor. Therefore it can be transferred to or inherited
by other constructors that may be called with a single numeric argument. However, it does assume that constructor
creates and initiallizes a length property that is initiallized to its argument value.</p>
</div>
</section>
<section id="sec-%typedarray%.prototype">
<h1><span class="secnum" id="sec-22.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype" title="link to this section">22.2.2.3</a></span> %TypedArray%.prototype</h1>
<p>The initial value of %TypedArray%.prototype is the %TypedArrayPrototype% intrinsic object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarrayprototype%-object">22.2.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">false</span> }.</p>
</section>
<section id="sec-%typedarray%-@@create">
<h1><span class="secnum" id="sec-22.2.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-@@create" title="link to this section">22.2.2.4</a></span> %TypedArray% [ @@create ] ( )</h1>
<p>The @@create method of %TypedArray% performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>F</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>proto</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>,
<code>"%TypedArrayPrototype%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-integerindexedobjectcreate">IntegerIndexedObjectCreate</a> (<i>proto</i>).</li>
<li>Add a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>obj</i> and set its initial value to <b>undefined</b>.</li>
<li>Add a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>obj</i>
and set its initial value to <b>undefined</b> .</li>
<li>Add a [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>obj</i> and
set its initial value to 0.</li>
<li>Add a [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>obj</i> and
set its initial value to 0.</li>
<li>Add an [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>obj</i> and
set its initial value to 0.</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-the-%typedarrayprototype%-object">
<div class="front">
<h1><span class="secnum" id="sec-22.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarrayprototype%-object" title="link to this section">22.2.3</a></span> Properties of the %TypedArrayPrototype% Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
%TypedArrayPrototype% object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The %TypedArrayPrototype% object is an ordinary object.
It does not have a [[ViewedArrayBuffer]] or or any other of the internal slots that are specific to <i>TypedArray</i>
instance objects.</p>
</div>
<section id="sec-get-%typedarray%.prototype.buffer">
<h1><span class="secnum" id="sec-22.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-%typedarray%.prototype.buffer" title="link to this section">22.2.3.1</a></span> get %TypedArray%.prototype.buffer</h1>
<p>%TypedArray%.<code>prototype.buffer</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>buffer</i>.</li>
</ol>
</section>
<section id="sec-get-%typedarray%.prototype.bytelength">
<h1><span class="secnum" id="sec-22.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-%typedarray%.prototype.bytelength" title="link to this section">22.2.3.2</a></span> get %TypedArray%.prototype.byteLength</h1>
<p>%TypedArray%.<code>prototype.byteLength</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>size</i> be the value of <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>size</i>.</li>
</ol>
</section>
<section id="sec-get-%typedarray%.prototype.byteoffset">
<h1><span class="secnum" id="sec-22.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-%typedarray%.prototype.byteoffset" title="link to this section">22.2.3.3</a></span> get %TypedArray%.prototype.byteOffset</h1>
<p>%TypedArray%.<code>prototype.byteOffset</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>offset</i> be the value of <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>offset</i>.</li>
</ol>
</section>
<section id="sec-%typedarray%.prototype.constructor">
<h1><span class="secnum" id="sec-22.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.constructor" title="link to this section">22.2.3.4</a></span> %TypedArray%.prototype.constructor</h1>
<p>The initial value of %TypedArray%.prototype.constructor is the %TypedArray% intrinsic object.</p>
</section>
<section id="sec-%typedarray%.prototype.copywithin">
<h1><span class="secnum" id="sec-22.2.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.copywithin" title="link to this section">22.2.3.5</a></span> %TypedArray%.prototype.copyWithin (target, start, end = this.length
)</h1>
<p>%TypedArray%<code>.prototype.copyWithin</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.copywithin">Array.prototype.copyWithin</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.copywithin">22.1.3.3</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>copyWithin</code> method is <b>2</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.entries">
<h1><span class="secnum" id="sec-22.2.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.entries" title="link to this section">22.2.3.6</a></span> %TypedArray%.prototype.entries ( )</h1>
<p>The initial value of the %TypedArray%.<code>prototype.entries</code> data property is the same built-in function object
as the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.entries">Array.prototype.entries</a></code> method defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.entries">22.1.3.4</a>.</p>
</section>
<section id="sec-%typedarray%.prototype.every">
<h1><span class="secnum" id="sec-22.2.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.every" title="link to this section">22.2.3.7</a></span> %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )</h1>
<p>%TypedArray%<code>.prototype.every</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.every">Array.prototype.every</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.every">22.1.3.5</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>every</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.fill">
<h1><span class="secnum" id="sec-22.2.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.fill" title="link to this section">22.2.3.8</a></span> %TypedArray%.prototype.fill (value [ , start [ , end ] ] )</h1>
<p>%TypedArray%<code>.prototype.fill</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.fill">Array.prototype.fill</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.fill">22.1.3.6</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>fill</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.filter">
<h1><span class="secnum" id="sec-22.2.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.filter" title="link to this section">22.2.3.9</a></span> %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )</h1>
<p>The interpretation and use of the arguments of %TypedArray%<code>.prototype.filter</code> are the same as for <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.filter">Array.prototype.filter</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.filter">22.1.3.7</a>.</p>
<p>When the <code>filter</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>len</i> be the value of <i>O’s</i> [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>false</b>, then
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>kept</i> be a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Let <i>captured</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>selected</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with <i>T</i> as
<i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>kValue</i>,
<i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>selected</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(<i>selected</i>) is <b>true</b>, then
<ol class="block">
<li>Append <i>kValue</i> to the end of <i>kept</i>.</li>
<li>Increase <i>captured</i> by 1.</li>
</ol>
</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>captured</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
<li>Let <i>n</i> be 0.</li>
<li>For each element <i>e</i> of <i>kept</i>
<ol class="block">
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>e</i>, <b>true</b> ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Increment <i>n</i> by 1.</li>
</ol>
</li>
<li>Return <i>A</i>.</li>
</ol>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>filter</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.find">
<h1><span class="secnum" id="sec-22.2.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.find" title="link to this section">22.2.3.10</a></span> %TypedArray%.prototype.find (predicate [ , thisArg ] )</h1>
<p>%TypedArray%<code>.prototype.find</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.find">Array.prototype.find</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.find">22.1.3.8</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>find</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.findindex">
<h1><span class="secnum" id="sec-22.2.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.findindex" title="link to this section">22.2.3.11</a></span> %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )</h1>
<p>%TypedArray%<code>.prototype.findIndex</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.findindex">Array.prototype.findIndex</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.findindex">22.1.3.9</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>findIndex</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.foreach">
<h1><span class="secnum" id="sec-22.2.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.foreach" title="link to this section">22.2.3.12</a></span> %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )</h1>
<p>%TypedArray%<code>.prototype.forEach</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.foreach">Array.prototype.forEach</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.foreach">22.1.3.10</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>forEach</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.indexof">
<h1><span class="secnum" id="sec-22.2.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.indexof" title="link to this section">22.2.3.13</a></span> %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )</h1>
<p>%TypedArray%<code>.prototype.indexOf</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.indexof">Array.prototype.indexOf</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.indexof">22.1.3.11</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>indexOf</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.join">
<h1><span class="secnum" id="sec-22.2.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.join" title="link to this section">22.2.3.14</a></span> %TypedArray%.prototype.join ( separator )</h1>
<p>%TypedArray%<code>.prototype.join</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.join">Array.prototype.join</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.join">22.1.3.12</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
</section>
<section id="sec-%typedarray%.prototype.keys">
<h1><span class="secnum" id="sec-22.2.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.keys" title="link to this section">22.2.3.15</a></span> %TypedArray%.prototype.keys ( )</h1>
<p>The initial value of the %TypedArray%.<code>prototype.keys</code> data property is the same built-in function object as
the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.keys">Array.prototype.keys</a></code> method defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.keys">22.1.3.13</a>.</p>
</section>
<section id="sec-%typedarray%.prototype.lastindexof">
<h1><span class="secnum" id="sec-22.2.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.lastindexof" title="link to this section">22.2.3.16</a></span> %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ]
)</h1>
<p>%TypedArray%<code>.prototype.lastIndexOf</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.lastindexof">Array.prototype.lastIndexOf</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.lastindexof">22.1.3.14</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>lastIndexOf</code> method is <b>1</b>.</p>
</section>
<section id="sec-get-%typedarray%.prototype.length">
<h1><span class="secnum" id="sec-22.2.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-%typedarray%.prototype.length" title="link to this section">22.2.3.17</a></span> get %TypedArray%.prototype.length</h1>
<p>%TypedArray%.<code>prototype.length</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has [[ViewedArrayBuffer]] and [[ArrayLength]] internal
slots.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>length</i> be the value of <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>length</i>.</li>
</ol>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
</section>
<section id="sec-%typedarray%.prototype.map">
<h1><span class="secnum" id="sec-22.2.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.map" title="link to this section">22.2.3.18</a></span> %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )</h1>
<p>The interpretation and use of the arguments of %TypedArray%<code>.prototype.map</code> are the same as for <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.map">Array.prototype.map</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.map">22.1.3.15</a>.</p>
<p>When the <code>map</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>len</i> be the value of <i>O’s</i> [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> (<i>len</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>mappedValue</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with <i>T</i>
as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>kValue</i>, <i>k</i>, and <i>O</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>mappedValue</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <i>Pk</i>, <i>mappedValue</i>, <b>true</b>
).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>A</i>.</li>
</ol>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>map</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.reduce">
<h1><span class="secnum" id="sec-22.2.3.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.reduce" title="link to this section">22.2.3.19</a></span> %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )</h1>
<p>%TypedArray%<code>.prototype.reduce</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduce">Array.prototype.reduce</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduce">22.1.3.18</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>reduce</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.reduceright">
<h1><span class="secnum" id="sec-22.2.3.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.reduceright" title="link to this section">22.2.3.20</a></span> %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ]
)</h1>
<p>%TypedArray%<code>.prototype.reduceRight</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduceright">Array.prototype.reduceRight</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduceright">22.1.3.19</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>reduceRight</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.reverse">
<h1><span class="secnum" id="sec-22.2.3.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.reverse" title="link to this section">22.2.3.21</a></span> %TypedArray%.prototype.reverse ( )</h1>
<p>%TypedArray%<code>.prototype.reverse</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reverse">Array.prototype.reverse</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reverse">22.1.3.20</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
</section>
<section id="sec-%typedarray%.prototype.set-array-offset">
<h1><span class="secnum" id="sec-22.2.3.22"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.set-array-offset" title="link to this section">22.2.3.22</a></span> %TypedArray%.prototype.set(array [ , offset ] )</h1>
<p>Set multiple values in this <i>TypedArray</i>, reading the values from the object <i>array</i>. The optional
<i>offset</i> value indicates the first element index in this <i>TypedArray</i> where values are written. If omitted, it
is assumed to be 0.</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>array</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. If it does, the definition in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.set-typedarray-offset">22.2.3.23</a> applies.</li>
<li>Let <i>target</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>target</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>target</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a <b>TypeError</b>
exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>target</i> has [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>targetBuffer</i> be the value of <i>target</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>targetBuffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>targetLength</i> be the value of <i>target</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>targetOffset</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a> (<i>offset</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetOffset</i>).</li>
<li>If <i>targetOffset</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>Let <i>targetName</i> be the string value <i>target</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>targetElementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table
44</a> for <i>targetName</i>.</li>
<li>Let <i>targetType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>targetName</i>.</li>
<li>Let <i>targetByteOffset</i> be the value of <i>target</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>src</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>array</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>src</i>).</li>
<li>Let <i>srcLen</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>src</i>, <code>"length"</code>).</li>
<li>Let <i>numberLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>srcLen</i>).</li>
<li>Let <i>srcLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>numberLength</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>srcLength</i>).</li>
<li>If <i>numberLength</i> ≠ <i>srcLength</i> or <i>srcLength</i> &lt; 0, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>srcLength</i> + <i>targetOffset</i> &gt; <i>targetLength</i>, then throw a <b>RangeError</b> exception.</li>
<li>Let <i>targetByteIndex</i> be <i>targetOffset</i> × <i>targetElementSize</i> + <i>targetByteOffset</i>.</li>
<li>Let <i>k</i> be 0.</li>
<li>Let <i>limit</i> be <i>targetByteIndex</i> + <i>targetElementSize</i> × min(<i>srcLength</i>,
<i>targetLength</i> – <i>targetOffset</i>).</li>
<li>Repeat, while <i>targetByteIndex</i> &lt; <i>limit</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>src</i>, <i>Pk</i>).</li>
<li>Let <i>kNumber</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>kValue</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kNumber</i>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer">SetValueInBuffer</a>(<i>targetBuffer</i>, <i>targetByteIndex</i>,
<i>targetType</i>, <i>kNumber</i>).</li>
<li>Set <i>k</i> to <i>k</i> + 1.</li>
<li>Set <i>targetByteIndex</i> to <i>targetByteIndex</i> + <i>targetElementSize</i>.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-%typedarray%.prototype.set-typedarray-offset">
<h1><span class="secnum" id="sec-22.2.3.23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.set-typedarray-offset" title="link to this section">22.2.3.23</a></span> %TypedArray%.prototype.set(typedArray [ offset ] )</h1>
<p>Set multiple values in this <i>TypedArray</i>, reading the values from the <var>typedArray</var> argument object. The
optional <i>offset</i> value indicates the first element index in this <i>TypedArray</i> where values are written. If
omitted, it is assumed to be 0.</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>typedArray</i> has a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>. If it does not, the definition in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.set-array-offset">22.2.3.22</a> applies.</li>
<li>Let <i>target</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>target</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>target</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a <b>TypeError</b>
exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>target</i> has [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>targetBuffer</i> be the value of <i>target</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>targetBuffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>srcBuffer</i> be the value of <i>typedArray</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>srcBuffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>targetLength</i> be the value of <i>target</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>targetOffset</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a> (<i>offset</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>targetOffset</i>).</li>
<li>If <i>targetOffset</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>Let <i>targetName</i> be the string value <i>target</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>targetType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>targetName</i>.</li>
<li>Let <i>targetElementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table
44</a> for <i>targetName</i>.</li>
<li>Let <i>targetByteOffset</i> be the value of <i>target</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcName</i> be the string value <i>typedArray</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>srcName</i> .</li>
<li>Let <i>srcElementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table
44</a> for <i>srcName</i>.</li>
<li>Let <i>srcLength</i> be the value of <i>typedArray</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcByteOffset</i> be the value of <i>typedArray</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>srcLength</i> + <i>targetOffset</i> &gt; <i>targetLength</i>, then throw a <b>RangeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>srcBuffer</i>, <i>targetBuffer</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>srcBuffer</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonearraybuffer">CloneArrayBuffer</a>(<i>srcBuffer</i>,
<i>srcByteOffset</i>).</li>
<li>Let <i>srcByteIndex</i> be 0.</li>
</ol>
</li>
<li>Else, let <i>srcByteIndex</i> be <i>srcByteOffset</i>.</li>
<li>Let <i>targetByteIndex</i> be <i>targetOffset</i> × <i>targetElementSize</i> + <i>targetByteOffset</i>.</li>
<li>Let <i>limit</i> be <i>targetByteIndex</i> + <i>targetElementSize</i> × min(<i>srcLength</i>,
<i>targetLength</i> – <i>targetOffset</i>).</li>
<li>Repeat, while <i>targetByteIndex</i> &lt; <i>limit</i>
<ol class="block">
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvaluefrombuffer">GetValueFromBuffer</a> (<i>srcBuffer</i>,
<i>srcByteIndex</i>, <i>srcType</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer">SetValueInBuffer</a> (<i>targetBuffer</i>,
<i>targetByteIndex</i>, <i>targetType</i>, <i>value</i>).</li>
<li>Set <i>srcByteIndex</i> to <i>srcByteIndex</i> + <i>srcElementSize</i>.</li>
<li>Set <i>targetByteIndex</i> to <i>targetByteIndex</i> + <i>targetElementSize</i>.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-%typedarray%.prototype.slice">
<h1><span class="secnum" id="sec-22.2.3.24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.slice" title="link to this section">22.2.3.24</a></span> %TypedArray%.prototype.slice ( start, end )</h1>
<p>The interpretation and use of the arguments of %TypedArray%<code>.prototype.slice</code> are the same as for <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.slice">Array.prototype.slice</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.slice">22.1.3.22</a>. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>len</i> be the value of <i>O’s</i> [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>relativeStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeStart</i>).</li>
<li>If <i>relativeStart</i> is negative, let <i>k</i> be max((<i>len</i> + <i>relativeStart</i>),0); else let <i>k</i>
be min(<i>relativeStart</i>, <i>len</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>relativeEnd</i> be <i>len</i>; else let <i>relativeEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeEnd</i>).</li>
<li>If <i>relativeEnd</i> is negative, let <i>final</i> be max((<i>len</i> + <i>relativeEnd</i>),0); else let
<i>final</i> be min(<i>relativeEnd</i>, <i>len</i>).</li>
<li>Let <i>count</i> be max(<i>final</i> – <i>k</i>, 0).</li>
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>A</i> be the result of calling the [[Construct]] internal method of <i>C</i> with argument
(<i>count</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>A</i>).</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>n</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>final</i>
<ol class="block">
<li>Let <i>Pk</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>kValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <i>Pk</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>kValue</i>).</li>
<li>Let <i>status</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-put-o-p-v-throw">Put</a>(<i>A</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>n</i>), <i>kValue</i>, <b>true</b> ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Increase <i>k</i> by 1.</li>
<li>Increase <i>n</i> by 1.</li>
</ol>
</li>
<li>Return <i>A</i>.</li>
</ol>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>slice</code> method is <b>2</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.some">
<h1><span class="secnum" id="sec-22.2.3.25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.some" title="link to this section">22.2.3.25</a></span> %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )</h1>
<p>%TypedArray%<code>.prototype.some</code> is a distinct function that implements the same algorithm as <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.some">Array.prototype.some</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.some">22.1.3.23</a> except that the <b>this</b> object’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is accessed in place of performing a [[Get]] of
<code>"length"</code>. The implementation of the algorithm may be optimized with the knowledge that the <b>this</b> value
is an object that has a fixed length and whose integer indexed properties are not sparse. However, such optimization must
not introduce any observable changes in the specified behaviour of the algorithm.</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when this function is called.</p>
<p>The <code>length</code> property of the <code>some</code> method is <b>1</b>.</p>
</section>
<section id="sec-%typedarray%.prototype.sort">
<h1><span class="secnum" id="sec-22.2.3.26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.sort" title="link to this section">22.2.3.26</a></span> %TypedArray%.prototype.sort ( comparefn )</h1>
<p>%TypedArray%<code>.prototype.sort</code> is a distinct function that, except as described below, implements the same
requirements as those of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">Array.prototype.sort</a></code> as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">22.1.3.24</a>. The implementation of the %TypedArray%<code>.prototype.sort</code>
specification may be optimized with the knowledge that the <b>this</b> value is an object that has a fixed length and
whose integer indexed properties are not sparse. The only internal methods of the <b>this</b> object that the algorithm
may call are [[Get]] and [[Set]].</p>
<p>This function is not generic. If the <b>this</b> value is not a object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, a <span class="value">TypeError</span> exception
is immediately thrown when it is called.</p>
<p>Upon entry, the following steps are performed to initiallize evaluation of the <code>sort</code> function. These steps
are used instead of the entry steps in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">22.1.3.24</a>:</p>
<ol class="proc">
<li>Let <i>obj</i> be the <b>this</b> value as the argument.</li>
<li>If <i>obj</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>len</i> be the value of <i>obj</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
<p>The following version of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a> is used by
%TypedArray%<code>.prototype.sort</code>. It performs a numeric comparison rather than the string comparsion used in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.sort">22.1.3.24</a>.</p>
<p>The Typed Array <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-sortcompare">SortCompare</a> abstract operation is called with two arguments <var>j</var>
and <var>k</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>jString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>j</i>).</li>
<li>Let <i>kString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>k</i>).</li>
<li>Let <i>x</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>,<i>jString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>x</i>).</li>
<li>Let <i>y</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>kString</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>y</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: Both <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>y</i>) is Number.</li>
<li>If <i>x</i> and <i>y</i> are both <b>NaN</b>, return <b>+0</b>.</li>
<li>If <i>x</i> is <b>NaN</b>, return 1.</li>
<li>If <i>y</i> is <b>NaN</b>, return −1.</li>
<li>If the argument <i>comparefn</i> is not <b>undefined</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>comparefn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>Return the result of calling the [[Call]] internal method of <i>comparefn</i> passing <b>undefined</b> as
<i>thisArgument</i> and with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the values
of <i>x</i> and <i>y</i> as the <i>argumentsList</i>.</li>
</ol>
</li>
<li>If <i>x</i> &lt; <i>y</i>, return −1.</li>
<li>If <i>x</i> &gt; <i>y</i>, return 1.</li>
<li>Return <b>+0</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> Because <b>NaN</b> always compares greater than any other value, <b>NaN</b> property
values always sort to the end of the result.</p>
</div>
</section>
<section id="sec-%typedarray%.prototype.subarray">
<h1><span class="secnum" id="sec-22.2.3.27"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.subarray" title="link to this section">22.2.3.27</a></span> %TypedArray%.prototype.subarray( [ begin [ , end ] ] )</h1>
<p>Returns a new <i>TypedArray</i> object whose element types is the same as this <i>TypedArray</i> and whose ArrayBuffer
is the same as the ArrayBuffer of this <i>TypedArray</i>, referencing the elements at <var>begin</var>, inclusive, up to
<var>end</var>, exclusive. If either <var>begin</var> or <var>end</var> is negative, it refers to an index from the end of
the array, as opposed to from the beginning.</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>srcLength</i> be the value of <i>O</i>’s [[ArrayLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>beginInt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>begin</i>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>beginInt</i>).</li>
<li>If <i>beginInt</i> &lt; 0, then let <i>beginInt</i> be <i>srcLength</i> + <i>beginInt</i>.</li>
<li>Let <i>beginIndex</i> be min(<i>srcLength</i>, max(0, <i>beginInt</i>)).</li>
<li>If <i>end</i> is <b>undefined</b>, then let <i>end</i> be <i>srcLength</i>.</li>
<li>Let <i>endInt</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>endInt</i>).</li>
<li>If <i>endInt</i> &lt; 0, then let <i>endInt</i> be <i>srcLength</i> + <i>endInt</i>.</li>
<li>Let <i>endIndex</i> be max(0,min(<i>srcLength</i>, <i>endInt</i>)).</li>
<li>If <i>endIndex</i> &lt; <i>beginIndex</i>, then let <i>endIndex</i> be <i>beginIndex</i>.</li>
<li>Let <i>newLength</i> be <i>endIndex</i> - <i>beginIndex</i>.</li>
<li>Let <i>constructorName</i> be the string value <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementType</i> be the string value of the Element Type value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for
<i>constructorName</i>.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for <i>constructorName</i>.</li>
<li>Let <i>srcByteOffset</i> be the value of <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>beginByteOffset</i> be <i>srcByteOffset</i> + <i>beginIndex</i> × <i>elementSize</i>.</li>
<li>Let <i>constructor</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>constructor</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>constructor</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>argumentsList</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> consisting of
<i>buffer</i>, <i>beginByteOffset</i>, and <i>newLength</i>.</li>
<li>Return the result of calling the [[Construct]] internal method of <i>constructor</i> with <i>argumentsList</i> as
the argument.</li>
</ol>
</section>
<section id="sec-%typedarray%.prototype.tolocalestring">
<h1><span class="secnum" id="sec-22.2.3.28"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.tolocalestring" title="link to this section">22.2.3.28</a></span> %TypedArray%.prototype.toLocaleString ( )</h1>
<p>The initial value of the %TypedArray%.prototype.toLocaleString data property is the same built-in function object as
the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.tolocalestring">Array.prototype.toLocaleString</a> method defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.tolocalestring">22.1.3.26</a>.</p>
</section>
<section id="sec-%typedarray%.prototype.tostring">
<h1><span class="secnum" id="sec-22.2.3.29"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.tostring" title="link to this section">22.2.3.29</a></span> %TypedArray%.prototype.toString ( )</h1>
<p>The initial value of the %TypedArray%.prototype.toString data property is the same built-in function object as the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.tostring">Array.prototype.toString</a> method defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.tostring">22.1.3.27</a>.</p>
</section>
<section id="sec-%typedarray%.prototype.values">
<h1><span class="secnum" id="sec-22.2.3.30"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.values" title="link to this section">22.2.3.30</a></span> %TypedArray%.prototype.values ( )</h1>
<p>The initial value of the %TypedArray%.<code>prototype.values</code> data property is the same built-in function object
as the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values">Array.prototype.values</a></code> method defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values">22.1.3.29</a>.</p>
</section>
<section id="sec-%typedarray%.prototype-@@iterator">
<h1><span class="secnum" id="sec-22.2.3.31"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype-@@iterator" title="link to this section">22.2.3.31</a></span> %TypedArray%.prototype [ @@iterator ] ( )</h1>
<p>The initial value of the @@iterator property is the same function object as the initial value of the
%TypedArray%<b>.prototype.values</b> property.</p>
</section>
<section id="sec-get-%typedarray%.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-22.2.3.32"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-%typedarray%.prototype-@@tostringtag" title="link to this section">22.2.3.32</a></span> get %TypedArray%.prototype [ @@toStringTag ]</h1>
<p>%TypedArray%.<code>prototype[@@toStringTag]</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b>.value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>name</i> be the value of <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If the value of <i>O</i>’s [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>name</i> is a String value.</li>
<li>Return <i>name</i>.</li>
</ol>
<p>This property has the attributes { [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<p>The initial value of the <code>name</code> property of this function is <code>"get [Symbol.toStringTag]"</code>.</p>
</section>
</section>
<section id="sec-typedarray-constructors">
<div class="front">
<h1><span class="secnum" id="sec-22.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-constructors" title="link to this section">22.2.4</a></span> The <i>TypedArray</i> Constructors</h1>
<p>Each of these <i>TypedArray</i> constructor objects has the structure described below, differing only in the name used
as the constructor name instead of <i>TypedArray</i>, in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>.</p>
<p>When a <i>TypedArray</i> constructor is called as a function rather than as a constructor, it initiallizes a new
<i>TypedArray</i> object. The <b>this</b> value passed in the call must be an Object with a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined</span>. The constructor function initiallizes the <b>this</b> value using the argument values.</p>
<p>The <i>TypedArray</i> constructors are designed to be subclassable. They may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<i>TypedArray</i> behaviour must include a <code>super</code> call to the <i>TypedArray</i> constructor to initiallize
subclass instances.</p>
</div>
<section id="sec-typedarray">
<h1><span class="secnum" id="sec-22.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray" title="link to this section">22.2.4.1</a></span>
<i>TypedArray</i>( ... argumentsList)</h1>
<p>A <i>TypedArray</i> constructor with a list of arguments <i>argumentsList</i> performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>O’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Set <i>O’s</i> [[TypedArrayName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to the String value from the constructor name column in the row of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> corresponding to
this constructor.</li>
<li>Let <i>F</i> be the <i>TypedArray</i> function object that was called.</li>
<li>Let <i>realmF</i> be <i>F’s</i> [[Realm]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</li>
<li>Let <i>super</i> be <i>realmF’s</i> <span style="font-family: sans-serif">%TypedArray%</span> intrinsic
object.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Call]] internal method that invoked
<i>F</i>.</li>
<li>Return the result of calling the [[Call]] internal method of <i>super</i> with <i>O</i> and <i>argumentsList</i> as
arguments.</li>
</ol>
</section>
<section id="sec-new-typedarray-argumentslist">
<h1><span class="secnum" id="sec-22.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-typedarray-argumentslist" title="link to this section">22.2.4.2</a></span> new <i>TypedArray</i>( ... argumentsList)</h1>
<p>A <i>TypedArray</i> constructor called as part of a new expression performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <i>TypedArray</i> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
</section>
</section>
<section id="sec-properties-of-the-typedarray-constructors">
<div class="front">
<h1><span class="secnum" id="sec-22.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-typedarray-constructors" title="link to this section">22.2.5</a></span> Properties of the <i>TypedArray</i> Constructors</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of each
<i>TypedArray</i> constructor is the %TypedArray% intrinsic object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%-intrinsic-object">22.2.1</a>).</p>
<p>Each <i>TypedArray</i> constructor has a <code>name</code> property whose value is the String value of the constructor
name specifried for it in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>.</p>
<p>Besides a <code>length</code> property (whose value is 3), each <i>TypedArray</i> constructor has the following
properties:</p>
</div>
<section id="sec-typedarray.bytes_per_element">
<h1><span class="secnum" id="sec-22.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray.bytes_per_element" title="link to this section">22.2.5.1</a></span> <i>TypedArray</i>.BYTES_PER_ELEMENT</h1>
<p>The value of <i>TypedArray</i>.BYTES_PER_ELEMENT is the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for <i>TypedArray</i>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-typedarray.prototype">
<h1><span class="secnum" id="sec-22.2.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray.prototype" title="link to this section">22.2.5.2</a></span> <i>TypedArray</i>.prototype</h1>
<p>The initial value of <i>TypedArray</i>.prototype is the corresponding <i>TypedArray</i> prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-typedarray-prototype-objects">22.2.6</a>).</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">false</span> }.</p>
</section>
</section>
<section id="sec-properties-of-typedarray-prototype-objects">
<div class="front">
<h1><span class="secnum" id="sec-22.2.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-typedarray-prototype-objects" title="link to this section">22.2.6</a></span> Properties of <i>TypedArray</i> Prototype Objects</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of a
<i>TypedArray</i> prototype object is the standard built-in %TypedArrayPrototype% object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarrayprototype%-object">22.2.3</a>). A <i>TypedArray</i> prototype object is an
ordinary object. It does not have a [[ViewedArrayBuffer]] or or any other of the internal slots that are specific to
<i>TypedArray</i> instance objects.</p>
</div>
<section id="sec-typedarray.prototype.bytes_per_element">
<h1><span class="secnum" id="sec-22.2.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray.prototype.bytes_per_element" title="link to this section">22.2.6.1</a></span> <i>TypedArray</i>.prototype.BYTES_PER_ELEMENT</h1>
<p>The value of <i>TypedArray</i>.prototype.BYTES_PER_ELEMENT is the Number value of the Element Size value specified in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for <i>TypedArray</i>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-typedarray.prototype.constructor">
<h1><span class="secnum" id="sec-22.2.6.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray.prototype.constructor" title="link to this section">22.2.6.2</a></span> <i>TypedArray</i>.prototype.constructor</h1>
<p>The initial value of a <i>TypedArray</i>.prototype.constructor is the corresponding standard built-in <i>TypedArray</i>
constructor.</p>
</section>
</section>
<section id="sec-properties-of-typedarray-instances">
<h1><span class="secnum" id="sec-22.2.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-typedarray-instances" title="link to this section">22.2.7</a></span> Properties of <i>TypedArray</i> Instances</h1>
<p><i>TypedArray</i> instances are Integer Indexed exotic objects. Each <i>TypedArray</i> instances inherits properties from
the corresponding <i>TypedArray</i> prototype object. Each <i>TypedArray</i> instances have the following internal slots:
[[TypedArrayName]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]], and [[ArrayLength]].</p>
</section>
</section>
</section>
<section id="sec-keyed-collection">
<div class="front">
<h1><span class="secnum" id="sec-23"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keyed-collection" title="link to this section">23</a></span> Keyed
Collection</h1>
</div>
<section id="sec-map-objects">
<div class="front">
<h1><span class="secnum" id="sec-23.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects" title="link to this section">23.1</a></span> Map
Objects</h1>
<p>Map objects are collections of key/value pairs where both the keys and values may be arbitrary <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. A distinct key value may only occur in one key/value
pair within the Map’s collection. Distinct key values are discriminated using the SameValue0 comparision
algorithm.</p>
<p>A Map object can iterate its elements in insertion order. Map object must be implemented using either hash tables or
other mechanisms that, on average, provide access times that are sublinear on the number of elements in the collection. The
data structures used in this Map objects specification is only intended to describe the required observable semantics of Map
objects. It is not intended to be a viable implementation model.</p>
</div>
<section id="sec-map-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-constructor" title="link to this section">23.1.1</a></span> The
Map Constructor</h1>
<p>The Map constructor is the %Map% intrinsic object and the initial value of the <code>Map</code> property of the global
object. When <code>Map</code> is called as a function rather than as a constructor, it iinitializes its <b>this</b> value
with the internal state necessary to support the <code>Map.prototype</code> built-in methods.</p>
<p>The <code>Map</code> constructor is designed to be subclassable. It may be used as the value in an <code>extends</code>
clause of a class definition. Subclass constructors that intend to inherit the specified <code>Map</code> behaviour must
include a <code>super</code> call to <code>Map</code>.</p>
</div>
<section id="sec-map-iterable">
<h1><span class="secnum" id="sec-23.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-iterable" title="link to this section">23.1.1.1</a></span>
Map ( [ iterable ] )</h1>
<p>When the <code>Map</code> function is called with optional argument the following steps are taken:</p>
<ol class="proc">
<li>Let <i>map</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>map</i>) is not Object then, throw a
<b>TypeError</b> exception.</li>
<li>If <i>map</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>map’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>iterable</i> is not present, let <i>iterable</i> be <b>undefined</b>.</li>
<li>If <i>iterable</i> is either <b>undefined</b> or <b>null</b>, then let <i>iter</i> be <b>undefined</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>iter</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>iterable</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iter</i>).</li>
<li>Let <i>adder</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>map</i>, <code>"set"</code>)<b>.</b></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>adder</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>adder</i>) is <b>false</b>, throw a <b>TypeError</b>
Exception.</li>
</ol>
</li>
<li>If the value of <i>map’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>map</i> has not been reentrantly initialized.</li>
<li>Set <i>map’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to a
new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>iter</i> is <b>undefined</b>, then return <i>map</i>.</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iter</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>map</i>).</li>
<li>Let <i>nextItem</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextItem</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>nextItem</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>k</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>nextItem</i>, <code>"0"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>k</i>).</li>
<li>Let <i>v</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>nextItem</i>, <code>"1"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of <i>adder</i> with <i>map</i> as
<i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements are <i>k</i>
and <i>v</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> If the parameter <i>iterable</i> is present, it is expected to be an object that
implements an @@iterator method that returns an iterator object that produces a two element array-like object whose
first element is a value that will be used as an Map key and whose second element is the value to associate with that
key.</p>
</div>
</section>
<section id="sec-new-map-argumentslist">
<h1><span class="secnum" id="sec-23.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-map-argumentslist" title="link to this section">23.1.1.2</a></span> new Map ( ... argumentsList )</h1>
<p>When <code>Map</code> is called as part of a <code>new</code> expression it is a constructor: it iinitializes a newly
created object.</p>
<p><code>Map</code> called as part of a new expression with argument list <var>argumentsList</var> performs the following
steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the Map function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If Map is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-map-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-constructor" title="link to this section">23.1.2</a></span> Properties of the Map Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Map
constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the Map constructor has the following
properties:</p>
</div>
<section id="sec-map.prototype">
<h1><span class="secnum" id="sec-23.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype" title="link to this section">23.1.2.1</a></span>
Map.prototype</h1>
<p>The initial value of <code>Map.prototype</code> is the Map prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object">23.1.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-map-@@create">
<h1><span class="secnum" id="sec-23.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-@@create" title="link to this section">23.1.2.2</a></span>
Map[ @@create ] ( )</h1>
<p>The @@create method of a Map function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>, <code>"%MapPrototype%"</code>,
( [[MapData]]).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-map-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-23.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object" title="link to this section">23.1.3</a></span> Properties of the Map Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Map
prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The Map prototype object is an ordinary object. It does
not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-map.prototype.clear">
<h1><span class="secnum" id="sec-23.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.clear" title="link to this section">23.1.3.1</a></span> Map.prototype.clear ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>Set <i>p</i>.[[key]] to <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Set <i>p</i>.[[value]] to <span style="font-family: sans-serif">empty</span><i>.</i></li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The existing [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> is
preserved because there may be existing MapIterator objects that are <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a>
midway through iterating over that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</p>
</div>
</section>
<section id="sec-map.prototype.constructor">
<h1><span class="secnum" id="sec-23.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.constructor" title="link to this section">23.1.3.2</a></span> Map.prototype.constructor</h1>
<p>The initial value of <code>Map.prototype.constructor</code> is the built-in <code>Map</code> constructor.</p>
</section>
<section id="sec-map.prototype.delete">
<h1><span class="secnum" id="sec-23.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.delete" title="link to this section">23.1.3.3</a></span> Map.prototype.delete ( key )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then
<ol class="block">
<li>Set <i>p</i>.[[key]] to <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Set <i>p</i>.[[value]] to <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The value <b>empty</b> is used as a specification device to indicate that an entry has
been deleted. Actual implementations may take other actions such as physically removing the entry from internal data
structures.</p>
</div>
</section>
<section id="sec-map.prototype.entries">
<h1><span class="secnum" id="sec-23.1.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.entries" title="link to this section">23.1.3.4</a></span> Map.prototype.entries ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmapiterator">CreateMapIterator</a> abstract operation with
arguments <i>M</i> and <code>"key+value"</code>.</li>
</ol>
</section>
<section id="sec-map.prototype.foreach">
<h1><span class="secnum" id="sec-23.1.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.foreach" title="link to this section">23.1.3.5</a></span> Map.prototype.forEach ( callbackfn [ , thisArg ] )</h1>
<p class="Note"><span style="font-family: sans-serif">NOTE</span> <i>callbackfn</i> should be a function that accepts
three arguments. <code>forEach</code> calls <i>callbackfn</i> once for each key/value pair present in the map object, in
key insertion order. <i>callbackfn</i> is called only for keys of the map which actually exist; it is not called for keys
that have been deleted from the map.</p>
<p class="Note">If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p class="Note"><i>callbackfn</i> is called with three arguments: the value of the item, the key of the item, and the Map
object being traversed.</p>
<p class="Note"><code>forEach</code> does not directly mutate the object on which it is called but the object may be
mutated by the calls to <i>callbackfn</i>.</p>
<p>When the <code>forEach</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>e</i> that is an element of <i>entries,</i> in original key insertion
order
<ol class="block">
<li>If <i>e</i>.[[key]] is not <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>Let <i>funcResult</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>e</i>.[[value]], <i>e</i>.[[key]], and <i>M</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>funcResult</i>).</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
<p>The <code>length</code> property of the <code>forEach</code> method is <b>1</b>.</p>
</section>
<section id="sec-map.prototype.get">
<h1><span class="secnum" id="sec-23.1.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.get" title="link to this section">23.1.3.6</a></span> Map.prototype.get ( key )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then return
<i>p</i>.[[value]].</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-map.prototype.has">
<h1><span class="secnum" id="sec-23.1.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.has" title="link to this section">23.1.3.7</a></span> Map.prototype.has ( key )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then return
<b>true</b><i>.</i></li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-map.prototype.keys">
<h1><span class="secnum" id="sec-23.1.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.keys" title="link to this section">23.1.3.8</a></span> Map.prototype.keys ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmapiterator">CreateMapIterator</a> abstract operation with
arguments <i>M</i> and <code>"key"</code>.</li>
</ol>
</section>
<section id="sec-map.prototype.set">
<h1><span class="secnum" id="sec-23.1.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.set" title="link to this section">23.1.3.9</a></span> Map.prototype.set ( key , value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then
<ol class="block">
<li>Set <i>p</i>.[[value]] to <i>value.</i></li>
<li>Return <i>M</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>key</i> is −0, then let <i>key</i> be +0.</li>
<li>Let <i>p</i> be the Record {[[key]]: <i>key</i>, [[value]]: <i>value</i>}.</li>
<li>Append <i>p</i> as the last element of <i>entries</i>.</li>
<li>Return <i>M</i>.</li>
</ol>
</section>
<section id="sec-get-map.prototype.size">
<h1><span class="secnum" id="sec-23.1.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-map.prototype.size" title="link to this section">23.1.3.10</a></span> get Map.prototype.size</h1>
<p>Map.prototype.size is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get
accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>count</i> be 0.</li>
<li>For each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> then
<ol class="block">
<li>Set <i>count</i> to <i>count</i>+1.</li>
</ol>
</li>
</ol>
</li>
<li>Return <i>count</i>.</li>
</ol>
</section>
<section id="sec-map.prototype.values">
<h1><span class="secnum" id="sec-23.1.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype.values" title="link to this section">23.1.3.11</a></span> Map.prototype.values ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmapiterator">CreateMapIterator</a> abstract operation with
arguments <i>M</i> and <code>"value"</code>.</li>
</ol>
</section>
<section id="sec-map.prototype-@@iterator">
<h1><span class="secnum" id="sec-23.1.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype-@@iterator" title="link to this section">23.1.3.12</a></span> Map.prototype [ @@iterator ]( )</h1>
<p>The initial value of the @@iterator property is the same function object as the initial value of the <b>entries</b>
property.</p>
</section>
<section id="sec-map.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-23.1.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map.prototype-@@tostringtag" title="link to this section">23.1.3.13</a></span> Map.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">Map</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-map-instances">
<h1><span class="secnum" id="sec-23.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-map-instances" title="link to this section">23.1.4</a></span> Properties of Map Instances</h1>
<p>Map instances are ordinary objects that inherit properties from the Map prototype. Map instances also have a [[MapData]]
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</section>
<section id="sec-map-iterator-objects">
<div class="front">
<h1><span class="secnum" id="sec-23.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-iterator-objects" title="link to this section">23.1.5</a></span> Map Iterator Objects</h1>
<p>A Map Iterator is an object, that represents a specific iteration over some specific Map instance object. There is not
a named constructor for Map Iterator objects. Instead, map iterator objects are created by calling certain methods of Map
instance objects.</p>
</div>
<section id="sec-createmapiterator">
<h1><span class="secnum" id="sec-23.1.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmapiterator" title="link to this section">23.1.5.1</a></span> CreateMapIterator Abstract Operation</h1>
<p>Several methods of Map objects return Iterator objects. The abstract operation CreateMapIterator with arguments
<var>map</var> and <var>kind</var> is used to create such iterator objects. It performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>map</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>map</i> does not have a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>map’s</i> [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>iterator</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%MapIteratorPrototype%</span>, ([[Map]], [[MapNextIndex]], [[MapIterationKind]])).</li>
<li>Set <i>iterator’s</i> [[Map]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>map</i>.</li>
<li>Set <i>iterator’s</i> [[MapNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to 0.</li>
<li>Set <i>iterator’s</i> [[MapIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>kind</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-%mapiteratorprototype%-object">
<div class="front">
<h1><span class="secnum" id="sec-23.1.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%mapiteratorprototype%-object" title="link to this section">23.1.5.2</a></span> The %MapIteratorPrototype% Object</h1>
<p>All Map Iterator Objects inherit properties from the %MapIteratorPrototype% intrinsic object. The
%MapIteratorPrototype% intrinsic object is an ordinary object and its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the %ObjectPrototype% intrinsic object. In
addition, %MapIteratorPrototype% has the following properties:</p>
</div>
<section id="sec-%mapiteratorprototype%.next">
<h1><span class="secnum" id="sec-23.1.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%mapiteratorprototype%.next" title="link to this section">23.1.5.2.1</a></span> %MapIteratorPrototype%.next ( )</h1>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have all of the internal slots of a Map Iterator Instance (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-map-iterator-instances">23.1.5.3</a>), throw a <b>TypeError</b> exception.</li>
<li>Let <i>m</i> be the value of the [[Map]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>O</i>.</li>
<li>Let <i>index</i> be the value of the [[MapNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>itemKind</i> be the value of the [[MapIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>m</i> is <b>undefined</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>)</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>m</i> has a [[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and <i>m</i> has been iinitialized so the
value of [[MapData]] is not <b>undefined</b>.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of the
[[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>m</i>.</li>
<li>Repeat while <i>index</i> is less than the total number of elements of <i>entries</i>. The number of elements must
be redetermined each time this method is evaluated.
<ol class="block">
<li>Let <i>e</i> be the Record {[[key]], [[value]]} that is the value of <i>entries</i>[<i>index</i>].</li>
<li>Set <i>index</i> to <i>index</i>+1;</li>
<li>Set the [[MapNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i> to <i>index</i>.</li>
<li>If <i>e</i>.[[key]] is not <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>If <i>itemKind</i> is <b>"<span style="font-family: monospace">key</span>"</b> then, let <i>result</i> be
<i>e</i>.[[key]].</li>
<li>Else if <i>itemKind</i> is <b>"<span style="font-family: monospace">value</span>"</b> then, let
<i>result</i> be <i>e</i>.[[value]].</li>
<li>Else,
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>itemKind</i> is <code>"key+value"</code>.</li>
<li>Let <i>result</i> be the result of performing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(2).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>result</i> is a new, well-formed Array object so
the following operations will never fail.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family: monospace">0</span>"</b>, <i>e</i>.[[key]]) .</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family: monospace">1</span>"</b>, <i>e</i>.[[value]]).</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>result</i>, <b>false</b>).</li>
</ol>
</li>
</ol>
</li>
<li>Set the [[Map]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to
<b>undefined</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
</ol>
</section>
<section id="sec-%mapiteratorprototype%-@@iterator">
<h1><span class="secnum" id="sec-23.1.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%mapiteratorprototype%-@@iterator" title="link to this section">23.1.5.2.2</a></span> %MapIteratorPrototype% [ @@iterator ] ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return the <b>this</b> value.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
<section id="sec-%mapiteratorprototype%-@@tostringtag">
<h1><span class="secnum" id="sec-23.1.5.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%mapiteratorprototype%-@@tostringtag" title="link to this section">23.1.5.2.3</a></span> %MapIteratorPrototype% [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family: monospace">Map
Iterator</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-map-iterator-instances">
<h1><span class="secnum" id="sec-23.1.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-map-iterator-instances" title="link to this section">23.1.5.3</a></span> Properties of Map Iterator Instances</h1>
<p>Map Iterator instances are ordinary objects that inherit properties from the %MapIteratorPrototype% intrinsic object.
Map Iterator instances are initially created with the internal slots described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-45">Table 45</a>.</p>
<figure>
<figcaption><span id="table-45">Table 45</span> — Internal Slots of Map Iterator Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[Map]]</td>
<td>The Map object that is being iterated.</td>
</tr>
<tr>
<td>[[MapNextIndex]]</td>
<td>The integer index of the next Map data element to be examined by this iterator.</td>
</tr>
<tr>
<td>[[MapIterationKind]]</td>
<td>A string value that identifies what is to be returned for each element of the iteration. The possible values are: <b>"<span style="font-family: monospace">key</span>"</b>, <b>"<span style="font-family: monospace">value</span>"</b>, <b>"<span style="font-family: monospace">key+value</span>"</b>.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-set-objects">
<div class="front">
<h1><span class="secnum" id="sec-23.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-objects" title="link to this section">23.2</a></span> Set
Objects</h1>
<p>Set objects are collections of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. A distinct value
may only occur once as an element of a Set’s collection. Distinct values are discriminated using the SameValue0
comparision algorithm.</p>
<p>A Set object can iterate its elements in insertion order. Set objects must be implemented using either hash tables or
other mechanisms that, on average, provide access times that are sublinear on the number of elements in the collection. The
data structures used in this Set objects specification is only intended to describe the required observable semantics of Set
objects. It is not intended to be a viable implementation model.</p>
</div>
<section id="sec-set-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-constructor" title="link to this section">23.2.1</a></span> The
Set Constructor</h1>
<p>The Set constructor is the %Set% intrinsic object and the initial value of the <code>Set</code> property of the global
object. When <code>Set</code> is called as a function rather than as a constructor, it iinitializes its <b>this</b> value
with the internal state necessary to support the <code>Set.prototype</code> built-in methods.</p>
<p>The <code>Set</code> constructor is designed to be subclassable. It may be used as the value in an <code>extends</code>
clause of a class definition. Subclass constructors that intend to inherit the specified <code>Set</code> behaviour must
include a <code>super</code> call to <code>Set</code>.</p>
</div>
<section id="sec-set-iterable">
<h1><span class="secnum" id="sec-23.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-iterable" title="link to this section">23.2.1.1</a></span>
Set ( [ iterable ] )</h1>
<p>When the <code>Set</code> function is called with optional argument <var>iterable</var> the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>set</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>set</i>) is not Object then, throw a
<b>TypeError</b> exception.</li>
<li>If <i>set</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>set’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>iterable</i> is not present, let <i>iterable</i> be <b>undefined</b>.</li>
<li>If <i>iterable</i> is either <b>undefined</b> or <b>null</b>, then let <i>iter</i> be <b>undefined</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>iter</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>iterable</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iter</i>).</li>
<li>Let <i>adder</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>set</i>, <code>"add"</code>)<b>.</b></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>adder</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>adder</i>) is <b>false</b>, throw a <b>TypeError</b>
Exception.</li>
</ol>
</li>
<li>If the value of <i>sets’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>set</i> has not been reentrantly initialized.</li>
<li>Set <i>set’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to a
new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>iter</i> is <b>undefined</b>, then return <i>set</i>.</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iter</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <i>set</i>.</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of <i>adder</i> with <i>set</i> as
<i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose sole element is
<i>nextValue</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-new-set-argumentslist">
<h1><span class="secnum" id="sec-23.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-set-argumentslist" title="link to this section">23.2.1.2</a></span> new Set ( ...argumentsList )</h1>
<p>When <code>Set</code> is called as part of a <code>new</code> expression it is a constructor: it iinitializes a newly
created object. Set called as part of a new expression with argument list <i>argumentsList</i> performs the following
steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the Set function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If Set is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-set-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-set-constructor" title="link to this section">23.2.2</a></span> Properties of the Set Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Set
constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the Set constructor has the following
properties:</p>
</div>
<section id="sec-set.prototype">
<h1><span class="secnum" id="sec-23.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype" title="link to this section">23.2.2.1</a></span>
Set.prototype</h1>
<p>The initial value of <code>Set.prototype</code> is the intrinsic %SetPrototype% object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-set-prototype-object">23.2.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-set-@@create">
<h1><span class="secnum" id="sec-23.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-@@create" title="link to this section">23.2.2.2</a></span>
Set[ @@create ] ( )</h1>
<p>The @@create method of a Set function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>, <code>"%SetPrototype%"</code>,
( [[SetData]])).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-set-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-23.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-set-prototype-object" title="link to this section">23.2.3</a></span> Properties of the Set Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Set
prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The Set prototype object is an ordinary object. It does
not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-set.prototype.add">
<h1><span class="secnum" id="sec-23.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.add" title="link to this section">23.2.3.1</a></span> Set.prototype.add ( value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries,</i> in original insertion order
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>e</i>, <i>value</i>) is <b>true</b>, then
<ol class="block">
<li>Return <i>S</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>value</i> is −0, then let <i>value</i> be +0.</li>
<li>Append <i>value</i> as the last element of <i>entries</i>.</li>
<li>Return <i>S</i>.</li>
</ol>
</section>
<section id="sec-set.prototype.clear">
<h1><span class="secnum" id="sec-23.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.clear" title="link to this section">23.2.3.2</a></span> Set.prototype.clear ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries,</i>
<ol class="block">
<li>Replace the element of <i>entries</i> whose value is <i>e</i> with an element whose value is <span style="font-family: sans-serif">empty</span><i>.</i></li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-set.prototype.constructor">
<h1><span class="secnum" id="sec-23.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.constructor" title="link to this section">23.2.3.3</a></span> Set.prototype.constructor</h1>
<p>The initial value of <code>Set.prototype.constructor</code> is the built-in <code>Set</code> constructor.</p>
</section>
<section id="sec-set.prototype.delete">
<h1><span class="secnum" id="sec-23.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.delete" title="link to this section">23.2.3.4</a></span> Set.prototype.delete ( value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries</i>, in original insertion order
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>e</i>, <i>value</i>) is <b>true</b>, then
<ol class="block">
<li>Replace the element of <i>entries</i> whose value is <i>e</i> with an element whose value is <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The value <b>empty</b> is used as a specification device to indicate that an entry has
been deleted. Actual implementations may take other actions such as physically removing the entry from internal data
structures.</p>
</div>
</section>
<section id="sec-set.prototype.entries">
<h1><span class="secnum" id="sec-23.2.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.entries" title="link to this section">23.2.3.5</a></span> Set.prototype.entries ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createsetiterator">CreateSetIterator</a> abstract operation with
arguments <i>S</i> and <b>"<span style="font-family: monospace">key+value</span>"</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> For iteration purposes, a Set appears similar to a Map where each entry has the same
value for its key and value.</p>
</div>
</section>
<section id="sec-set.prototype.foreach">
<h1><span class="secnum" id="sec-23.2.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.foreach" title="link to this section">23.2.3.6</a></span> Set.prototype.forEach ( callbackfn [ , thisArg ] )</h1>
<div class="note">
<p><span class="nh">NOTE</span> <i>callbackfn</i> should be a function that accepts three arguments.
<code>forEach</code> calls <i>callbackfn</i> once for each value present in the set object, in value insertion order.
<i>callbackfn</i> is called only for values of the Set which actually exist; it is not called for keys that have been
deleted from the set.</p>
<p>If a <i>thisArg</i> parameter is provided, it will be used as the <b>this</b> value for each invocation of
<i>callbackfn</i>. If it is not provided, <b>undefined</b> is used instead.</p>
<p>If <i>callbackfn</i> is an Arrow Function, <b>this</b> was lexically bound when the function was created so
<i>thisArg</i> will have no effect.</p>
<p><i>callbackfn</i> is called with three arguments: the first two arguments are a value contained in the Set. The same
value of passed for both arguments. The Set object being traversed is passed as the third argument.</p>
<p>The <i>callbackfn</i> is called with three arguments to be consistent with the call back functions used by
<code>forEach</code> methods for Map and Array. For Sets, each item value is considered to be both the key and the
value.</p>
<p><code>forEach</code> does not directly mutate the object on which it is called but the object may be mutated by the
calls to <i>callbackfn</i>.</p>
<p>Each value is normally visited only once. However, a value will be revisited if it is deleted after it has been
visited and then re-added before the to <code>forEach</code> call completes. Values that are deleted after the call to
<code>forEach</code> begins and before being visited are not visited unless the value is added again before the to
<code>forEach</code> call completes. New values added, after the call to <code>forEach</code> begins are visited.</p>
</div>
<p>When the <code>forEach</code> method is called with one or two arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>callbackfn</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>thisArg</i> was supplied, let <i>T</i> be <i>thisArg</i>; else let <i>T</i> be <b>undefined</b>.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries,</i> in original insertion order
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>Let <i>funcResult</i> be the result of calling the [[Call]] internal method of <i>callbackfn</i> with
<i>T</i> as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>e</i>, <i>e</i>, and <i>S</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>funcResult</i>).</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
<p>The <code>length</code> property of the <code>forEach</code> method is <b>1</b>.</p>
</section>
<section id="sec-set.prototype.has">
<h1><span class="secnum" id="sec-23.2.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.has" title="link to this section">23.2.3.7</a></span> Set.prototype.has ( value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>e</i>, <i>value</i>) is <b>true</b>, then return
<b>true</b><i>.</i></li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-set.prototype.keys">
<h1><span class="secnum" id="sec-23.2.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.keys" title="link to this section">23.2.3.8</a></span> Set.prototype.keys ( )</h1>
<p>The initial value of the <code>keys</code> property is the same function object as the initial value of the
<code>values</code> property.</p>
<div class="note">
<p><span class="nh">NOTE</span> For iteration purposes, a Set appears similar to a Map where each entry has the same
value for its key and value.</p>
</div>
</section>
<section id="sec-get-set.prototype.size">
<h1><span class="secnum" id="sec-23.2.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-set.prototype.size" title="link to this section">23.2.3.9</a></span> get Set.prototype.size</h1>
<p><code>Set.prototype.size</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>count</i> be 0.</li>
<li>For each <i>e</i> that is an element of <i>entries</i>
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> then
<ol class="block">
<li>Set <i>count</i> to <i>count</i>+1.</li>
</ol>
</li>
</ol>
</li>
<li>Return <i>count</i>.</li>
</ol>
</section>
<section id="sec-set.prototype.values">
<h1><span class="secnum" id="sec-23.2.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype.values" title="link to this section">23.2.3.10</a></span> Set.prototype.values ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createsetiterator">CreateSetIterator</a> abstract operation with
argument <i>S</i> and <b>"<span style="font-family: monospace">value</span>"</b>.</li>
</ol>
</section>
<section id="sec-set.prototype-@@iterator">
<h1><span class="secnum" id="sec-23.2.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype-@@iterator" title="link to this section">23.2.3.11</a></span> Set.prototype [@@iterator ] ( )</h1>
<p>The initial value of the @@iterator property is the same function object as the initial value of the
<code>values</code> property.</p>
</section>
<section id="sec-set.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-23.2.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set.prototype-@@tostringtag" title="link to this section">23.2.3.12</a></span> Set.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">Set</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-set-instances">
<h1><span class="secnum" id="sec-23.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-set-instances" title="link to this section">23.2.4</a></span> Properties of Set Instances</h1>
<p>Set instances are ordinary objects that inherit properties from the Set prototype. After iinitialization by the Set
constructor, Set instances also have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>.</p>
</section>
<section id="sec-set-iterator-objects">
<div class="front">
<h1><span class="secnum" id="sec-23.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-iterator-objects" title="link to this section">23.2.5</a></span> Set Iterator Objects</h1>
<p>A Set Iterator is an ordinary object, with the structure defined below, that represents a specific iteration over some
specific Set instance object. There is not a named constructor for Set Iterator objects. Instead, set iterator objects
are created by calling certain methods of Set instance objects.</p>
</div>
<section id="sec-createsetiterator">
<h1><span class="secnum" id="sec-23.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createsetiterator" title="link to this section">23.2.5.1</a></span> CreateSetIterator Abstract Operation</h1>
<p>Several methods of Set objects return Iterator objects. The abstract operation CreateSetIterator with arguments
<var>set</var> and <var>kind</var> is used to create such iterator objects. It performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>set</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>set</i> does not have a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>set’s</i> [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>iterator</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%SetIteratorPrototype%</span>, ([[IteratedSet]], [[SetNextIndex]], [[SetIterationKind]])).</li>
<li>Set <i>iterator’s</i> [[IteratedSet]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>set</i>.</li>
<li>Set <i>iterator’s</i> [[SetNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to 0.</li>
<li>Set <i>iterator’s</i> [[SetIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>kind</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-%setiteratorprototype%-object">
<div class="front">
<h1><span class="secnum" id="sec-23.2.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%setiteratorprototype%-object" title="link to this section">23.2.5.2</a></span> The %SetIteratorPrototype% Object</h1>
<p>All Set Iterator Objects inherit properties from the %SetIteratorPrototype% intrinsic object. The
%SetIteratorPrototype% intrinsic object is an ordinary object and its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the %ObjectPrototype% intrinsic object. In
addition, %SetIteratorPrototype% has the following properties:</p>
</div>
<section id="sec-%setiteratorprototype%.next">
<h1><span class="secnum" id="sec-23.2.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%setiteratorprototype%.next" title="link to this section">23.2.5.2.1</a></span> %SetIteratorPrototype%.next ( )</h1>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have all of the internal slots of a Set Iterator Instance (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-set-iterator-instances">23.2.5.3</a>), throw a <b>TypeError</b> exception.</li>
<li>Let <i>s</i> be the value of the [[IteratedSet]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>index</i> be the value of the [[SetNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>itemKind</i> be the value of the [[SetIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>s</i> is <b>undefined</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>s</i> has a [[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and <i>s</i> has been iinitialized so the
value of [[SetData]] is not <b>undefined</b>.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of the
[[SetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>s</i>.</li>
<li>Repeat while <i>index</i> is less than the total number of elements of <i>entries</i>. The number of elements must
be redetermined each time this method is evaluated.
<ol class="block">
<li>Let <i>e</i> be <i>entries</i>[<i>index</i>].</li>
<li>Set <i>index</i> to <i>index</i>+1;</li>
<li>Set the [[SetNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i> to <i>index</i>.</li>
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span>, then
<ol class="block">
<li>If <i>itemKind</i> is <b>"<span style="font-family: monospace">key+value</span>"</b> then,
<ol class="block">
<li>Let <i>result</i> be the result of performing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(2).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>result</i> is a new, well-formed Array object so
the following operations will never fail.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family: monospace">0</span>"</b>, <i>e</i>) .</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family: monospace">1</span>"</b>, <i>e</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>result</i>,
<b>false</b>).</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>e</i>, <b>false</b>).</li>
</ol>
</li>
</ol>
</li>
<li>Set the [[IteratedSet]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to
<b>undefined</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
</ol>
</section>
<section id="sec-%setiteratorprototype%-@@iterator">
<h1><span class="secnum" id="sec-23.2.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%setiteratorprototype%-@@iterator" title="link to this section">23.2.5.2.2</a></span> %SetIteratorPrototype% [ @@iterator ] ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return the <b>this</b> value.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
<section id="sec-%setiteratorprototype%-@@tostringtag">
<h1><span class="secnum" id="sec-23.2.5.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%setiteratorprototype%-@@tostringtag" title="link to this section">23.2.5.2.3</a></span> %SetIteratorPrototype% [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family: monospace">Set
Iterator</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-set-iterator-instances">
<h1><span class="secnum" id="sec-23.2.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-set-iterator-instances" title="link to this section">23.2.5.3</a></span> Properties of Set Iterator Instances</h1>
<p>Set Iterator instances are ordinary objects that inherit properties from the %SetIteratorPrototype% intrinsic object.
Set Iterator instances are initially created with the internal slots specified <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-46">Table 46</a>.</p>
<figure>
<figcaption><span id="table-46">Table 46</span> — Internal Slots of Set Iterator Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[IteratedSet]]</td>
<td>The Set object that is being iterated.</td>
</tr>
<tr>
<td style="border-bottom: 0px solid black">[[SetNextIndex]]</td>
<td style="border-bottom: 0px solid black">The integer index of the next Set data element to be examined by this iterator</td>
</tr>
<tr>
<td style="border-top: 0px solid black">[[SetIterationKind]]</td>
<td style="border-top: 0px solid black">A string value that identifies what is to be returned for each element of the iteration. The possible values are: <b>"<span style="font-family: monospace">key</span>"</b>, <b>"<span style="font-family: monospace">value</span>"</b>, <b>"<span style="font-family: monospace">key+value</span>"</b>. <b>"<span style="font-family: monospace">key</span>"</b> and <b>"<span style="font-family: monospace">value</span>"</b> have the same meaning.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-weakmap-objects">
<div class="front">
<h1><span class="secnum" id="sec-23.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-objects" title="link to this section">23.3</a></span> WeakMap
Objects</h1>
<p>WeakMap objects are collections of key/value pairs where the keys are objects and values may be arbitrary <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types">ECMAScript language values</a>. A WeakMap may be queried to see if it contains an
key/value pair with a specific key, but no mechanisms is provided for enumerating the objects it holds as keys. If an object
that is being used as the key of a WeakMap key/value pair is only reachable by following a chain of references that start
within that WeakMap, then that key/value pair is inaccessible and is automatically removed from the WeakMap. WeakMap
implementations must detect and remove such key/value pairs and any associated resources.</p>
<p>An implementation may impose an arbitrarily determined latency between the time a key/value pair of a WeakMap becomes
inaccessible and the time when the key/value pair is removed from the WeakMap. If this latency was observable to ECMAScript
program, it would be a source of indeterminacy that could impact program execution.&nbsp; For that reason, an ECMAScript
implementation must not provide any means to observe a key of a WeakMap that does not require the observer to present the
observed key.</p>
<p>WeakMap objects must be implemented using either hash tables or other mechanisms that, on average, provide access times
that are sublinear on the number of key/value pairs in the collection. The data structure used in this WeakMap objects
specification are only intended to describe the required observable semantics of WeakMap objects. It is not intended to be
a viable implementation model.</p>
<div class="note">
<p><span class="nh">NOTE</span> WeakMap and WeakSets are intended to provide mechanisms for dynamically associating state
with an object in a manner that does not “leak” memory resources if, in the absence of the WeakMap or WeakSet,
the object otherwise became inaccessible and subject to resource reclamation by the implementation’s garbage
collection mechanisms. Achieving this characteristic requires coordination between the WeakMap or WeakSet implementation
and the garbage collector. The following references describe mechanism that may be useful to implementations of WeakMap
and WeakSets:</p>
<p>Barry Hayes. 1997. Ephemerons: a new finalization mechanism. In <i>Proceedings of the 12th ACM SIGPLAN conference on
Object-oriented programming, systems, languages, and applications (OOPSLA '97)</i>, A. Michael Berman (Ed.). ACM, New
York, NY, USA, 176-183. <a href="http://doi.acm.org/10.1145/263698.263733">http://doi.acm.org/10.1145/263698.263733</a>.</p>
<p>Alexandra Barros, Roberto Ierusalimschy, Eliminating Cycles in Weak Tables. Journal of Universal Computer Science -
J.UCS , vol. 14, no. 21, pp. 3481-3497, 2008. <a href="http://www.jucs.org/jucs_14_21/eliminating_cycles_in_weak">http://www.jucs.org/jucs_14_21/eliminating_cycles_in_weak</a></p>
</div>
</div>
<section id="sec-weakmap-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-constructor" title="link to this section">23.3.1</a></span>
The WeakMap Constructor</h1>
<p>The WeakMap constructor is the %WeakMap% intrinsic object and the initial value of the <code>WeakMap</code> property of
the global object. When <code>WeakMap</code> is called as a function rather than as a constructor, it iinitializes its
<b>this</b> value with the internal state necessary to support the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype">WeakMap.prototype</a></code> built-in methods.</p>
<p>The <code>WeakMap</code> constructor is designed to be subclassable. It may be used as the value in an
<code>extends</code> clause of a class definition. Subclass constructors that intend to inherit the specified
<code>WeakMap</code> behaviour must include a <code>super</code> call to <code>WeakMap</code>.</p>
</div>
<section id="sec-weakmap-iterable">
<h1><span class="secnum" id="sec-23.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-iterable" title="link to this section">23.3.1.1</a></span> WeakMap ( [ iterable ] )</h1>
<p>When the <code>WeakMap</code> function is called with optional argument <var>iterable</var> the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>map</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>map</i>) is not Object then, throw a
<b>TypeError</b> exception.</li>
<li>If <i>map</i> does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>map’s</i> [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>iterable</i> is not present, let <i>iterable</i> be <b>undefined</b>.</li>
<li>If <i>iterable</i> is either <b>undefined</b> or <b>null</b>, then let <i>iter</i> be <b>undefined</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>iter</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>iterable</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iter</i>).</li>
<li>Let <i>adder</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>map</i>, <code>"set"</code>)<b>.</b></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>adder</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>adder</i>) is <b>false</b>, throw a <b>TypeError</b>
Exception.</li>
</ol>
</li>
<li>If the value of <i>map’s</i> [Weak[MapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>map</i> has not been reentrantly initialized.</li>
<li>Set <i>map’s</i> [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>iter</i> is <b>undefined</b>, then return <i>map</i>.</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iter</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>map</i>).</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>nextValue</i>) is not Object, then throw a
<b>TypeError</b> exception</li>
<li>Let <i>k</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>nextValue</i>, <code>"0"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>k</i>).</li>
<li>Let <i>v</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>nextValue</i>, <code>"1"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>v</i>).</li>
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of <i>adder</i> with <i>map</i> as
<i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose elements are <i>k</i>
and <i>v</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> If the parameter <i>iterable</i> is present, it is expected to be an object that
implements an @@iterator method that returns an iterator object that produces a two element array-like object whose
first element is a value that will be used as a WeakMap key and whose second element is the value to associate with that
key.</p>
</div>
</section>
<section id="sec-new-weakmap-argumentslist">
<h1><span class="secnum" id="sec-23.3.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-weakmap-argumentslist" title="link to this section">23.3.1.2</a></span> new WeakMap ( ...argumentsList )</h1>
<p>When <code>WeakMap</code> is called as part of a <code>new</code> expression it is a constructor: it iinitializes a
newly created object.</p>
<p><code>WeakMap</code> called as part of a new expression with argument list <i>argumentsList</i> performs the following
steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the WeakMap function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If WeakMap is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-weakmap-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakmap-constructor" title="link to this section">23.3.2</a></span> Properties of the WeakMap Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
WeakMap constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the WeakMap constructor has the following
properties:</p>
</div>
<section id="sec-weakmap.prototype">
<h1><span class="secnum" id="sec-23.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype" title="link to this section">23.3.2.1</a></span> WeakMap.prototype</h1>
<p>The initial value of <code>WeakMap.prototype</code> is the WeakMap prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakmap-prototype-object">23.3.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-weakmap-@@create">
<h1><span class="secnum" id="sec-23.3.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-@@create" title="link to this section">23.3.2.2</a></span> WeakMap[ @@create ] ( )</h1>
<p>The @@create method of a WeakMap object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%WeakMapPrototype%"</code>, ( [[WeakMapData]] )).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-weakmap-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-23.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakmap-prototype-object" title="link to this section">23.3.3</a></span> Properties of the WeakMap Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
WeakMap prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The WeakMap prototype object is an ordinary object. It
does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-weakmap.prototype.clear">
<h1><span class="secnum" id="sec-23.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.clear" title="link to this section">23.3.3.1</a></span> WeakMap.prototype.clear ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>M’s</i> [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Set the value of <i>M</i>’s [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-weakmap.prototype.constructor">
<h1><span class="secnum" id="sec-23.3.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.constructor" title="link to this section">23.3.3.2</a></span> WeakMap.prototype.constructor</h1>
<p>The initial value of <code>WeakMap.prototype.constructor</code> is the built-in <code>WeakMap</code> constructor.</p>
</section>
<section id="sec-weakmap.prototype.delete">
<h1><span class="secnum" id="sec-23.3.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.delete" title="link to this section">23.3.3.3</a></span> WeakMap.prototype.delete ( key )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>entries</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>key</i>) is not Object, then return
<b>false</b>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then
<ol class="block">
<li>Set <i>p</i>.[[key]] to <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Set <i>p</i>.[[value]] to <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The value <b>empty</b> is used as a specification device to indicate that an entry has
been deleted. Actual implementations may take other actions such as physically removing the entry from internal data
structures.</p>
</div>
</section>
<section id="sec-weakmap.prototype.get">
<h1><span class="secnum" id="sec-23.3.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.get" title="link to this section">23.3.3.4</a></span> WeakMap.prototype.get ( key )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>entries</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>key</i>) is not Object, then return
<b>undefined</b>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then return
<i>p</i>.[[value]].</li>
</ol>
</li>
<li>Return <b>undefined</b><i>.</i></li>
</ol>
</section>
<section id="sec-weakmap.prototype.has">
<h1><span class="secnum" id="sec-23.3.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.has" title="link to this section">23.3.3.5</a></span> WeakMap.prototype.has ( key )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>entries</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>key</i>) is not Object, then return
<b>false</b>.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b> t, then return
<b>true</b><i>.</i></li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-weakmap.prototype.set">
<h1><span class="secnum" id="sec-23.3.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.set" title="link to this section">23.3.3.6</a></span> WeakMap.prototype.set ( key , value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>M</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>M)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>M</i> does not have a [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>M</i>’s [[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>entries</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>key</i>) is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>p</i>.[[key]] is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>key</i>) is <b>true</b>, then
<ol class="block">
<li>Set <i>p</i>.[[value]] to <i>value.</i></li>
<li>Return <i>M</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>p</i> be the Record {[[key]]: <i>key</i>, [[value]]: <i>value</i>}.</li>
<li>Append <i>p</i> as the last element of <i>entries</i>.</li>
<li>Return <i>M</i>.</li>
</ol>
</section>
<section id="sec-weakmap.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-23.3.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype-@@tostringtag" title="link to this section">23.3.3.7</a></span> WeakMap.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">WeakMap</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-weakmap-instances">
<h1><span class="secnum" id="sec-23.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-weakmap-instances" title="link to this section">23.3.4</a></span> Properties of WeakMap Instances</h1>
<p>WeakMap instances are ordinary objects that inherit properties from the WeakMap prototype. WeakMap instances also have a
[[WeakMapData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</section>
</section>
<section id="sec-weakset-objects">
<div class="front">
<h1><span class="secnum" id="sec-23.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-objects" title="link to this section">23.4</a></span> WeakSet
Objects</h1>
<p>WeakSet objects are collections of objects. A distinct object may only occur once as an element of a WeakSet’s
collection. A WeakSet may be queried to see if it contains a specific object, but no mechanisms is provided for enumerating
the objects it holds. If an object that is contain by a WeakSet is only reachable by following a chain of references that
start within that WeakSet, then that object is inaccessible and is automatically removed from the WeakSet. WeakSet
implementations must detect and remove such objects and any associated resources.</p>
<p>An implementation may impose an arbitrarily determined latency between the time an object contained in a WeakSet becomes
inaccessible and the time when the object is removed from the WeakSet. If this latency was observable to ECMAScript program,
it would be a source of indeterminacy that could impact program execution.&nbsp; For that reason, an ECMAScript
implementation must not provide any means to determine if a WeakSet contains a particular object that does not require the
observer to present the observed object.</p>
<p>WeakSet objects must be implemented using either hash tables or other mechanisms that, on average, provide access times
that are sublinear on the number of elements in the collection. The data structure used in this WeakSet objects
specification is only intended to describe the required observable semantics of WeakSet objects. It is not intended to be a
viable implementation model.</p>
<div class="note">
<p><span class="nh">NOTE</span> See the NOTE in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-objects">23.3</a>.</p>
</div>
</div>
<section id="sec-weakset-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-constructor" title="link to this section">23.4.1</a></span>
The WeakSet Constructor</h1>
<p>The WeakSet constructor is the %WeakSet% intrinsic object and the initial value of the <code>WeakSet</code> property of
the global object. When <code>WeakSet</code> is called as a function rather than as a constructor, it iinitializes its
<b>this</b> value with the internal state necessary to support the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype">WeakSet.prototype</a></code> built-in methods.</p>
<p>The <code>WeakSet</code> constructor is designed to be subclassable. It may be used as the value in an
<code>extends</code> clause of a class definition. Subclass constructors that intend to inherit the specified
<code>WeakSet</code> behaviour must include a <code>super</code> call to <code>WeakSet</code>.</p>
</div>
<section id="sec-weakset-iterable">
<h1><span class="secnum" id="sec-23.4.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-iterable" title="link to this section">23.4.1.1</a></span> WeakSet ( [ iterable ] )</h1>
<p>When the <code>WeakSet</code> function is called with optional argument <var>iterable</var> the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>set</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>set</i>) is not Object then, throw a
<b>TypeError</b> exception.</li>
<li>If <i>set</i> does not have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>set’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>iterable</i> is not present, let <i>iterable</i> be <b>undefined</b>.</li>
<li>If <i>iterable</i> is either <b>undefined</b> or <b>null</b>, then let <i>iter</i> be <b>undefined</b>.</li>
<li>Else,
<ol class="block">
<li>Let <i>iter</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>iterable</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>iter</i>).</li>
<li>Let <i>adder</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>set</i>, <code>"add"</code>)<b>.</b></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>adder</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>adder</i>) is <b>false</b>, throw a <b>TypeError</b>
Exception.</li>
</ol>
</li>
<li>If the value of <i>sets’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>set</i> has not been reentrantly initialized.</li>
<li>Set <i>set’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>If <i>iter</i> is <b>undefined</b>, then return <i>set</i>.</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iter</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>next</i>).</li>
<li>If <i>next</i> is <b>false</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>set</i>).</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextValue</i>).</li>
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of <i>adder</i> with <i>set</i> as
<i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> whose sole element is
<i>nextValue</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
</ol>
</section>
<section id="sec-new-weakset-argumentslist">
<h1><span class="secnum" id="sec-23.4.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-weakset-argumentslist" title="link to this section">23.4.1.2</a></span> new WeakSet ( ...argumentsList)</h1>
<p>When <code>WeakSet</code> is called as part of a <code>new</code> expression it is a constructor: it iinitializes a
newly created object.</p>
<p><code>WeakSet</code> called as part of a new expression with argument list <i>argumentsList</i> performs the following
steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>WeakSet</code> function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If WeakSet is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-weakset-constructor">
<div class="front">
<h1><span class="secnum" id="sec-23.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakset-constructor" title="link to this section">23.4.2</a></span> Properties of the WeakSet Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
WeakSet constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the WeakSet constructor has the following
properties:</p>
</div>
<section id="sec-weakset.prototype">
<h1><span class="secnum" id="sec-23.4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype" title="link to this section">23.4.2.1</a></span> WeakSet.prototype</h1>
<p>The initial value of <code>WeakSet.prototype</code> is the intrinsic %WeakSetPrototype% object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakset-prototype-object">23.4.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-weakset-@@create">
<h1><span class="secnum" id="sec-23.4.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset-@@create" title="link to this section">23.4.2.2</a></span> WeakSet [ @@create ] ( )</h1>
<p>The @@create method of a WeakSet function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%WeakSetPrototype%"</code>, ( [[WeakSetData]] )).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-weakset-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-23.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakset-prototype-object" title="link to this section">23.4.3</a></span> Properties of the WeakSet Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
WeakSet prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The WeakSet prototype object is an ordinary object. It
does not have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-weakset.prototype.add">
<h1><span class="secnum" id="sec-23.4.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.add" title="link to this section">23.4.3.1</a></span> WeakSet.prototype.add ( value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value)</i> is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries,</i> in original insertion order
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>e</i>, <i>value</i>) is <b>true</b>, then
<ol class="block">
<li>Return <i>S</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Append <i>value</i> as the last element of <i>entries</i>.</li>
<li>Return <i>S</i>.</li>
</ol>
</section>
<section id="sec-weakset.prototype.clear">
<h1><span class="secnum" id="sec-23.4.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.clear" title="link to this section">23.4.3.2</a></span> WeakSet.prototype.clear ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Set the value of <i>S</i>’s [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-weakset.prototype.constructor">
<h1><span class="secnum" id="sec-23.4.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.constructor" title="link to this section">23.4.3.3</a></span> WeakSet.prototype.constructor</h1>
<p>The initial value of <code>WeakSet.prototype.constructor</code> is the %WeakSet% intrinsic object.</p>
</section>
<section id="sec-weakset.prototype.delete">
<h1><span class="secnum" id="sec-23.4.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.delete" title="link to this section">23.4.3.4</a></span> WeakSet.prototype.delete ( value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value)</i> is not Object, then return
<b>false</b>.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Repeat for each <i>e</i> that is an element of <i>entries</i>, in original insertion order
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>e</i>, <i>value</i>) is <b>true</b>, then
<ol class="block">
<li>Replace the element of <i>entries</i> whose value is <i>e</i> with an element whose value is <span style="font-family: sans-serif">empty</span><i>.</i></li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The value <b>empty</b> is used as a specification device to indicate that an entry has
been deleted. Actual implementations may take other actions such as physically removing the entry from internal data
structures.</p>
</div>
</section>
<section id="sec-weakset.prototype.has">
<h1><span class="secnum" id="sec-23.4.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.has" title="link to this section">23.4.3.5</a></span> WeakSet.prototype.has ( value )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>S)</i> is not Object, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>S</i> does not have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If <i>S’s</i> [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
<b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of
<i>S</i>’s [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is not Object, then return
<b>false.</b></li>
<li>Repeat for each <i>e</i> that is an element of <i>entries,</i>
<ol class="block">
<li>If <i>e</i> is not <span style="font-family: sans-serif">empty</span> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>e</i>, <i>value</i>), then return <b>true</b><i>.</i></li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-weakset.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-23.4.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype-@@tostringtag" title="link to this section">23.4.3.6</a></span> WeakSet.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"Weak<span style="font-family:
monospace">Set</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-weakset-instances">
<h1><span class="secnum" id="sec-23.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-weakset-instances" title="link to this section">23.4.4</a></span> Properties of WeakSet Instances</h1>
<p>WeakSet instances are ordinary objects that inherit properties from the WeakSet prototype. After initialization by the
WeakSet constructor, WeakSet instances also have a [[WeakSetData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</section>
</section>
</section>
<section id="sec-structured-data">
<div class="front">
<h1><span class="secnum" id="sec-24"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-structured-data" title="link to this section">24</a></span> Structured
Data</h1>
</div>
<section id="sec-arraybuffer-objects">
<div class="front">
<h1><span class="secnum" id="sec-24.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-objects" title="link to this section">24.1</a></span>
ArrayBuffer Objects</h1>
</div>
<section id="sec-abstract-operations-for-arraybuffer-objects">
<div class="front">
<h1><span class="secnum" id="sec-24.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-arraybuffer-objects" title="link to this section">24.1.1</a></span> Abstract Operations For ArrayBuffer Objects</h1>
</div>
<section id="sec-allocatearraybuffer">
<h1><span class="secnum" id="sec-24.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatearraybuffer" title="link to this section">24.1.1.1</a></span> AllocateArrayBuffer( constructor )</h1>
<p>The abstract operation AllocateArrayBuffer with argument <var>constructor</var> is used to create an uninitialized
ArrayBuffer object. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>constructor</i>,
<code>"%ArrayBufferPrototype%"</code>, ( [[ArrayBufferData]], [[ArrayBufferByteLength]]) ).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Set the [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>obj</i> to 0.</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
<section id="sec-setarraybufferdata">
<h1><span class="secnum" id="sec-24.1.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setarraybufferdata" title="link to this section">24.1.1.2</a></span> SetArrayBufferData(arrayBuffer, bytes)</h1>
<p>The abstract operation SetArrayBufferData with arguments <span style="font-family: Times New Roman"><i>arrayBuffer</i>
and <i>bytes</i></span> is used to initialize the storage block encapsulated by an ArrayBuffer object. It performs the
following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(arrayBuffer).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>arrayBuffer</i>) is Object and it has an
[[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>bytes</i> is positive integer.</li>
<li>Let <i>block</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createbytedatablock">CreateByteDataBlock</a>(<i>bytes</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>block</i>).</li>
<li>Set <i>arrayBuffer’s</i> [[ArrayBufferData]] to <i>block</i>.</li>
<li>Set <i>arrayBuffer</i>’s [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>bytes</i>.</li>
<li>Return <i>arrayBuffer</i>.</li>
</ol>
</section>
<section id="sec-clonearraybuffer">
<h1><span class="secnum" id="sec-24.1.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-clonearraybuffer" title="link to this section">24.1.1.3</a></span> CloneArrayBuffer( srcBuffer, srcByteOffset )</h1>
<p>The abstract operation <span style="font-family: Times New Roman">CloneArrayBuffer</span> takes two parameters, an
ArrayBuffer <var>srcBuffer</var>, an integer <var>srcByteOffset</var>. It creates a new ArrayBufer whose data is a copy of
<var>srcBuffer’s</var> data starting at <var>srcByteOffset</var>.This operation performs the follow steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>srcBuffer</i>) is Object and it has an [[ArrayBufferData]]
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>srcBlock</i> be the value of <i>srcBuffer’s</i> [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>srcBlock</i> is <b>undefined</b> or <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>srcLength</i> be the value of <i>srcBuffer</i>’s [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>bufferConstructor</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>srcBuffer</i>,
<code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>bufferConstructor</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>srcByteOffset</i>≤<i>srcLength</i>.</li>
<li>Let <i>cloneLength</i> be <i>srcLength</i>–<i>srcByteOffset.</i></li>
<li>If <i>bufferConstructor</i> is <b>undefined</b>, then let <i>bufferConstructor</i> be %ArrayBuffer%.</li>
<li>Let <i>targetBuffer</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatearraybuffer">AllocateArrayBuffer</a>(<i>bufferConstructor</i>).</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setarraybufferdata">SetArrayBufferData</a>(<i>data</i>,
<i>cloneLength</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>targetBlock</i> be the value of <i>targetBuffer’s</i> [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Perform CopyDataBlock(<i>targetBlock</i>, 0, <i>srcBlock</i>, <i>srcByteOffset</i>, <i>cloneLength</i>).</li>
<li>Return <i>targetBlock</i>.</li>
</ol>
</section>
<section id="sec-getvaluefrombuffer">
<h1><span class="secnum" id="sec-24.1.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvaluefrombuffer" title="link to this section">24.1.1.4</a></span> GetValueFromBuffer ( arrayBuffer, byteIndex, type, isLittleEndian
)</h1>
<p>The abstract operation <span style="font-family: Times New Roman">GetValueFromBuffer</span> takes four parameters, an
ArrayBuffer <var>arrayBuffer</var>, an integer <var>byteIndex</var>, a String <var>type</var>, and optionally a Boolean
<var>isLittleEndian</var>. If <var>isLittleEndian</var> is not present, its default value is <span class="value">undefined</span>. This operation performs the follow steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: There are sufficient bytes in <i>arrayBuffer</i> starting at
<i>byteIndex</i> to represent a value of <i>valueType</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>byteIndex</i> is a positive integer.</li>
<li>Let <i>block</i> be <i>arrayBuffer’s</i> [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>block</i> is <b>undefined</b> or <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for <i>valueType</i>.</li>
<li>Let <i>rawValue</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of <i>elementSize containing, in
order,</i> the <i>elementSize</i> bytes starting at <i>byteIndex</i> of <i>block</i>.</li>
<li>If <i>isLittleEndian</i> is <b>undefined</b>, set <i>isLittleEndian</i> to either <b>true</b> or <b>false</b>. The
choice is implementation dependent and should be the alternative that is most efficient for the implementation. An
implementation must use the same value each time this step is executed and the same value must be used for the
corresponding step in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer">SetValueInBuffer</a> abstract operation.</li>
<li>If <i>isLittleEndian</i> is <b>false</b>, reverse the order of the elements of <i>rawValue</i>.</li>
<li>If <i>type</i> is “Float32” , then
<ol class="block">
<li>Let <i>value</i> be the byte elements of <i>rawValue</i> concatenated and interpreted as a little-endian bit
string encoding of an IEEE 754-208 binary32 value.</li>
<li>If <i>value</i> is an IEEE 754-208 binary32 NaN value, return the <b>NaN</b> Number value.</li>
<li>Return the Number value that corresponds to <i>value</i>.</li>
</ol>
</li>
<li>If <i>type</i> is “Float64” , then
<ol class="block">
<li>Let <i>value</i> be the byte elements of <i>rawValue</i> concatenated and interpreted as a little-endian bit
string encoding of an IEEE 754-208 binary64 value.</li>
<li>If <i>value</i> is an IEEE 754-208 binary64 NaN value, return the <b>NaN</b> Number value.</li>
<li>Return the Number value that is encoded by corresponds to <i>value</i>.</li>
</ol>
</li>
<li>If the first character of <i>type</i> is <code>"U"</code>, then
<ol class="block">
<li>Let <i>intValue</i> be the byte elements of <i>rawValue</i> concatenated and interpreted as a bit string
encoding of an unsigned little-endian binary number.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>intValue</i> be the byte elements of <i>rawValue</i> concatenated and interpreted as a bit string
encoding of a binary little-endian 2’s complement number of bit length <i>elementSize</i> × 8.</li>
</ol>
</li>
<li>Return the Number value that corresponds to <i>intValue</i>.</li>
</ol>
</section>
<section id="sec-setvalueinbuffer">
<h1><span class="secnum" id="sec-24.1.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer" title="link to this section">24.1.1.5</a></span> SetValueInBuffer ( arrayBuffer, byteIndex, type, value,
isLittleEndian )</h1>
<p>The abstract operation <span style="font-family: Times New Roman">SetValueInBuffer</span> takes five parameters, an
ArrayBuffer <var>arrayBuffer</var>, an integer <var>byteIndex</var>, a String <var>type</var>, a Number <i>value</i>, and
optionally a Boolean <var>isLittleEndian</var>. If <var>isLittleEndian</var> is not present, its default value is <span class="value">undefined</span>. This operation performs the follow steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: There are sufficient bytes in <i>arrayBuffer</i> starting at
<i>byteIndex</i> to represent a value of <i>valueType</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>byteIndex</i> is a positive integer.</li>
<li>Let <i>block</i> be <i>arrayBuffer’s</i> [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>block</i> is <b>undefined</b> or <b>null</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for the row containing the value of <i>type</i> as its Element Type entry.</li>
<li>If <i>isLittleEndian</i> is <b>undefined</b>, set <i>isLittleEndian</i> to either <b>true</b> or <b>false</b>. The
choice is implementation dependent and should be the alternative that is most efficient for the implementation. An
implementation must use the same value each time this step is executed and the same value must be used for the
corresponding step in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvaluefrombuffer">GetValueFromBuffer</a> abstract operation.</li>
<li>If <i>type</i> is “Float32” , then
<ol class="block">
<li>Set <i>rawValue</i> to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the 4 bytes that
are the result of converting <i>value</i> to IEEE-868-2005 binary32 format using “Round to nearest, ties
to even” rounding mode. If <i>isLittleEndian</i> is <b>false</b>, the bytes are arranged in big endian
order. Otherwise, the bytes are arranged in little endian order. If <i>value</i> is <b>NaN</b>, <i>rawValue</i>
may be set to any implementation choosen non-signaling NaN encoding.</li>
</ol>
</li>
<li>Else, if <i>type</i> is “Float64” , then
<ol class="block">
<li>Set <i>rawValue</i> to a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the 8 bytes that
are the IEEE-868-2005 binary64 format encoding of <i>value</i>. If <i>isLittleEndian</i> is <b>false</b>, the
bytes are arranged in big endian order. Otherwise, the bytes are arranged in little endian order. If
<i>value</i> is <b>NaN</b>, <i>rawValue</i> may be set to any implementation choosen non-signaling NaN
encoding.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>n</i> be the Size Element value in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for the row containing the value of
<i>type</i> as its Element Type entry.</li>
<li>Let <i>convOp</i> be the abstract operation named in the Conversion Operation column in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a> for the row containing the value of <i>type</i> as its Element Type entry.</li>
<li>Let <i>intValue</i> be the result of calling <i>convOp</i> with <i>value</i> as its argument .</li>
<li>If <i>intValue</i> ≥ 0, then
<ol class="block">
<li>Let <i>rawBytes</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the
<i>n</i>-byte binary encoding of <i>intValue</i>. If <i>isLittleEndian</i> is <b>false</b>, the bytes are
ordered in big endian order. Otherwise, the bytes are ordered in little endian order.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>rawBytes</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the
<i>n</i>-byte binary 2’s complement encoding of <i>intValue</i>. If <i>isLittleEndian</i> is
<b>false</b>, the bytes are ordered in big endian order. Otherwise, the bytes are ordered in little endian
order.</li>
</ol>
</li>
</ol>
</li>
<li>Store the individual bytes of <i>rawBytes</i> in order starting at position <i>byteIndex</i> of <i>block</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a> (<b>undefined</b>).</li>
</ol>
</section>
</section>
<section id="sec-arraybuffer-constructor">
<div class="front">
<h1><span class="secnum" id="sec-24.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-constructor" title="link to this section">24.1.2</a></span> The ArrayBuffer Constructor</h1>
<p>The ArrayBuffer constructor is the %ArrayBuffer% intrinsic object and the initial value of the <code>ArrayBuffer</code>
property of the global object. When <code>ArrayBuffer</code> is called as a function rather than as a constructor, its
<b>this</b> value must be an Object with an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined.</span> The ArrayBuffer constructor initializes the <b>this</b> value using the argument
values.</p>
<p>The <code>ArrayBuffer</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>ArrayBuffer</code> behaviour must include a <code>super</code> call to the <code>ArrayBuffer</code> constructor to
initialize subclass instances.</p>
</div>
<section id="sec-arraybuffer-length">
<h1><span class="secnum" id="sec-24.1.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-length" title="link to this section">24.1.2.1</a></span> ArrayBuffer( length )</h1>
<p>ArrayBuffer called as function with argument <var>length</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or if <i>O</i> does not have an
[[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or if the value of
<i>O’s</i> [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is
not <b>undefined</b>, then
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>numberLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>length</i>).</li>
<li>Let <i>byteLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>numberLength</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>byteLength</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero">SameValueZero</a>(<i>numberLength</i>, <i>byteLength</i>) is <b>false</b>, then
throw a <b>RangeError</b> exception.</li>
<li>If the value of <i>O’s</i> [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setarraybufferdata">SetArrayBufferData</a>(<i>O</i>, <i>byteLength</i>).</li>
</ol>
</section>
<section id="sec-new-arraybuffer-argumentslist">
<h1><span class="secnum" id="sec-24.1.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-arraybuffer-argumentslist" title="link to this section">24.1.2.2</a></span> new ArrayBuffer( ...argumentsList )</h1>
<p>ArrayBuffer called as part of a new expression performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the ArrayBuffer function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If ArrayBuffer is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-arraybuffer-constructor">
<div class="front">
<h1><span class="secnum" id="sec-24.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-constructor" title="link to this section">24.1.3</a></span> Properties of the ArrayBuffer Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
ArrayBuffer constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides its <code>length</code> property (whose value is 1), the ArrayBuffer constructor has the following
properties:</p>
</div>
<section id="sec-arraybuffer.isview">
<h1><span class="secnum" id="sec-24.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer.isview" title="link to this section">24.1.3.1</a></span> ArrayBuffer.isView ( arg )</h1>
<p>The isView function takes one argument <var>arg</var>, and performs the following steps are taken:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>arg</i>) is not Object, return <b>false</b>.</li>
<li>If <i>arg</i> has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then return <b>true</b>.</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-arraybuffer.prototype">
<h1><span class="secnum" id="sec-24.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer.prototype" title="link to this section">24.1.3.2</a></span> ArrayBuffer.prototype</h1>
<p>The initial value of ArrayBuffer.prototype is the ArrayBuffer prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-prototype-object">24.1.4</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-arraybuffer-@@create">
<h1><span class="secnum" id="sec-24.1.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-@@create" title="link to this section">24.1.3.3</a></span> ArrayBuffer[ @@create ] ( )</h1>
<p>The @@create method of an ArrayBuffer function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatearraybuffer">AllocateArrayBuffer</a>(<i>F</i>).</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-the-arraybuffer-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-24.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-prototype-object" title="link to this section">24.1.4</a></span> Properties of the ArrayBuffer Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
ArrayBuffer prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The ArrayBuffer prototype object is an ordinary object.
It does not have an [[ArrayBufferData]] or [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-get-arraybuffer.prototype.bytelength">
<h1><span class="secnum" id="sec-24.1.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-arraybuffer.prototype.bytelength" title="link to this section">24.1.4.1</a></span> get ArrayBuffer.prototype.byteLength</h1>
<p><code>ArrayBuffer.prototype.byteLength</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>O</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b> or <b>null</b>, then
throw a <b>TypeError</b> exception.</li>
<li>Let <i>length</i> be the value of <i>O</i>’s [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>length</i>.</li>
</ol>
</section>
<section id="sec-arraybuffer.prototype.constructor">
<h1><span class="secnum" id="sec-24.1.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer.prototype.constructor" title="link to this section">24.1.4.2</a></span> ArrayBuffer.prototype.constructor</h1>
<p>The initial value of ArrayBuffer.prototype.constructor is the standard built-in ArrayBuffer constructor.</p>
</section>
<section id="sec-arraybuffer.prototype.slice">
<h1><span class="secnum" id="sec-24.1.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer.prototype.slice" title="link to this section">24.1.4.3</a></span> ArrayBuffer.prototype.slice ( start , end )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>O</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b> or <b>null</b>, then
throw a <b>TypeError</b> exception.</li>
<li>Let <i>len</i> be the value of <i>O</i>’s [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>relativeStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeStart</i>).</li>
<li>If <i>relativeStart</i> is negative, let <i>first</i> be max((<i>len</i> + <i>relativeStart</i>),0); else let
<i>first</i> be min(<i>relativeStart</i>, <i>len</i>).</li>
<li>If <i>end</i> is <b>undefined</b>, let <i>relativeEnd</i> be <i>len</i>; else let <i>relativeEnd</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>end</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>relativeEnd</i>).</li>
<li>If <i>relativeEnd</i> is negative, let <i>final</i> be max((<i>len</i> + <i>relativeEnd</i>),0); else let
<i>final</i> be min(<i>relativeEnd</i>, <i>len</i>).</li>
<li>Let <i>newLen</i> be max(<i>final</i>-<i>first</i>,0).</li>
<li>Let <i>ctor</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>O</i>, <b>"<span style="font-family:
monospace">constructor</span>"</b>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>ctor</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>ctor</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>new</i> be the result of calling the [[Construct]] internal method of <i>ctor</i> with a new <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing the single element <i>newLen</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>new</i>).</li>
<li>If <i>new</i> does not have an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>new</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If the value of <i>new</i>’s [[ArrayBufferByteLength]] &lt; <i>newLen</i>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>fromBuf</i> be the value of <i>O</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>toBuf</i> be the value of <i>new</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-copydatablockbytes">CopyDataBlockBytes</a>(<i>toBuf</i>, 0, <i>fromBuf</i>, <i>first</i>,
<i>newLen</i>).</li>
<li>Return <i>new</i>.</li>
</ol>
</section>
<section id="sec-arraybuffer.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-24.1.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer.prototype-@@tostringtag" title="link to this section">24.1.4.4</a></span> ArrayBuffer.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">ArrayBuffer</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-the-arraybuffer-instances">
<h1><span class="secnum" id="sec-24.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-arraybuffer-instances" title="link to this section">24.1.5</a></span> Properties of the ArrayBuffer Instances</h1>
<p>ArrayBuffer instances inherit properties from the ArrayBuffer prototype object. ArrayBuffer instances each have an
[[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and an
[[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>ArrayBuffer instances whose [[ArrayBufferData]] is <b>null</b> are considered to be <i>neutered</i> and all operators to
access or modify data contained in the ArrayBuffer instance will fail.</p>
</section>
</section>
<section id="sec-dataview-objects">
<div class="front">
<h1><span class="secnum" id="sec-24.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-objects" title="link to this section">24.2</a></span> DataView
Objects</h1>
</div>
<section id="sec-abstract-operations-for-dataview-objects">
<div class="front">
<h1><span class="secnum" id="sec-24.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations-for-dataview-objects" title="link to this section">24.2.1</a></span> Abstract Operations For DataView Objects</h1>
</div>
<section id="sec-getviewvalue">
<h1><span class="secnum" id="sec-24.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue" title="link to this section">24.2.1.1</a></span>
GetViewValue ( view, requestIndex, isLittleEndian, type )</h1>
<p>The abstract operation GetViewValue with arguments <var>view</var>, <var>requestIndex</var>, <var>isLittleEndian</var>,
and <var>type</var> is used by functions on DataView instances is to retrieve values from the view’s buffer. It
performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>view</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>view</i> does not have a [[DataView]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>view’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let numberIndex be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(requestIndex)</li>
<li>Let <i>getIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>numberIndex</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>getIndex</i>).</li>
<li>If <i>numberIndex</i> ≠ <i>getIndex</i> or <i>getIndex</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>Let isLittleEndian be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(isLittleEndian).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>isLittleEndian</i>).</li>
<li>Let <i>viewOffset</i> be the value of <i>view’s</i> [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>viewSize</i> be the value of <i>view’s</i> [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for <i>type</i>.</li>
<li>If <i>getIndex</i> +<i>elementSize</i> &gt; <i>viewSize</i>, then throw a <b>RangeError</b> exception.</li>
<li>Let bufferIndex be getIndex+viewOffset.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvaluefrombuffer">GetValueFromBuffer</a>(<i>buffer</i>, <i>bufferIndex</i>,
<i>type</i>, <i>isLittleEndian</i>).</li>
</ol>
</section>
<section id="sec-setviewvalue">
<h1><span class="secnum" id="sec-24.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue" title="link to this section">24.2.1.2</a></span>
SetViewValue ( view, requestIndex, isLittleEndian, type, value )</h1>
<p>The abstract operation SetViewValue with arguments <var>view</var>, <var>requestIndex</var>, <var>isLittleEndian</var>,
<var>type</var>, and <var>value</var> is used by functions on DataView instances to store values into the view’s
buffer. It performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>view</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>view</i> does not have a [[DataView]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>view’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let numberIndex be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(requestIndex)</li>
<li>Let <i>getIndex</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>numberIndex</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>getIndex</i>).</li>
<li>If <i>numberIndex</i> ≠ <i>getIndex</i> or <i>getIndex</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>Let isLittleEndian be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean">ToBoolean</a>(isLittleEndian).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>isLittleEndian</i>).</li>
<li>Let <i>viewOffset</i> be the value of <i>view’s</i> [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>viewSize</i> be the value of <i>view’s</i> [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>elementSize</i> be the Number value of the Element Size value specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-44">Table 44</a>
for <i>type</i>.</li>
<li>If <i>getIndex</i> +<i>elementSize</i> &gt; <i>viewSize</i>, then throw a <b>RangeError</b> exception.</li>
<li>Let bufferIndex be getIndex+viewOffset.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setvalueinbuffer">SetValueInBuffer</a>(<i>buffer</i>, <i>bufferIndex</i>,
<i>type</i>, <i>value</i>, <i>isLittleEndian</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The algorithms for <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a> and SetViewValue are
identical except for their final steps.</p>
</div>
</section>
</section>
<section id="sec-dataview-constructor">
<div class="front">
<h1><span class="secnum" id="sec-24.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-constructor" title="link to this section">24.2.2</a></span> The DataView Constructor</h1>
<p>The DataView constructor is the %DataView% intrinsic object and the initial value of the <code>DataView</code> property
of the global object. When <code>DataView</code> is called as a function rather than as a constructor, it initializes its
<b>this</b> value with the internal state necessary to support the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype">DataView.prototype</a></code> internal methods.</p>
<p>The <code>DataView</code> constructor is designed to be subclassable. It may be used as the value of an
<code>extends</code> clause of a class declaration. Subclass constructors that intended to inherit the specified
<code>DataView</code> behaviour must include a <code>super</code> call to the <code>DataView</code> constructor to
initialize subclass instances.</p>
</div>
<section id="sec-dataview-buffer-byteoffset-bytelength">
<h1><span class="secnum" id="sec-24.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-buffer-byteoffset-bytelength" title="link to this section">24.2.2.1</a></span> DataView (buffer [ , byteOffset [ , byteLength ] ] )</h1>
<p><code>DataView</code> called with arguments <span style="font-family: Times New Roman"><i>buffer</i>,
<i>byteOffset</i>, and <i>length</i></span> performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or if <i>O</i> does not have a
[[DataView]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b>
exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>O</i> has a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>buffer</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>buffer</i> does not have an [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a <b>TypeError</b>
exception.</li>
<li>If the value of <i>buffer</i>’s [[ArrayBufferData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>numberOffset</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>byteOffset</i>).</li>
<li>Let <i>offset</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>numberOffset</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>offset</i>).</li>
<li>If <i>numberOffset</i> ≠ <i>offset</i> or <i>offset</i> &lt; 0, then throw a <b>RangeError</b> exception.</li>
<li>Let <i>bufferByteLength</i> be the value of <i>buffer’s</i> [[ArrayBufferByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>offset</i> &gt; <i>bufferByteLength</i>, then throw a <b>RangeError</b> exception.</li>
<li>If <i>byteLength</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>viewByteLength</i> be <i>bufferByteLength</i> – <i>offset</i>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>numberLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>byteLength</i>).</li>
<li>Let <i>viewLength</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a> (<i>numberLength).</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>viewLength</i>).</li>
<li>If <i>numberLength</i> ≠ <i>viewLength</i> or <i>viewLength</i> &lt; 0, then throw a <b>RangeError</b>
exception.</li>
<li>Let <i>viewByteLength</i> be <i>viewLength</i>.</li>
<li>If <i>offset</i>+<i>viewByteLength</i> &gt; <i>bufferByteLength</i>, then throw a <b>RangeError</b>
exception.</li>
</ol>
</li>
<li>If the value of <i>O’s</i> [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, then throw a
<b>TypeError</b> exception,</li>
<li>Set <i>O’s</i> [[ViewedArrayBuffer]] to <i>buffer</i>.</li>
<li>Set <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>viewByteLength</i>.</li>
<li>Set <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>offset</i>.</li>
<li>Return <i>O</i>.</li>
</ol>
</section>
<section id="sec-new-dataview-argumentslist">
<h1><span class="secnum" id="sec-24.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-dataview-argumentslist" title="link to this section">24.2.2.2</a></span> new DataView ( ...argumentsList )</h1>
<p>When <code>DataView</code> is called as part of a new expression it performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>DataView</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function
object</a>, its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-dataview-constructor">
<div class="front">
<h1><span class="secnum" id="sec-24.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-dataview-constructor" title="link to this section">24.2.3</a></span> Properties of the DataView Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
<code>DataView</code> constructor is the <code>Function</code> prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the length <code>property</code> (whose value is 3), the DataView constructor has the following properties:</p>
</div>
<section id="sec-dataview.prototype">
<h1><span class="secnum" id="sec-24.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype" title="link to this section">24.2.3.1</a></span> DataView.prototype</h1>
<p>The initial value of <code>DataView.prototype</code> is the DataView prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-dataview-prototype-object">24.2.4</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-dataview-@@create">
<h1><span class="secnum" id="sec-24.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-@@create" title="link to this section">24.2.3.2</a></span> DataView [ @@create ] ( )</h1>
<p>The @@create method of a DataView function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%DataViewPrototype%"</code>, ( [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]]) ).</li>
<li>Set the value of <i>obj’s</i> [[DataView]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <b>true</b>.</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The value of the [[DataView]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not used within this specification. The
simple presense of that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is used within the
specification to identify objects created using this @@create method.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-dataview-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-24.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-dataview-prototype-object" title="link to this section">24.2.4</a></span> Properties of the DataView Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
DataView prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The DataView prototype object is an ordinary object. It
does not have a [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], or [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-get-dataview.prototype.buffer">
<h1><span class="secnum" id="sec-24.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-dataview.prototype.buffer" title="link to this section">24.2.4.1</a></span> get DataView.prototype.buffer</h1>
<p><code>DataView.prototype.buffer</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>buffer</i>.</li>
</ol>
</section>
<section id="sec-get-dataview.prototype.bytelength">
<h1><span class="secnum" id="sec-24.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-dataview.prototype.bytelength" title="link to this section">24.2.4.2</a></span> get DataView.prototype.byteLength</h1>
<p><code>DataView</code>.<code>prototype.byteLength</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>size</i> be the value of <i>O</i>’s [[ByteLength]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>size</i>.</li>
</ol>
</section>
<section id="sec-get-dataview.prototype.byteoffset">
<h1><span class="secnum" id="sec-24.2.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-dataview.prototype.byteoffset" title="link to this section">24.2.4.3</a></span> get DataView.prototype.byteOffset</h1>
<p><code>DataView</code>.<code>prototype.byteOffset</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have a [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> throw a <b>TypeError</b> exception.</li>
<li>Let <i>buffer</i> be the value of <i>O</i>’s [[ViewedArrayBuffer]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>buffer</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>offset</i> be the value of <i>O</i>’s [[ByteOffset]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return <i>offset</i>.</li>
</ol>
</section>
<section id="sec-dataview.prototype.constructor">
<h1><span class="secnum" id="sec-24.2.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.constructor" title="link to this section">24.2.4.4</a></span> DataView.prototype.constructor</h1>
<p>The initial value of <code>DataView.prototype.constructor</code> is the standard built-in DataView constructor.</p>
</section>
<section id="sec-dataview.prototype.getfloat32">
<h1><span class="secnum" id="sec-24.2.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getfloat32" title="link to this section">24.2.4.5</a></span> DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] )</h1>
<p>When the <code>getFloat32</code> method is called with argument <var>byteOffset</var> and optional argument
<i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Float32"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getfloat64">
<h1><span class="secnum" id="sec-24.2.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getfloat64" title="link to this section">24.2.4.6</a></span> DataView.prototype.getFloat64 ( byteOffset [ , littleEndian ] )</h1>
<p>When the <code>getFloat64</code> method is called with argument <var>byteOffset</var> and optional argument
<i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Float64"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getint8">
<h1><span class="secnum" id="sec-24.2.4.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getint8" title="link to this section">24.2.4.7</a></span> DataView.prototype.getInt8 ( byteOffset )</h1>
<p>When the <code>getInt8</code> method is called with argument <var>byteOffset</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <b>undefined</b>,
<code>"Int8"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getint16">
<h1><span class="secnum" id="sec-24.2.4.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getint16" title="link to this section">24.2.4.8</a></span> DataView.prototype.getInt16 ( byteOffset [ , littleEndian ] )</h1>
<p>When the <code>getInt16</code> method is called with argument <var>byteOffset</var> and optional argument
<i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Int16"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getint32">
<h1><span class="secnum" id="sec-24.2.4.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getint32" title="link to this section">24.2.4.9</a></span> DataView.prototype.getInt32 ( byteOffset [ , littleEndian ] )</h1>
<p>When the <code>getInt32</code> method is called with argument <var>byteOffset</var> and optional argument
<i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>undefined</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Int32"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getuint8">
<h1><span class="secnum" id="sec-24.2.4.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getuint8" title="link to this section">24.2.4.10</a></span> DataView.prototype.getUint8 ( byteOffset )</h1>
<p>When the <code>getUint8</code> method is called with argument <var>byteOffset</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <b>undefined</b>,
<code>"Uint8"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getuint16">
<h1><span class="secnum" id="sec-24.2.4.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getuint16" title="link to this section">24.2.4.11</a></span> DataView.prototype.getUint16 ( byteOffset [ , littleEndian ] )</h1>
<p>When the <code>getUint16</code> method is called with argument <var>byteOffset</var> and optional argument
<i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Uint16"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.getuint32">
<h1><span class="secnum" id="sec-24.2.4.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.getuint32" title="link to this section">24.2.4.12</a></span> DataView.prototype.getUint32 ( byteOffset [ , littleEndian ] )</h1>
<p>When the <code>getUint32</code> method is called with argument <var>byteOffset</var> and optional argument
<i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getviewvalue">GetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Uint32"</code>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setfloat32">
<h1><span class="secnum" id="sec-24.2.4.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setfloat32" title="link to this section">24.2.4.13</a></span> DataView.prototype.setFloat32 ( byteOffset, value [ , littleEndian ]
)</h1>
<p>When the <code>setFloat32</code> method is called with arguments <var>byteOffset</var> and <var>value</var> and
optional argument <i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Float32"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setfloat64">
<h1><span class="secnum" id="sec-24.2.4.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setfloat64" title="link to this section">24.2.4.14</a></span> DataView.prototype.setFloat64 ( byteOffset, value [ , littleEndian ]
)</h1>
<p>When the <code>setFloat64</code> method is called with arguments <var>byteOffset</var> and <var>value</var> and
optional argument <i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Float64"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setint8">
<h1><span class="secnum" id="sec-24.2.4.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setint8" title="link to this section">24.2.4.15</a></span> DataView.prototype.setInt8 ( byteOffset, value )</h1>
<p>When the <code>setInt8</code> method is called with arguments <var>byteOffset</var> and <var>value</var> the following
steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <b>undefined</b>,
<code>"Int8"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setint16">
<h1><span class="secnum" id="sec-24.2.4.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setint16" title="link to this section">24.2.4.16</a></span> DataView.prototype.setInt16 ( byteOffset, value [ , littleEndian ]
)</h1>
<p>When the <code>setInt16</code> method is called with arguments <var>byteOffset</var> and <var>value</var> and optional
argument <i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Int16"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setint32">
<h1><span class="secnum" id="sec-24.2.4.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setint32" title="link to this section">24.2.4.17</a></span> DataView.prototype.setInt32 ( byteOffset, value [ , littleEndian ]
)</h1>
<p>When the <code>setInt32</code> method is called with arguments <var>byteOffset</var> and <var>value</var> and optional
argument <i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Int32"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setuint8">
<h1><span class="secnum" id="sec-24.2.4.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setuint8" title="link to this section">24.2.4.18</a></span> DataView.prototype.setUint8 ( byteOffset, value )</h1>
<p>When the <code>setUint8</code> method is called with arguments <var>byteOffset</var> and <var>value</var> the following
steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <b>undefined</b>,
<code>"Uint8"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setuint16">
<h1><span class="secnum" id="sec-24.2.4.19"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setuint16" title="link to this section">24.2.4.19</a></span> DataView.prototype.setUint16 ( byteOffset, value [ , littleEndian ]
)</h1>
<p>When the <code>setUint16</code> method is called with arguments <var>byteOffset</var> and <var>value</var> and optional
argument <i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Uint16"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype.setuint32">
<h1><span class="secnum" id="sec-24.2.4.20"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype.setuint32" title="link to this section">24.2.4.20</a></span> DataView.prototype.setUint32 ( byteOffset, value [ , littleEndian ]
)</h1>
<p>When the <code>setUint32</code> method is called with arguments <var>byteOffset</var> and <var>value</var> and optional
argument <i>littleEndian</i> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>v</i> be the <b>this</b> value.</li>
<li>If <i>littleEndian</i> is not present, then let <i>littleEndian</i> be <b>false</b>.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setviewvalue">SetViewValue</a>(<i>v</i>, <i>byteOffset</i>, <i>littleEndian</i>,
<code>"Uint32"</code>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-dataview.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-24.2.4.21"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview.prototype-@@tostringtag" title="link to this section">24.2.4.21</a></span> DataView.prototype[ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">DataView</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-dataview-instances">
<h1><span class="secnum" id="sec-24.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-dataview-instances" title="link to this section">24.2.5</a></span> Properties of DataView Instances</h1>
<p>DataView instances are ordinary objects that inherit properties from the DataView prototype object. DataView instances
each have a [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], and [[ByteOffset]] internal slots.</p>
</section>
</section>
<section id="sec-json-object">
<div class="front">
<h1><span class="secnum" id="sec-24.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json-object" title="link to this section">24.3</a></span> The JSON
Object</h1>
<p>The <b>JSON</b> object is a single ordinary object that contains two functions, <b>parse</b> and <b>stringify</b>, that
are used to parse and construct JSON texts. The JSON Data Interchange Format is defined in ECMA-404. The JSON interchange
format used in this specification is exactly that described by ECMA-404.</p>
<p>Conforming implementations of <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.parse">JSON.parse</a></b> and <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.stringify">JSON.stringify</a></b> must support the exact interchange format described in this specification
without any deletions or extensions to the format.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the JSON
object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the JSON object is set to <b>true</b>.</p>
<p>The JSON object does not have a [[Construct]] internal method; it is not possible to use the JSON object as a constructor
with the <code>new</code> operator.</p>
<p>The JSON object does not have a [[Call]] internal method; it is not possible to invoke the JSON object as a function.</p>
</div>
<section id="sec-json.parse">
<div class="front">
<h1><span class="secnum" id="sec-24.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.parse" title="link to this section">24.3.1</a></span>
JSON.parse ( text [ , reviver ] )</h1>
<p>The <code>parse</code> function parses a JSON text (a JSON-formatted String) and produces an ECMAScript value. The JSON
format is a subset of the syntax for ECMAScript literals, Array Initializers and Object Initializers. After parsing, JSON
objects are realized as ECMAScript objects. JSON arrays are realized as ECMAScript Array instances. JSON strings, numbers,
booleans, and null are realized as ECMAScript Strings, Numbers, Booleans, and <b>null</b>.</p>
<p>The optional <i>reviver</i> parameter is a function that takes two parameters, (<i>key</i> and <i>value</i>). It can
filter and transform the results. It is called with each of the <i>key</i>/<i>value</i> pairs produced by the parse, and
its return value is used instead of the original value. If it returns what it received, the structure is not modified. If
it returns <b>undefined</b> then the property is deleted from the result.</p>
<ol class="proc">
<li>Let <i>JText</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>text</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>JText</i>).</li>
<li>Parse <i>JText</i> interpreted as UTF-16 encoded Unicode points as a JSON text as specified in <br>ECMA-404. Throw a
<b>SyntaxError</b> exception if <i>JText</i> is not a valid JSON text as defined in that specification.</li>
<li>Let <i>scriptText</i> be the result of concatenating <code>"("</code>, <i>JText</i>, and <code>");"</code>.</li>
<li>Let <i>completion</i> be the result of parsing and evaluating <i>scriptText</i> as if it was the source text of an
ECMAScript <i>Script</i>. but using the alternative definition of <i>DoubleStringCharacter</i> provided below. The
extended PropertyDefinitionEvaluation semantics defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-__proto___-property-names-in-object-initializers">B.3.1</a> must not be used during the evaluation.</li>
<li>Let <i>unfiltered</i> be <i>completion</i>.[[value]].</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>unfiltered</i> will be either a primitive value or an object
that is defined by either an <i>ArrayLiteral</i> or an <i>ObjectLiteral</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>reviver</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>root</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a> with the
intrinsic object <span style="font-family: sans-serif">%ObjectPrototype%</span> as its argument.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>root</i>, the
empty String, <i>unfiltered</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is <b>true</b>.</li>
<li>Return the result of calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-walk">Walk</a>, passing <i>root</i> and the
empty String. The abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-walk">Walk</a> is described below.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Return <i>unfiltered</i>.</li>
</ol>
</li>
</ol>
<p>JSON allows Unicode code points U+2028 and U+2029 to directly appear in <span class="nt">String</span> literals without
using an escape sequence. This is enabled by using the following alternative definition of <span class="nt">DoubleStringCharacter</span> when parsing <var>scriptText</var> in step 5:</p>
<div class="gp">
<div class="lhs"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">"</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="gprose">U+0000 through U+001F</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">EscapeSequence</span></div>
</div>
<ul>
<li>
<p>The CV of <span class="prod"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">"</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span></span> U+0000 <b>through</b> U+001F
is the UTF-16 Encoding (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">10.1.1</a>) of the code point value of
<i>SourceCharacter</i>.</p>
</li>
</ul>
<div class="note">
<p><span class="nh">NOTE</span> The syntax of a valid JSON text is a subset of the ECMAScript <i>PrimaryExpression</i>
syntax. Hence a valid JSON text is also a valid <i>PrimaryExpression</i>. Step 3 above verifies that <i>JText</i>
conforms to that subset. When <i>scriptText</i> is parsed and evaluated as a <i>Script</i> the result will be either a
String, Number, Boolean, or Null primitive value or an Object defined as if by an <i>ArrayLiteral</i> or
<i>ObjectLiteral</i>.</p>
</div>
</div>
<section id="sec-walk">
<h1><span class="secnum" id="sec-24.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-walk" title="link to this section">24.3.1.1</a></span> Runtime
Semantics: Walk Abstract Operation</h1>
<p>The abstract operation Walk is a recursive abstract operation that takes two parameters: a <var>holder</var> object and
the String <var>name</var> of a property in that object. Walk uses the value of <var>reviver</var> that was originally
passed to the above parse function.</p>
<ol class="proc">
<li>Let <i>val</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>holder</i>, <i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>val</i>).</li>
<li>If <i>val</i> is an object, then
<ol class="block">
<li>If <i>val</i> is an exotic Array object then
<ol class="block">
<li>Set <i>I</i> to 0.</li>
<li>Let <i>len</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>val</i>, <code>"length"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>len</i> is not an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a> and its value is a positive
integer.</li>
<li>Repeat while <i>I</i> &lt; <i>len</i>,
<ol class="block">
<li>Let <i>newElement</i> be the result of calling the abstract operation Walk, passing <i>val</i> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>I</i>).</li>
<li>If <i>newElement</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[Delete]] internal method of <i>val</i> with <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>I</i>) as the argument.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[DefineOwnProperty]] internal method of <i>val</i>
with arguments <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>I</i>) and PropertyDescriptor{[[Value]]:
<i>newElement</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]:
<b>true</b>}.</li>
<li>NOTE This algorithm intentionally does not throw an exception if status is <b>false</b>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Add 1 to <i>I</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>keys</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of String values consisting
of the names of all the own properties of <i>val</i> whose [[Enumerable]] attribute is <b>true</b>. The
ordering of the Strings is the same as that used by the <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys">Object.keys</a></b>
standard built-in function.</li>
<li>For each String <i>P</i> in <i>keys</i> do,
<ol class="block">
<li>Let <i>newElement</i> be the result of calling the abstract operation Walk, passing <i>val</i> and
<i>P</i>.</li>
<li>If <i>newElement</i> is <b>undefined</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[Delete]] internal method of <i>val</i> with
<i>P</i> as the argument.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[DefineOwnProperty]] internal method of <i>val</i>
with arguments <i>P</i> and PropertyDescriptor{[[Value]]: <i>newElement</i>, [[Writable]]:
<b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</li>
<li>NOTE This algorithm intentionally does not throw an exception if status is <b>false</b>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return the result of calling the [[Call]] internal method of <i>reviver</i> passing <i>holder</i> as
<i>thisArgument</i> and with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing <i>name</i> and
<i>val</i> as <i>argumentsList</i>.</li>
</ol>
<p>It is not permitted for a conforming implementation of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.parse">JSON.parse</a></code> to extend
the JSON grammars. If an implementation wishes to support a modified or extended JSON interchange format it must do so by
defining a different parse function.</p>
<div class="note">
<p><span class="nh">NOTE</span> In the case where there are duplicate name Strings within an object, lexically preceding
values for the same key shall be overwritten.</p>
</div>
</section>
</section>
<section id="sec-json.stringify">
<div class="front">
<h1><span class="secnum" id="sec-24.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json.stringify" title="link to this section">24.3.2</a></span>
JSON.stringify ( value [ , replacer [ , space ] ] )</h1>
<p>The <code>stringify</code> function returns a String in UTF-16 encoded JSON format representing an ECMAScript value. It
can take three parameters. The <var>value</var> parameter is an ECMAScript value, which is usually an object or array,
although it can also be a String, Boolean, Number or <b>null</b>. The optional <var>replacer</var> parameter is either a
function that alters the way objects and arrays are stringified, or an array of Strings and Numbers that acts as a white
list for selecting the object properties that will be stringified. The optional <var>space</var> parameter is a String or
Number that allows the result to have white space injected into it to improve human readability.</p>
<p>These are the steps in stringifying an object:</p>
<ol class="proc">
<li>Let <i>stack</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>indent</i> be the empty String.</li>
<li>Let <i>PropertyList</i> and <i>ReplacerFunction</i> be <b>undefined</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>replacer</i>) is Object, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>replacer</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>ReplacerFunction</i> be <i>replacer</i>.</li>
</ol>
</li>
<li>Else if <i>replacer</i> is an exotic Array object, then
<ol class="block">
<li>Let <i>PropertyList</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a></li>
<li>For each value <i>v</i> of a property of <i>replacer</i> that has an array index property name. The
properties are enumerated in the ascending array index order of their names.
<ol class="block">
<li>Let <i>item</i> be <b>undefined</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is String then let <i>item</i> be
<i>v.</i></li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is Number then let
<i>item</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>v</i>).</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>v</i>) is Object then,
<ol class="block">
<li>If <i>v</i> has a [[StringData]] or [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then let <i>item</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>v</i>).</li>
</ol>
</li>
<li>If <i>item</i> is not <b>undefined</b> and <i>item</i> is not currently an element of
<i>PropertyList</i> then,
<ol class="block">
<li>Append <i>item</i> to the end of <i>PropertyList</i>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>space</i>) is Object then,
<ol class="block">
<li>If <i>space</i> has a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
then,
<ol class="block">
<li>Let <i>space</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>space</i>).</li>
</ol>
</li>
<li>Else if <i>space</i> has a [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> then,
<ol class="block">
<li>Let <i>space</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>space</i>).</li>
</ol>
</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>space</i>) is Number
<ol class="block">
<li>Let <i>space</i> be min(10, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>space</i>)).</li>
<li>Set <i>gap</i> to a String containing <i>space</i> occurrences of code unit 0x0020 (the Unicode space
character). This will be the empty String if <i>space</i> is less than 1.</li>
</ol>
</li>
<li>Else if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>space)</i> is String
<ol class="block">
<li>If the number of elements in <i>space</i> is 10 or less, set <i>gap</i> to <i>space</i> otherwise set <i>gap</i>
to a String consisting of the first 10 elements of <i>space</i>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Set <i>gap</i> to the empty String.</li>
</ol>
</li>
<li>Let <i>wrapper</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a> with the
intrinsic object <span style="font-family: sans-serif">%ObjectPrototype%</span> as its argument.</li>
<li>Let <i>status</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>wrapper</i>, the
empty String, <i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is <b>true</b>.</li>
<li>Return the result of calling the abstract operation Str(the empty String, <i>wrapper</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 1</span> JSON structures are allowed to be nested to any depth, but they must be acyclic. If
<i>value</i> is or contains a cyclic structure, then the stringify function must throw a <b>TypeError</b> exception.
This is an example of a value that cannot be stringified:</p>
<pre>a = [];</pre>
<pre>a[0] = a;</pre>
<pre>my_text = JSON.stringify(a); // This must throw a TypeError.</pre>
</div>
<div class="note">
<p><span class="nh">NOTE 2</span> Symbolic primitive values are rendered as follows:</p>
</div>
<ol class="proc">
<li>The <b>null</b> value is rendered in JSON text as the String <code>null</code>.</li>
<li>The <b>undefined</b> value is not rendered.</li>
<li>The <b>true</b> value is rendered in JSON text as the String <code>true</code>.</li>
<li>The <b>false</b> value is rendered in JSON text as the String <code>false</code>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE 3</span> String values are wrapped in double quotes. The characters <code>"</code> and
<code>\</code> are escaped with <code>\</code> prefixes. Control characters are replaced with escape sequences
<code>\u</code>HHHH, or with the shorter forms, <code>\b</code> (backspace), <code>\f</code> (formfeed), <code>\n</code>
(newline), <code>\r</code> (carriage return), <code>\t</code> (tab).</p>
</div>
<div class="note">
<p><span class="nh">NOTE 4</span> Finite numbers are stringified as if by calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a><b>(</b><i>number</i><b>)</b>. <b>NaN</b> and Infinity regardless of sign are
represented as the String <code>null</code>.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 5</span> Values that do not have a JSON representation (such as <b>undefined</b> and functions)
do not produce a String. Instead they produce the <b>undefined</b> value. In arrays these values are represented as the
String <code>null</code>. In objects an unrepresentable value causes the property to be excluded from
stringification.</p>
</div>
<div class="note">
<p><span class="nh">NOTE 6</span> An object is rendered as an opening left brace followed by zero or more properties,
separated with commas, closed with a right brace. A property is a quoted String representing the key or property name, a
colon, and then the stringified property value. An array is rendered as an opening left bracket followed by zero or more
values, separated with commas, closed with a right bracket.</p>
</div>
</div>
<section id="sec-runtime-semantics-str-abstract-operation">
<h1><span class="secnum" id="sec-24.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-str-abstract-operation" title="link to this section">24.3.2.1</a></span> Runtime Semantics: Str Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">Str(<i>key</i>, <i>holder</i>)</span> has access to
<span class="nt">ReplacerFunction</span> from the invocation of the <code>stringify</code> method. Its algorithm is as
follows:</p>
<ol class="proc">
<li>Let <i>value</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>holder</i>, <i>key</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object, then
<ol class="block">
<li>Let <i>toJSON</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>value</i>, <code>"toJSON"</code>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>toJSON</i>) is <b>true</b>
<ol class="block">
<li>Let <i>value</i> be the result of calling the [[Call]] internal method of <i>toJSON</i> passing <i>value</i>
as <i>thisArgument</i> and a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> containing
<i>key</i> as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
</ol>
</li>
</ol>
</li>
<li>If <i>ReplacerFunction</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>value</i> be the result of calling the [[Call]] internal method of <i>ReplacerFunction</i> passing
<i>holder</i> as the <b>this</b> value and with an argument list consisting of <i>key</i> and <i>value</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object then,
<ol class="block">
<li>If <i>value</i> has a [[NumberData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
then,
<ol class="block">
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>value</i>).</li>
</ol>
</li>
<li>Else if <i>value</i> has a [[StringData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> then,
<ol class="block">
<li>Let <i>value</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>value</i>).</li>
</ol>
</li>
<li>Else if <i>value</i> has a [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> then,
<ol class="block">
<li>Let <i>value</i> be the value of the [[BooleanData]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>value</i>.</li>
<li>If <i>value</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>value</i> is <b>null</b> then return <code>"null"</code>.</li>
<li>If <i>value</i> is <b>true</b> then return <code>"true"</code>.</li>
<li>If <i>value</i> is <b>false</b> then return <code>"false"</code>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is String, then return the result of
calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-quote">Quote</a> with argument <i>value</i>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Number
<ol class="block">
<li>If <i>value</i> is finite then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>value</i>).</li>
<li>Else, return <code>"null"</code>.</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object, and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>value</i>) is <b>false</b>
<ol class="block">
<li>If <i>value</i> is an exotic Array object then
<ol class="block">
<li>Return the result of calling the abstract operation JA with argument <i>value</i>.</li>
</ol>
</li>
<li>Else, return the result of calling the abstract operation JO with argument <i>value</i>.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-quote">
<h1><span class="secnum" id="sec-24.3.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-quote" title="link to this section">24.3.2.2</a></span> Runtime
Semantics: Quote Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">Quote(<i>value</i>)</span> wraps a String value in
double quotes and escapes characters within it.</p>
<ol class="proc">
<li>Let <i>product</i> be code unit 0x0022 (the Unicode double quote character).</li>
<li>For each code unit <i>C</i> in <i>value</i>
<ol class="block">
<li>If <i>C</i> is 0x0022 or 0x005C (the Unicode reverse solidus character)
<ol class="block">
<li>Let <i>product</i> be the concatenation of <i>product</i> and code unit 0x005C.</li>
<li>Let <i>product</i> be the concatenation of <i>product</i> and <i>C</i>.</li>
</ol>
</li>
<li>Else if <i>C</i> is backspace, formfeed, newline, carriage return, or tab
<ol class="block">
<li>Let <i>product</i> be the concatenation of <i>product</i> and code unit 0x005C (the Unicode backslash
character).</li>
<li>Let <i>abbrev</i> be the string value corresponding to the value of <i>C</i> as follows:
<table class="lightweight">
<tbody><tr>
<td>backspace</td>
<td><span class="string value">"b"</span></td>
</tr>
<tr>
<td>formfeed</td>
<td><span class="string value">"f"</span></td>
</tr>
<tr>
<td>newline</td>
<td><span class="string value">"n"</span></td>
</tr>
<tr>
<td>carriage return</td>
<td><span class="string value">"r"</span></td>
</tr>
<tr>
<td>tab</td>
<td><span class="string value">"t"</span></td>
</tr>
</tbody></table>
</li>
<li>Let <i>product</i> be the concatenation of <i>product</i> and <i>abbrev</i>.</li>
</ol>
</li>
<li>Else if <i>C</i> has a code unit value less than 0x0020 (the Unicode space character)
<ol class="block">
<li>Let <i>product</i> be the concatenation of <i>product</i> and code unit 0x005C (the Unicode backslash
character).</li>
<li>Let <i>product</i> be the concatenation of <i>product</i> and <code>"u"</code>.</li>
<li>Let <i>hex</i> be the string result of converting the numeric code unit value of <i>C</i> to a String of
four hexadecimal digits. Alphabetic hexadecimal digits are presented as lowercase characters.</li>
<li>Let <i>product</i> be the concatenation of <i>product</i> and <i>hex</i>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>product</i> be the concatenation of <i>product</i> and <i>C</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>product</i> be the concatenation of <i>product</i> and code unit 0x0022 (the Unicode double quote
character).</li>
<li>Return <i>product</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-jo-abstract-operation">
<h1><span class="secnum" id="sec-24.3.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-jo-abstract-operation" title="link to this section">24.3.2.3</a></span> Runtime Semantics: JO Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">JO(<i>value</i>)</span> serializes an object. It has
access to the <var>stack</var>, <var>indent</var>, <var>gap</var>, and <span class="nt">PropertyList</span> of the
invocation of the stringify method.</p>
<ol class="proc">
<li>If <i>stack</i> contains <i>value</i> then throw a <b>TypeError</b> exception because the structure is
cyclical.</li>
<li>Append <i>value</i> to <i>stack</i>.</li>
<li>Let <i>stepback</i> be <i>indent</i>.</li>
<li>Let <i>indent</i> be the concatenation of <i>indent</i> and <i>gap</i>.</li>
<li>If <i>PropertyList</i> is not <b>undefined</b>, then
<ol class="block">
<li>Let <i>K</i> be <i>PropertyList</i>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>K</i> be a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of Strings consisting of the keys
of all the own properties of <i>value</i> whose [[Enumerable]] attribute is <b>true</b> and whose <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type">property key</a> is a String value. The ordering of the Strings is the same as that used
by the <b><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys">Object.keys</a></b> standard built-in function.</li>
</ol>
</li>
<li>Let <i>partial</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>For each element <i>P</i> of <i>K</i>,
<ol class="block">
<li>Let <i>strP</i> be the result of Str(<i>P</i>, <i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>strP</i>).</li>
<li>If <i>strP</i> is not <b>undefined</b>
<ol class="block">
<li>Let <i>member</i> be the result of calling the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-quote">Quote</a> with
argument <i>P</i>.</li>
<li>Let <i>member</i> be the concatenation of <i>member</i> and the string <code>":</code>".</li>
<li>If <i>gap</i> is not the empty String
<ol class="block">
<li>Let <i>member</i> be the concatenation of <i>member</i> and code unit 0x0020 (the Unicode space
character).</li>
</ol>
</li>
<li>Let <i>member</i> be the concatenation of <i>member</i> and <i>strP</i>.</li>
<li>Append <i>member</i> to <i>partial</i>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>partial</i> is empty, then
<ol class="block">
<li>Let <i>final</i> be <code>"{}"</code>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>If <i>gap</i> is the empty String
<ol class="block">
<li>Let <i>properties</i> be a String formed by concatenating all the element Strings of <i>partial</i> with
each adjacent pair of Strings separated with code unit 0x002C (the Unicode comma character). A comma is not
inserted either before the first String or after the last String.</li>
<li>Let <i>final</i> be the result of concatenating <b><span style="font-family: monospace">"{"</span>,</b>
<i>properties</i>, and <code>"}"</code>.</li>
</ol>
</li>
<li>Else <i>gap</i> is not the empty String
<ol class="block">
<li>Let <i>separator</i> be the result of concatenating code unit 0x002C (the comma character), code unit 0x000A
(the line feed character), and <i>indent</i>.</li>
<li>Let <i>properties</i> be a String formed by concatenating all the element Strings of <i>partial</i> with
each adjacent pair of Strings separated with <i>separator</i>. The <i>separator</i> String is not inserted
either before the first String or after the last String.</li>
<li>Let <i>final</i> be the result of concatenating <code>"{"</code>, code unit 0x000A (the line feed
character), <i>indent</i>, <i>properties</i>, code unit 0x000A, <i>stepback</i>, and <code>"}</code>".</li>
</ol>
</li>
</ol>
</li>
<li>Remove the last element of <i>stack</i>.</li>
<li>Let <i>indent</i> be <i>stepback</i>.</li>
<li>Return <i>final</i>.</li>
</ol>
</section>
<section id="sec-runtime-semantics-ja-abstract-operation">
<h1><span class="secnum" id="sec-24.3.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-ja-abstract-operation" title="link to this section">24.3.2.4</a></span> Runtime Semantics: JA Abstract Operation</h1>
<p>The abstract operation <span style="font-family: Times New Roman">JA(<i>value</i>)</span> serializes an array. It has
access to the <var>stack</var>, <var>indent</var>, and <var>gap</var> of the invocation of the stringify method. The
representation of arrays includes only the elements between zero and <code>array.length</code> <span style="font-family:
Times New Roman">– 1</span> inclusive. Properties whose keys are not array indexes are excluded from the
stringification. An array is stringified as an open left bracket, elements separated by comma, and a closing right
bracket.</p>
<ol class="proc">
<li>If <i>stack</i> contains <i>value</i> then throw a <b>TypeError</b> exception because the structure is
cyclical.</li>
<li>Append <i>value</i> to <i>stack</i>.</li>
<li>Let <i>stepback</i> be <i>indent</i>.</li>
<li>Let <i>indent</i> be the concatenation of <i>indent</i> and <i>gap</i>.</li>
<li>Let <i>partial</i> be an empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>value</i> is a standard array object and hence its
<code>"length"</code> property is a non-negative integer.</li>
<li>Let <i>lenVal</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>value</i>, <code>"length"</code>)</li>
<li>Let <i>len</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength">ToLength</a>(<i>lenVal</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>len</i>).</li>
<li>Let <i>index</i> be 0.</li>
<li>Repeat while <i>index</i> &lt; <i>len</i>
<ol class="block">
<li>Let <i>strP</i> be the result of calling the abstract operation Str(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>), <i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>strP</i>).</li>
<li>If <i>strP</i> is <b>undefined</b>
<ol class="block">
<li>Append <code>"null"</code> to <i>partial</i>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Append <i>strP</i> to <i>partial</i>.</li>
</ol>
</li>
<li>Increment <i>index</i> by 1.</li>
</ol>
</li>
<li>If <i>partial</i> is empty, then
<ol class="block">
<li>Let <i>final</i> be <code>"[]"</code>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>If <i>gap</i> is the empty String
<ol class="block">
<li>Let <i>properties</i> be a String formed by concatenating all the element Strings of <i>partial</i> with
each adjacent pair of Strings separated with code unit 0x002C (the comma character). A comma is not inserted
either before the first String or after the last String.</li>
<li>Let <i>final</i> be the result of concatenating <b><span style="font-family: monospace">"["</span>,</b>
<i>properties</i>, and <code>"]"</code>.</li>
</ol>
</li>
<li>Else
<ol class="block">
<li>Let <i>separator</i> be the result of concatenating code unit 0x002C (the comma character), code unit 0x000A
(the line feed character), and <i>indent</i>.</li>
<li>Let <i>properties</i> be a String formed by concatenating all the element Strings of <i>partial</i> with
each adjacent pair of Strings separated with <i>separator</i>. The <i>separator</i> String is not inserted
either before the first String or after the last String.</li>
<li>Let <i>final</i> be the result of concatenating <code>"["</code>, code unit 0x000A (the line feed
character), <i>indent</i>, <i>properties</i>, code unit 0x000A, <i>stepback</i>, and <code>"]</code>".</li>
</ol>
</li>
</ol>
</li>
<li>Remove the last element of <i>stack</i>.</li>
<li>Let <i>indent</i> be <i>stepback</i>.</li>
<li>Return <i>final</i>.</li>
</ol>
</section>
</section>
<section id="sec-json-@@tostringtag">
<h1><span class="secnum" id="sec-24.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-json-@@tostringtag" title="link to this section">24.3.3</a></span>
JSON [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">JSON</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
</section>
<section id="sec-control-abstraction-objects">
<div class="front">
<h1><span class="secnum" id="sec-25"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-control-abstraction-objects" title="link to this section">25</a></span>
Control Abstraction Objects</h1>
</div>
<section id="sec-common-iteration-interfaces">
<div class="front">
<h1><span class="secnum" id="sec-25.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-common-iteration-interfaces" title="link to this section">25.1</a></span> Common Iteration Interfaces</h1>
<p>An interface is a set of property keys whose associated values match a specific specification. Any object that provides
all the properties as described by an interface’s specification <i>conforms</i> to that interface. An interface is not
represented by an distinct object. There may be many separately implemented objects that conform to any interface. An
individual object may conform to multiple interfaces.</p>
</div>
<section id="sec-iterable-interface">
<h1><span class="secnum" id="sec-25.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterable-interface" title="link to this section">25.1.1</a></span>
The <i>Iterable</i> Interface</h1>
<p>The <i>Iterable</i> interface includes the following property:</p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Property</th>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Value</th>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Requirements</th>
</tr>
<tr>
<td style="border-top: 0px solid black"><code>@@iterator</code></td>
<td style="border-top: 0px solid black">A zero arguments function that returns an object.</td>
<td style="border-top: 0px solid black">The function returns an object that conforms to the <i>iterator</i> interface.</td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-iterator-interface">
<h1><span class="secnum" id="sec-25.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface" title="link to this section">25.1.2</a></span>
The <i>Iterator</i> Interface</h1>
<p>The <i>Iterator</i> interface includes the following properties:</p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Property</th>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Value</th>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Requirements</th>
</tr>
<tr>
<td style="border-top: 0px solid black"><code>next</code></td>
<td style="border-top: 0px solid black">A function that returns an object.</td>
<td style="border-top: 0px solid black">The function returns an object that conforms to the <i>IteratorResult</i> interface. If a previous call to the <code>next</code> method of an <i>Iterator</i> has returned an <i>IteratorResult</i> object whose <code>done</code> property is <b>true</b>, then all subsequent calls to the <code>next</code> method of that object must also return an <i>IteratorResult</i> object whose <code>done</code> property is <b>true</b>,</td>
</tr>
</tbody></table>
</figure>
<div class="note">
<p><span class="nh">NOTE</span> Arguments may be passed to the next function but their interpretation and validity is
dependent upon the target Iterator. The for-of statement and other common users of Iterators do not pass any arguments, so
Iterators that expect to be used in such a manner must be prepared to deal with being called with no arguments..</p>
</div>
</section>
<section id="sec-iteratorresult-interface">
<h1><span class="secnum" id="sec-25.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorresult-interface" title="link to this section">25.1.3</a></span> The <i>IteratorResult</i> Interface</h1>
<p>The <i>IteratorResult</i> interface includes the following properties:</p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Property</th>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Value</th>
<th style="background-color: #A6A6A6; border-bottom: 0px solid black; border-top: 1px solid #000080">Requirements</th>
</tr>
<tr>
<td style="border-bottom: 0px solid black; border-top: 0px solid black"><code>done</code></td>
<td style="border-bottom: 0px solid black; border-top: 0px solid black">Either <span class="value">true</span> or <span class="value">false</span>.</td>
<td style="border-bottom: 0px solid black; border-top: 0px solid black">This is the result status of an <i>iterator</i> <code>next</code> method call. If the end of the iterator was reached <code>done</code> is <span class="value">true</span>. If the end was not reached <code>done</code> is <span class="value">false</span> and a value is available. If a <code>done</code> property (either own or inherited does not exist), it is consider to have the value <span class="value">false</span>.</td>
</tr>
<tr>
<td style="border-top: 0px solid black"><code>value</code></td>
<td style="border-top: 0px solid black">Any ECMAScript languge value.</td>
<td style="border-top: 0px solid black">If done is <span class="value">false</span>, this is the current iteration element value. If done is <span class="value">true</span>, this is the return value of the iterator, if it supplied one. If the iterator does not have a return value, <code>value</code> is <span class="value">undefined</span>. In that case, the <code>value</code> property may be absent from the conforming object if it does not inherit an explicit <code>value</code> property.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
<section id="sec-generatorfunction-objects">
<div class="front">
<h1><span class="secnum" id="sec-25.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-objects" title="link to this section">25.2</a></span>
GeneratorFunction Objects</h1>
<p><code>Generator Function</code> objects are constructor functions that are usually created by evaluating <span class="nt">GeneratorDeclaration</span>, <span class="nt">GeneratorExpression</span>, and <span class="nt">GeneratorMethod</span> syntactic productions. They may also be created by calling the
<code>GeneratorFunction</code> constructor.</p>
<figure>
<img alt="A staggering variety of boxes and arrows." height="958" src="./ECMAScript Language Specification ECMA-262 6th Edition – DRAFT_files/figure-2.png" width="968">
<figcaption>Figure 2 (Informative) -- Generator Objects Relationships</figcaption>
</figure>
</div>
<section id="sec-generatorfunction-constructor">
<div class="front">
<h1><span class="secnum" id="sec-25.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-constructor" title="link to this section">25.2.1</a></span> The GeneratorFunction Constructor</h1>
<p>The GeneratorFunction constructor is the %GeneratorFunction% intrinsic object and the value of the name
<code>GeneratorFunction</code> exported from the built-in module <code>"std:iteration"</code>. When
<code>GeneratorFunction</code> is called as a function rather than as a constructor, it creates and initializes a new
GeneratorFunction object. Thus the function call <code>GeneratorFunction</code> <span style="font-family:
monospace"><b>(</b>…<b>)</b></span> is equivalent to the object creation expression <code>new
GeneratorFunction</code> <span style="font-family: monospace"><b>(</b>…<b>)</b></span> with the same arguments.
However, if the <b>this</b> value passed in the call is an Object with a [[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is <span class="value">undefined</span>, it initializses the <b>this</b> value using the argument values. This permits
<code>GeneratorFunction</code> to be used both as factory method and to perform constructor instance initialization.</p>
<p><code>GeneratorFunction</code> may be subclassed and subclass constructors may perform a <code>super</code> invocation
of the <code>GeneratorFunction</code> constructor to initialize subclass instances. However, all syntactic forms for
defining generator function objects create direct instances of <code>GeneratorFunction</code>. There is no syntactic means
to create instances of <code>GeneratorFunction</code> subclasses.</p>
</div>
<section id="sec-generatorfunction">
<h1><span class="secnum" id="sec-25.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction" title="link to this section">25.2.1.1</a></span> GeneratorFunction (p1, p2, … , pn, body)</h1>
<p>The last argument specifies the body (executable code) of a generator function; any preceding arguments specify formal
parameters.</p>
<p>When the <code>GeneratorFunction</code> function is called with some arguments <var>p1</var>, <var>p2</var>, … ,
<var>pn</var>, <var>body</var> (where <var>n</var> might be <span style="font-family: Times New Roman">0</span>, that is,
there are no “<var>p</var>” arguments, and where <var>body</var> might also not be provided), the following
steps are taken:</p>
<ol class="proc">
<li>Let <i>argCount</i> be the total number of arguments passed to this function invocation.</li>
<li>Let <i>P</i> be the empty String.</li>
<li>If <i>argCount</i> = 0, let <i>bodyText</i> be the empty String.</li>
<li>Else if <i>argCount</i> = 1, let <i>bodyText</i> be that argument.</li>
<li>Else <i>argCount</i> &gt; 1,
<ol class="block">
<li>Let <i>firstArg</i> be the first argument.</li>
<li>Let <i>P</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>firstArg</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>P</i>).</li>
<li>Let <i>k</i> be 2.</li>
<li>Repeat, while <i>k</i> &lt; <i>argCount</i>
<ol class="block">
<li>Let <i>nextArg</i> be the <i>k</i>’th argument.</li>
<li>Let <i>nextArgString</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>nextArg</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>nextArgString</i>).</li>
<li>Let <i>P</i> be the result of concatenating the previous value of <i>P</i>, the String <code>","</code> (a
comma), and <i>nextArgString</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Let <i>bodyText</i> be the <i>k</i>’th argument.</li>
</ol>
</li>
<li>Let <i>bodyText</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>bodyText</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>bodyText</i>).</li>
<li>Let <i>parameters</i> be the result of parsing <i>P</i>, interpreted as UTF-16 encoded Unicode text as described in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">clause 10.1.1</a><i>,</i> using <i>FormalParameters</i> as the goal
symbol. Throw a <b>SyntaxError</b> exception if the parse fails.</li>
<li>Let <i>funcBody</i> be the result of parsing <i>bodyText</i>, interpreted as UTF-16 encoded Unicode text as
described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-utf-16-encoding">clause 10.1.1</a><i>,</i> using
<i>FunctionBody</i><sub><span style="font-family: sans-serif">[</span>Yield<span style="font-family:
sans-serif">]</span></sub> as the goal symbol. Throw a <b>SyntaxError</b> exception if the parse fails or if any
static semantics errors are detected.</li>
<li>If IsSimpleParameterList of <i>parameters</i> is <b>false</b> and any element of the BoundNames of <i>parameters</i>
also occurs in the VarDeclaredNames of <i>funcBody</i>, then throw a <b>SyntaxError</b> exception.</li>
<li>If any element of the BoundNames of <i>parameters</i> also occurs in the LexicallyDeclaredNames of <i>funcBody</i>,
then throw a <b>SyntaxError</b> exception.</li>
<li>If <i>bodyText</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see
10.2.1</a>) then let <i>strict</i> be <b>true</b>, else let <i>strict</i> be <b>false</b>.</li>
<li>Let <i>scope</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the Global Environment</a>.</li>
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>F</i>) is not Object or if <i>F</i> does not have a
[[Code]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or if the value of [[Code]] is
not <b>undefined</b>, then
<ol class="block">
<li>Let <i>C</i> be the function that is currently being evaluated.</li>
<li>Let <i>proto</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>C</i>,
<code>"%Generator%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>F</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a> with arguments
<i>proto</i> , <i>strict</i>, and <code>"generator"</code>.</li>
</ol>
</li>
<li>Else, set <i>F’s</i> [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>strict</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> is an extensible object.</li>
<li>If the value of <i>F’s</i> [[FunctionKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is not <code>"generator"</code>, then throw a <b>TypeError</b> exception.</li>
<li>Using <i>funcBody</i> as the <i>FunctionBody</i> production, let <i>body</i> be the supplemental syntactic grammar
production: <span class="prod"><span class="nt">GeneratorBody</span> <span class="geq">:</span> <span class="nt">FunctionBody</span></span> .</li>
<li>Perform the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functioninitialize">FunctionInitialize</a> abstract operation with arguments <i>F</i>,
Normal, <i>parameters</i>, <i>body,</i> and <i>scope</i>.</li>
<li>Let <i>prototype</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a> with the
intrinsic object <span style="font-family: sans-serif">%GeneratorPrototype%</span> as its argument.</li>
<li>If ReferencesSuper(<i>funcBody</i>) is <b>true</b> or ReferencesSuper(<i>parameters</i>) is <b>true</b>, then
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makemethod">MakeMethod</a>(<i>F</i>, <b>undefined</b>, <b>undefined</b>).</li>
</ol>
</li>
<li>Let <i>status</i> be the result of the abstract operation <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor">MakeConstructor</a> with
arguments <i>F</i>, <b>true</b>, and <i>prototype</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>Let <i>hasName</i> be HasOwnProprty(<i>F</i>, <span style="font-family: monospace">"<b>name</b>"</span>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hasName</i>).</li>
<li>If <i>hasName</i> is <b>false</b>, then perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>F</i>, <span style="font-family: monospace">"<b>anonymous</b>"</span>).</li>
<li>Return <i>F</i>.</li>
</ol>
<p>A <code>prototype</code> property is automatically created for every function created using the
<code>GeneratorFunction</code> constructor, to provide for the possibility that the function will be used as a
constructor.</p>
</section>
<section id="sec-new-generatorfunction-argumentslist">
<h1><span class="secnum" id="sec-25.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-generatorfunction-argumentslist" title="link to this section">25.2.1.2</a></span> new GeneratorFunction ( ... argumentsList)</h1>
<p>When <code>GeneratorFunction</code> is called as part of a <code>new</code> expression, it creates and initializes a
newly created object:</p>
<ol class="proc">
<li>Let <i>F</i> be the <code>GeneratorFunction</code> function object on which the <code>new</code> operator was
applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a> (<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>GeneratorFunction</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function
object</a>, its [[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-generatorfunction-constructor">
<div class="front">
<h1><span class="secnum" id="sec-25.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-generatorfunction-constructor" title="link to this section">25.2.2</a></span> Properties of the GeneratorFunction Constructor</h1>
<p>The GeneratorFunction constructor is a built-in Function object that inherits from the Function constructor. The value
of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the GeneratorFunction
constructor is the intrinsic object %Function%.</p>
<p>The value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
GeneratorFunction constructor is <b>true</b>.</p>
<p>The GeneratorFunction constructor has the following properties:</p>
</div>
<section id="sec-generatorfunction.length">
<h1><span class="secnum" id="sec-25.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction.length" title="link to this section">25.2.2.1</a></span> GeneratorFunction.length</h1>
<p>This is a data property with a value of 1. This property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>true</b> }.</p>
</section>
<section id="sec-generatorfunction.prototype">
<h1><span class="secnum" id="sec-25.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction.prototype" title="link to this section">25.2.2.2</a></span> GeneratorFunction.prototype</h1>
<p>The initial value of <code>GeneratorFunction.prototype</code> is %Generator%, the standard built-in GeneratorFunction
prototype.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-generatorfunction-@@create">
<h1><span class="secnum" id="sec-25.2.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-@@create" title="link to this section">25.2.2.3</a></span> GeneratorFunction[ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>proto</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getprototypefromconstructor">GetPrototypeFromConstructor</a>(<i>F</i>, <code>"%Generator%"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>proto</i>).</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a> with argument
<i>proto</i>, <b>false</b>, and <code>"generator"</code>.</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
<div class="note">
<p><span class="nh">NOTE</span> The GeneratorFunction <code>@@create</code> function passes <b>false</b> as the
<i>strict</i> parameter to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functionallocate">FunctionAllocate</a>. This causes the allocated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> to have the internal methods of a non-strict
function. The <code>GeneratorFunction</code> constructor may reset the functions [[Strict]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>true</b>. It is up to the implementation
whether this also changes the internal methods.</p>
</div>
</section>
</section>
<section id="sec-properties-of-the-generatorfunction-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-25.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-generatorfunction-prototype-object" title="link to this section">25.2.3</a></span> Properties of the GeneratorFunction Prototype Object</h1>
<p>The GeneratorFunction prototype object is an ordinary object. It is not a function object and does not have a [[Code]]
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or any other of the internal slots listed in
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-47">Table 47</a>. In addition to being the value of the prototype
property of the %GeneratorFunction% intrinsic and is itself the %Generator% intrinsic.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
GeneratorFunction prototype object is the %FunctionPrototype% intrinsic object. The initial value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the GeneratorFunction prototype object is
<b>true</b>.</p>
</div>
<section id="sec-generatorfunction.prototype.constructor">
<h1><span class="secnum" id="sec-25.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction.prototype.constructor" title="link to this section">25.2.3.1</a></span> GeneratorFunction.prototype.constructor</h1>
<p>The initial value of <code>GeneratorFunction.prototype.constructor</code> is the intrinsic object
%GeneratorFunction%.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-generatorfunction.prototype.prototype">
<h1><span class="secnum" id="sec-25.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction.prototype.prototype" title="link to this section">25.2.3.2</a></span> GeneratorFunction.prototype.prototype</h1>
<p>The value of <code>GeneratorFunction.prototype.prototype</code> is the %GeneratorPrototype% intrinsic object.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-generatorfunction.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-25.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction.prototype-@@tostringtag" title="link to this section">25.2.3.3</a></span> GeneratorFunction.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">GeneratorFunction</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-generatorfunction.prototype-@@create">
<h1><span class="secnum" id="sec-25.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction.prototype-@@create" title="link to this section">25.2.3.4</a></span> GeneratorFunction.prototype [ @@create ] ( )</h1>
<p>The @@create method of an object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%GeneratorPrototype%"</code>, ( [[GeneratorState]], [[GeneratorContext]]) ).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">true</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-generatorfunction-instances">
<div class="front">
<h1><span class="secnum" id="sec-25.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-instances" title="link to this section">25.2.4</a></span> GeneratorFunction Instances</h1>
<p>Every GeneratorFunction instance is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a> and
has the internal slots listed in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-26">Table 26</a>. The value of the [[FunctionKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> for all such instances is
"<code>generator</code>".</p>
<p>The GeneratorFunction instances have the following own properties:</p>
</div>
<section id="sec-generatorfunction-instances-length">
<h1><span class="secnum" id="sec-25.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-instances-length" title="link to this section">25.2.4.1</a></span> length</h1>
<p>The value of the <code>length</code> property is an integer that indicates the typical number of arguments expected by
the GeneratorFunction. However, the language permits the function to be invoked with some other number of arguments. The
behaviour of a GeneratorFunction when invoked on a number of arguments other than the number specified by its
<code>length</code> property depends on the function.</p>
<p>This property has the attributes {&nbsp;[[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b>&nbsp;}.</p>
</section>
<section id="sec-generatorfunction-instances-prototype">
<h1><span class="secnum" id="sec-25.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-instances-prototype" title="link to this section">25.2.4.2</a></span> prototype</h1>
<p>Whenever a GeneratorFunction instance is created another ordinary object is also created and is the initial value of
the generator function’s <code>prototype</code> property. The value of the prototype property is used to initialize
the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of a newly created Generator
object before the generator function object is invoked as a constructor for that newly created object.</p>
<p>This property has the attributes {&nbsp;[[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span>&nbsp;}.</p>
<div class="note">
<p><span class="nh">NOTE</span> Unlike function instances, the object that is the value of the a
GeneratorFunction’s <code>prototype</code> property does not have a <code>constructor</code> property whose value
is the GeneratorFunction instance.</p>
</div>
</section>
</section>
</section>
<section id="sec-generator-objects">
<div class="front">
<h1><span class="secnum" id="sec-25.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-objects" title="link to this section">25.3</a></span>
Generator Objects</h1>
<p>A Generator object is an instance of a generator function and conforms to both the <i>Iterator</i> and <i>Iterable</i>
interfaces.</p>
<p>Generator instances directly inherit properties from the object that is the value of the <code>prototype</code> property
of the Generator function that created the instance. Generator instances indirectly inherit properties from the Generator
Prototype intrinsic, %GeneratorPrototype%.</p>
</div>
<section id="sec-properties-of-generator-prototype">
<div class="front">
<h1><span class="secnum" id="sec-25.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-generator-prototype" title="link to this section">25.3.1</a></span> Properties of Generator Prototype</h1>
<p>The Generator prototype object is the %GeneratorPrototype% intrinsic. It is also the initial value of the
<code>prototype</code> property of the %Generator% intrinsic (the GeneratorFrunction.prototype).</p>
<p>The Generator prototype is an ordinary object. It is not a Generator instance and does not have a [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Generator prototype object is the intrinsic object %ObjectPrototype% (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The initial value of the [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Function prototype object is
<b>true</b>.</p>
<p>All Generator instances indirectly inherit properties of the Generator prototype object.</p>
</div>
<section id="sec-generator.prototype.constructor">
<h1><span class="secnum" id="sec-25.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator.prototype.constructor" title="link to this section">25.3.1.1</a></span> Generator.prototype.constructor</h1>
<p>The initial value of <code>Generator.prototype.constructor</code> is the intrinsic object %Generator%.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-generator.prototype.next">
<h1><span class="secnum" id="sec-25.3.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator.prototype.next" title="link to this section">25.3.1.2</a></span> Generator.prototype.next ( value )</h1>
<p>The <code>next</code> method performs the following steps:</p>
<ol class="proc">
<li>Let <i>g</i> be the <b>this</b> value.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume">GeneratorResume</a>(<i>g</i>, <i>value</i>).</li>
</ol>
</section>
<section id="sec-generator.prototype.throw">
<h1><span class="secnum" id="sec-25.3.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator.prototype.throw" title="link to this section">25.3.1.3</a></span> Generator.prototype.throw ( exception )</h1>
<p>The <code>throw</code> method performs the following steps:</p>
<ol class="proc">
<li>Let <i>generator</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>generator</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>generator</i> does not have a [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>state</i> be the value of <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>generator</i> also has a [[GeneratorContext]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>E</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family: sans-serif">throw</span>, [[value]]: <i>exception</i>, [[target]]: <span style="font-family:
sans-serif">empty</span>}.</li>
<li>If <i>state</i> is <code>"completed"</code>, then return <i>E</i>.</li>
<li>If <i>state</i> is neither <code>"suspendedStart"</code> nor <code>"suspendedYield"</code>, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>state</i> is <code>"suspendedStart"</code> then,
<ol class="block">
<li>Set <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <code>"completed"</code>.</li>
<li>Once a generator enters the <code>"completed"</code> state it never leaves it and its associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> is never resumed. Any execution state associated with
<i>generator</i> can be discard at this point.</li>
<li>Return <i>E</i>.</li>
</ol>
</li>
<li>Let <i>genContext</i> be value of <i>generator’s</i> [[GeneratorContext]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>methodContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>methodContext</i>.</li>
<li>Set <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <code>"executing"</code>.</li>
<li>Push <i>genContext</i> onto <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>genContext</i> is
now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Resume the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> evaluation of <i>genContext</i> using <i>E</i> as the
result of the operation that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> it. Let <i>result</i> be the value
returned by the resumed compation.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: When we return here, <i>genContext</i> has already been removed
from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and <i>methodContext</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the currently running execution context</a>.</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
<section id="sec-generator.prototype-@@iterator">
<h1><span class="secnum" id="sec-25.3.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator.prototype-@@iterator" title="link to this section">25.3.1.4</a></span> Generator.prototype [ @@iterator ] ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return the <b>this</b> value.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
<section id="sec-generator.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-25.3.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator.prototype-@@tostringtag" title="link to this section">25.3.1.5</a></span> Generator.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">Generator</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-generator-instances">
<h1><span class="secnum" id="sec-25.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-generator-instances" title="link to this section">25.3.2</a></span> Properties of Generator Instances</h1>
<p>Generator instances are initially created with the internal slots described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-47">Table 47</a>.</p>
<figure>
<figcaption><span id="table-47">Table 47</span> — Internal Slots of Generator Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[GeneratorState]]</td>
<td>The current execution state of the generator. The possible values are: <b>undefined</b>, <code>"suspendedStart"</code><span style="font-family: Times New Roman">,</span> <code>"suspendedYield"</code><span style="font-family: Times New Roman">,</span> <code>"executing"</code>, and <code>"completed"</code><span style="font-family: Times New Roman">.</span></td>
</tr>
<tr>
<td>[[GeneratorContext]]</td>
<td>The <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> that is used when executing the code of this generator.</td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-generator-abstract-operations">
<div class="front">
<h1><span class="secnum" id="sec-25.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-abstract-operations" title="link to this section">25.3.3</a></span> Generator Abstract Operations</h1>
</div>
<section id="sec-generatorstart">
<h1><span class="secnum" id="sec-25.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorstart" title="link to this section">25.3.3.1</a></span>
GeneratorStart (generator, generatorBody)</h1>
<p>The abstract operation GeneratorStart with arguments <span style="font-family: Times New Roman"><i>generator</i> and
<i>generatorBody</i></span> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: The value of <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>.</li>
<li>Let <i>genContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Set the Generator component of <i>genContext</i> to <i>generator.</i></li>
<li>Set the code evaluation state of <i>genContext</i> such that when evaluation is resumed for that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> the following steps will be performed:
<ol class="block">
<li>Let <i>result</i> be the result of evaluating <i>generatorBody</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: If we return here, the generator either threw an exception or
performed either an implicit or explicit return.</li>
<li>Remove <i>genContext</i> from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and restore the
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> that is at the top of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running
execution context</a>.</li>
<li>Set <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <code>"completed"</code>.</li>
<li>Once a generator enters the <code>"completed"</code> state it never leaves it and its associated <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> is never resumed. Any execution state associated with
<i>generator</i> can be discard at this point.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>result</i>, <b>true</b>).</li>
</ol>
</li>
<li>Set <i>generator’s</i> [[GeneratorContext]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>genContext</i>.</li>
<li>Set <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <code>"suspendedStart"</code>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>generator</i>).</li>
</ol>
</section>
<section id="sec-generatorresume">
<h1><span class="secnum" id="sec-25.3.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume" title="link to this section">25.3.3.2</a></span>
GeneratorResume ( generator, value )</h1>
<p>The abstract operation GeneratorResume with arguments <span style="font-family: Times New Roman"><i>generator</i> and
<i>value</i></span> performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>generator</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>generator</i> does not have a [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a <b>TypeError</b>
exception.</li>
<li>Let <i>state</i> be the value of <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>generator</i> also has a [[GeneratorContext]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>state</i> is <code>"completed"</code>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
<li>If <i>state</i> is neither <code>"suspendedStart"</code> nor <code>"suspendedYield"</code>, then throw a
<b>TypeError</b> exception.</li>
<li>Let <i>genContext</i> be value of <i>generator’s</i> [[GeneratorContext]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>methodContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">Suspend</a> <i>methodContext</i>.</li>
<li>Set <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <code>"executing"</code>.</li>
<li>Push <i>genContext</i> onto <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a>; <i>genContext</i> is
now <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Resume the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> evaluation of <i>genContext</i> using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>value</i>) as the result of the operation that <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">suspended</a> it. Let <i>result</i> be the value returned by the resumed
computation.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: When we return here, <i>genContext</i> has already been removed
from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and <i>methodContext</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the currently running execution context</a>.</li>
<li>Return <i>result</i>.</li>
</ol>
</section>
<section id="sec-generatoryield">
<h1><span class="secnum" id="sec-25.3.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatoryield" title="link to this section">25.3.3.3</a></span>
GeneratorYield ( iterNextObj )</h1>
<p>The abstract operation GeneratorYield with argument <var>iterNextObj</var> performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>iterNextObj</i> is an Object that implemented the
<i>IteratorResult</i> interface.</li>
<li>Let <i>genContext</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>genContext</i> is the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> of a generator.</li>
<li>Let <i>generator</i> be the value of the Generator component of <i>genContext</i>.</li>
<li>Set the value of <i>generator’s</i> [[GeneratorState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <code>"suspendedYield"</code>.</li>
<li>Remove <i>genContext</i> from <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the execution context stack</a> and restore the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">execution context</a> that is at the top of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the
execution context stack</a> as <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Set the code evaluation state of <i>genContext</i> such that when evaluation is resumed with a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a> <i>resumptionValue</i> the following steps will be
performed:
<ol class="block">
<li>Return <i>resumptionValue</i>.</li>
<li>NOTE: This returns to the evaluation of the <i>YieldExpression</i> production that originally called this
abstract operation.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<i>iterNextObj</i>).</li>
<li>NOTE: This returns to the evaluation of the operation that had most previously resumed evaluation of
<i>genContext</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-promise-objects">
<div class="front">
<h1><span class="secnum" id="sec-25.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects" title="link to this section">25.4</a></span> Promise
Objects</h1>
<p>A Promise is an object that is used as a placeholder for the eventual results of a deferred (and possibly asynchronous)
computation.</p>
<p>Any Promise object is in one of three mutually exclusive states: <i>fulfilled</i>, <i>rejected</i>, and
<i>pending</i>:</p>
<ul>
<li>
<p>A promise <code>p</code> is fulfilled if <code>p.then(f, r)</code> will immediately enqueue a Task to call the
function <code>f</code>.</p>
</li>
<li>
<p>A promise <code>p</code> is rejected if <code>p.then(f, r)</code> will immediately enqueue a Task to call the
function <code>r</code>.</p>
</li>
<li>
<p>A promise is pending if it is neither fulfilled nor rejected.</p>
</li>
</ul>
<p>A promise is said to be <i>settled</i> if it is not pending, i.e. if it is either fulfilled or rejected.</p>
<p>A promise is <i>resolved</i> if it is settled or if it has been "locked in" match the state of another promise.
Attempting to resolve or reject a resolved promise has no effect. A promise is <i>unresolved</i> if it is not resolved. An
unresolved promise is always in the pending state. A resolved promise may be pending, fulfilled, pending.</p>
</div>
<section id="sec-promise-abstract-operations">
<div class="front">
<h1><span class="secnum" id="sec-25.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-abstract-operations" title="link to this section">25.4.1</a></span> Promise Abstract Operations</h1>
</div>
<section id="sec-promisecapability-records">
<div class="front">
<h1><span class="secnum" id="sec-25.4.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisecapability-records" title="link to this section">25.4.1.1</a></span> PromiseCapability Records</h1>
<p>A PromiseCapability is a Record value used to encapsulate a promise object along with the functions that are capable
of resolving or rejecting that promise object. PromiseCapability records are produced by the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a> abstract operation.</p>
<p>PromiseCapability Records have the fields listed in <b>Table 48</b>.</p>
<p><b>Table 48 — PromiseCapability Record Fields</b></p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Promise]]</td>
<td>An object</td>
<td>An object that is usable as a promise.</td>
</tr>
<tr>
<td>[[Resolve]]</td>
<td>A function object</td>
<td>The function that is used to resolve the given promise object.</td>
</tr>
<tr>
<td>[[Reject]]</td>
<td>A function object</td>
<td>The function that is used to reject the given promise object.</td>
</tr>
</tbody></table>
</figure>
</div>
<section id="sec-ifabruptrejectpromise">
<h1><span class="secnum" id="sec-25.4.1.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise" title="link to this section">25.4.1.1.1</a></span> IfAbruptRejectPromise ( value, capability )</h1>
<p>IfAbruptRejectPromise is a short hand for a sequence of algorithm steps that use a PromiseCapability record. An
algorithm step of the form:</p>
<ol class="proc">
<li>IfAbruptRejectPromise(<i>value</i>, <i>capability</i>).</li>
</ol>
<p>means the same thing as:</p>
<ol class="proc">
<li>If <i>value</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>,
<ol class="block">
<li>Let <i>rejectResult</i> be the result of calling the [[Call]] internal method of <i>capability</i>.[[Reject]]
with <b>undefined</b> as <i>thisArgument</i> and (<i>value</i>.[[value]]) as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rejectResult</i>).</li>
<li>Return <i>capability</i>.[[Promise]].</li>
</ol>
</li>
<li>Else if <i>value</i> is a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion Record</a>, then let
<i>value</i> be <i>value</i>.[[value]].</li>
</ol>
</section>
</section>
<section id="sec-promisereaction-records">
<h1><span class="secnum" id="sec-25.4.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisereaction-records" title="link to this section">25.4.1.2</a></span> PromiseReaction Records</h1>
<p>The PromiseReaction is a Record value used to store information about how a promise should react when it becomes
resolved or rejected with a given value. PromiseReaction records are created by the <code>then</code> method of the
Promise prototype, and are used by a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisereactiontask">PromiseReactionTask</a>.</p>
<p>PromiseReaction records have the fields listed in <b>Table 49</b>.</p>
<p><b>Table 49 — PromiseReaction Record Fields</b></p>
<figure>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 0px solid black; border-top: 2px solid #000000">Field Name</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Value</th>
<th style="border-bottom: 1px solid #000000; border-right: 1px solid #000000; border-top: 2px solid #000000">Meaning</th>
</tr>
<tr>
<td>[[Capabilities]]</td>
<td>A PromiseCapability record</td>
<td>The capabilities of the promise for which this record provides a reaction handler.</td>
</tr>
<tr>
<td>[[Handler]]</td>
<td>A function object</td>
<td>The function that should be applied to the incoming value, and whose return value will govern what happens to the derived promise.</td>
</tr>
</tbody></table>
</figure>
</section>
<section id="sec-createresolvingfunctions">
<div class="front">
<h1><span class="secnum" id="sec-25.4.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createresolvingfunctions" title="link to this section">25.4.1.3</a></span> CreateResolvingFunctions ( promise )</h1>
<p>When CreateResolvingFunctions is performed with argument <var>promise</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>alreadyResolved</i> be a new Record { [[value]]: <b>false</b> }.</li>
<li>Let <i>resolve</i> be a new built-in function object as defined in Promise Resolve Functions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-resolve-functions">25.4.1.3.2</a>).</li>
<li>Set the [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>resolve</i>
to <i>promise</i>.</li>
<li>Set the [[AlreadyResolved]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>resolve</i> to <i>alreadyResolved</i>.</li>
<li>Let <i>reject</i> be a new built-in function object as defined in Promise Reject Functions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-reject-functions">25.4.1.3.1</a>).</li>
<li>Set the [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>reject</i>
to <i>promise</i>.</li>
<li>Set the [[AlreadyResolved]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>reject</i> to <i>alreadyResolved</i>.</li>
<li>Return a new Record { [[Resolve]]: <i>resolve</i>, [[Reject]]: <i>reject</i> }.</li>
</ol>
</div>
<section id="sec-promise-reject-functions">
<h1><span class="secnum" id="sec-25.4.1.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-reject-functions" title="link to this section">25.4.1.3.1</a></span> Promise Reject Functions</h1>
<p>A promise reject function is an anonymous built-in function that has [[Promise]] and [[AlreadyResolved]] internal
slots.</p>
<p>When a promise reject function <var>F</var> is called with argument <var>reason</var>, the following steps are
taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> has a [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is an Object.</li>
<li>Let <i>promise</i> be the value of <i>F</i>'s [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>alreadyResolved</i> by the value of <i>F</i>'s [[AlreadyResolved]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>alreadyResolved</i>.[[value]] is <b>true</b>, then return <b>undefined</b>.</li>
<li>Set <i>alreadyResolved</i>.[[value]] to <b>true</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-rejectpromise">RejectPromise</a>(<i>promise</i>, <i>reason</i>).</li>
</ol>
</section>
<section id="sec-promise-resolve-functions">
<h1><span class="secnum" id="sec-25.4.1.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-resolve-functions" title="link to this section">25.4.1.3.2</a></span> Promise Resolve Functions</h1>
<p>A promise resolve function is an anonymous built-in function that has [[Promise]] and [[AlreadyResolved]] internal
slots.</p>
<p>When a promise resolve function <var>F</var> is called with argument <var>resolution</var>, the following steps are
taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> has a [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is an Object.</li>
<li>Let <i>promise</i> be the value of <i>F</i>'s [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>alreadyResolved</i> by the value of <i>F</i>'s [[AlreadyResolved]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>alreadyResolved</i>. [[value]] is <b>true</b>, then return <b>undefined</b>.</li>
<li>Set <i>alreadyResolved</i>.[[value]] to <b>true</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>resolution</i>, <i>promise</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>selfResolutionError</i> be a newly-created <b>TypeError</b> object.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-rejectpromise">RejectPromise</a>(<i>promise</i>, <i>selfResolutionError</i>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>resolution</i>) is not Object, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-fulfillpromise">FulfillPromise</a>(<i>promise</i>, <i>resolution</i>).</li>
</ol>
</li>
<li>Let <i>then</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>resolution</i>, <code>"then"</code>).</li>
<li>If <i>then</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-rejectpromise">RejectPromise</a>(<i>promise</i>, <i>then</i>.[[value]]).</li>
</ol>
</li>
<li>Let <i>then</i> be <i>then</i>.[[value]].</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>then</i>) is <b>false</b>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-fulfillpromise">FulfillPromise</a>(<i>promise</i>, <i>resolution</i>).</li>
</ol>
</li>
<li>Let <i>resolvingFunctions</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createresolvingfunctions">CreateResolvingFunctions</a>(<i>promise</i>).</li>
<li>Let <i>thenCallResult</i> be the result of calling the [[Call]] internal method of <i>then</i> passing
<i>resolution</i> as the <i>thisArgument</i> and (<i>resolvingFunctions</i>.[[Resolve]],
<i>resolvingFunctions</i>.[[Reject]]) as <i>argumentsList</i>.</li>
<li>If <i>thenCallResult</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>,
<ol class="block">
<li>Return the result of calling the [[Call]] internal method of <i>resolvingFunctions</i>.[[Reject]] passing
<b>undefined</b> as the <i>thisArgument</i> and (<i>thenCallResult</i>.[[value]]) as
<i>argumentsList</i>.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
<section id="sec-fulfillpromise">
<h1><span class="secnum" id="sec-25.4.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-fulfillpromise" title="link to this section">25.4.1.4</a></span>
FulfillPromise ( promise, value)</h1>
<p>When the FulfillPromise abstract operation is called with arguments <var>promise</var> and <var>value</var> the
following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <code>"pending"</code>.</li>
<li>Let <i>reactions</i> be the value of <i>promise</i>'s [[PromiseFulfullReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseResult]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>resolution</i>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseFulfullReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>undefined</b>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseRejectReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>undefined</b>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <code>"fulfilled"</code>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-triggerpromisereactions">TriggerPromiseReactions</a>(<i>reactions</i>, <i>resolution</i>).</li>
</ol>
</section>
<section id="sec-newpromisecapability">
<div class="front">
<h1><span class="secnum" id="sec-25.4.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability" title="link to this section">25.4.1.5</a></span> NewPromiseCapability ( C )</h1>
<p>The abstract operation NewPromiseCapability takes a constructor function, and attempts to use that constructor
function in the fashion of the built-in <code>Promise</code> constructor to create a Promise object and extract its
resolve and reject functions. The promise plus the resolve and reject functions are used to initialize a new
PromiseCapability record which is returned as the value of this abstraction operation.</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor">IsConstructor</a>(<i>C</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>C</i> is a constructor function that supports the parameter
conventions of the <code>Promise</code> constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise">see 25.4.3.1</a>).</li>
<li>Let <i>promise</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor">CreateFromConstructor</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promise</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>promise</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createpromisecapabilityrecord">CreatePromiseCapabilityRecord</a>(<i>promise</i>,
<i>C</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This abstract operation supports Promise subclassing, as it is generic on any
constructor that calls a passed executor function argument in the same way as the Promise constructor. It is used to
generalize static methods of the Promise constructor to any subclass.</p>
</div>
</div>
<section id="sec-createpromisecapabilityrecord">
<h1><span class="secnum" id="sec-25.4.1.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createpromisecapabilityrecord" title="link to this section">25.4.1.5.1</a></span> CreatePromiseCapabilityRecord( promise, constructor )</h1>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>promise</i> is an unitialized object created as if by invoking
@@create on <i>constructor</i>.</li>
<li>Let <i>promiseCapability</i> be a new PromiseCapability { [[Promise]]: <i>promise</i>, [[Resolve]]:
<b>undefined</b>, [[Reject]]: <b>undefined</b> }.</li>
<li>Let <i>executor</i> be a new built-in function object as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getcapabilitiesexecutor-functions">GetCapabilitiesExecutor Functions</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createpromisecapabilityrecord">25.4.1.5.1</a>).</li>
<li>Set the [[Capability]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>executor</i> to <i>promiseCapability</i>.</li>
<li>Let <i>constructorResult</i> be the result of calling the [[Call]] internal method of <i>constructor</i>, passing
<i>promise</i> and (<i>executor</i>) as the arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>constructorResult</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>promiseCapability</i>.[[Resolve]]) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>promiseCapability</i>. [[Reject]]) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>constructorResult</i>) is Object and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>promise</i>, <i>constructorResult</i>) is <b>false</b>, then throw a
<b>TypeError</b> exception.</li>
<li>Return <i>promiseCapability</i>.</li>
</ol>
</section>
<section id="sec-getcapabilitiesexecutor-functions">
<h1><span class="secnum" id="sec-25.4.1.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getcapabilitiesexecutor-functions" title="link to this section">25.4.1.5.2</a></span> GetCapabilitiesExecutor Functions</h1>
<p>A GetCapabilitiesExecutor function is an anonymous built-in function that has a [[Capability]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>When a GetCapabilitiesExecutor function <var>F</var> is called with arguments <var>resolve</var> and
<var>reject</var> the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>F</i> has a [[Capability]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is a PromiseCapability
Record.</li>
<li>Let <i>promiseCapability</i> be the value of <i>F</i>'s [[Capability]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>promiseCapability</i>.[[Resolve]] is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <i>promiseCapability</i>.[[Reject]] is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Set <i>promiseCapability</i>.[[Resolve]] to <i>resolve</i>.</li>
<li>Set <i>promiseCapability</i>.[[Reject]] to <i>reject</i>.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
<section id="sec-ispromise">
<h1><span class="secnum" id="sec-25.4.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispromise" title="link to this section">25.4.1.6</a></span>
IsPromise ( x )</h1>
<p>The abstract operation IsPromise checks for the promise brand on an object.</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>x</i>) is not Object, return <b>false</b>.</li>
<li>If <i>x</i> does not have a [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, return <b>false</b>.</li>
<li>If the value of <i>x</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is <b>undefined</b>, return <b>false</b>.</li>
<li>Return <b>true</b>.</li>
</ol>
</section>
<section id="sec-rejectpromise">
<h1><span class="secnum" id="sec-25.4.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-rejectpromise" title="link to this section">25.4.1.7</a></span>
RejectPromise ( promise, reason)</h1>
<p>When the RejectPromise abstract operation is called with arguments <var>promise</var> and <var>reason</var> the
following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <code>"pending"</code>.</li>
<li>Let <i>reactions</i> be the value of <i>promise</i>'s [[PromiseRejectReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseResult]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>reason</i>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseFulfillReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>undefined</b>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseRejectReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>undefined</b>.</li>
<li>Set the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <code>"rejected"</code>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-triggerpromisereactions">TriggerPromiseReactions</a>(<i>reactions</i>, <i>reason</i>).</li>
</ol>
</section>
<section id="sec-triggerpromisereactions">
<h1><span class="secnum" id="sec-25.4.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-triggerpromisereactions" title="link to this section">25.4.1.8</a></span> TriggerPromiseReactions ( reactions, argument )</h1>
<p>The abstract operation TriggerPromiseReactions takes a collection of functions to trigger in the next Task, and calls
them, passing each the given argument. Typically, these reactions will modify a previously-returned promise, possibly
calling in to a user-supplied handler before doing so.</p>
<ol class="proc">
<li>Repeat for each <i>reaction</i> in <i>reactions</i>, in original insertion order
<ol class="block">
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-enqueuetask">EnqueueTask</a>(<span style="font-family: monospace">"PromiseTasks",</span>
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisereactiontask">PromiseReactionTask</a>, (<i>reaction</i>, <i>argument</i>)).</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
<section id="sec-promise-tasks">
<div class="front">
<h1><span class="secnum" id="sec-25.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-tasks" title="link to this section">25.4.2</a></span>
Promise Tasks</h1>
</div>
<section id="sec-promisereactiontask">
<h1><span class="secnum" id="sec-25.4.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisereactiontask" title="link to this section">25.4.2.1</a></span> PromiseReactionTask ( reaction, argument )</h1>
<p>The task PromiseReactionTask with parameters <var>reaction</var> and <var>argument</var> applies the appropriate
handler to the incoming value, and uses the handler's return value to resolve or reject the derived promise associated
with that handler.</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>reaction</i> is a PromiseReaction Record.</li>
<li>Let <i>promiseCapability</i> be <i>reaction</i>.[[Capabilities]].</li>
<li>Let <i>handler</i> be <i>reaction</i>.[[Handler]].</li>
<li>Let <i>handlerResult</i> be the result of calling the [[Call]] internal method of <i>handler</i> passing
<b>undefined</b> as <i>thisArgument</i> and (<i>argument</i>) as <i>argumentsList</i>.</li>
<li>If <i>handlerResult</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of <i>promiseCapability</i>.[[Reject]]
passing <b>undefined</b> as <i>thisArgument</i> and (<i>handlerResult</i>.[[value]]) as
<i>argumentsList</i>.</li>
<li>NextTask <i>status</i>.</li>
</ol>
</li>
<li>Let <i>handlerResult</i> be <i>handlerResult</i>.[[value]].</li>
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of <i>promiseCapability</i>.[[Resolve]]
passing <b>undefined</b> as <i>thisArgument</i> and (<i>handlerResult</i>) as <i>argumentsList.</i></li>
<li>NextTask <i>status</i>.</li>
</ol>
</section>
</section>
<section id="sec-promise-constructor">
<div class="front">
<h1><span class="secnum" id="sec-25.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor" title="link to this section">25.4.3</a></span>
The Promise Constructor</h1>
<p>The Promise constructor is the %Promise% intrinsic object and the initial value of the <code>Promise</code> property of
the global object. When <code>Promise</code> is called as a function rather than as a constructor, it initializes its
<b>this</b> value with the internal state necessary to support the <code>Promise.prototype</code> methods.</p>
<p>The <code>Promise</code> constructor is designed to be subclassable. It may be used as the value in an
<code>extends</code> clause of a class definition. Subclass constructors that intend to inherit the specified
<code>Promise</code> behaviour must include a <code>super</code> call to <code>Promise</code>.</p>
</div>
<section id="sec-promise">
<div class="front">
<h1><span class="secnum" id="sec-25.4.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise" title="link to this section">25.4.3.1</a></span>
Promise ( executor )</h1>
<p>When the <code>Promise</code> function is called with argument <var>executor</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>promise</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>promise</i>) is not Object, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>promise</i> does not have a [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then throw a <b>TypeError</b>
exception.</li>
<li>If <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>executor</i>) is <b>false</b>, then throw a <b>TypeError</b>
exception.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializepromise">InitializePromise</a>(<i>promise</i>, <i>executor</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <i>executor</i> argument must be a function object. It is called for initiating
and reporting completion of the possibly deferred action represented by this Promise object. The executor is called
with two arguments: <i>resolve</i> and <i>reject</i>. These are functions that may be used by the <i>executor</i>
function to report eventual completion or failure of the deferred computation. Returning from the executor function
does not mean that the deferred action has been completed but only that the request to eventually perform the deferred
action has been accepted.</p>
<p>The <i>resolve</i> function that is passed to an <i>executor</i> function accepts a single argument. The
<i>executor</i> code may eventually call the <i>resolve</i> function to indicate that it wishes to resolve the
associated Promise object. The argument passed to the <i>resolve</i> function represents the eventual value of the
deferred action and can be either the actual fulfillment value or another Promise object which will provide the value
if it is fullfilled.</p>
<p>The <i>reject</i> function that is passed to an <i>executor</i> function accepts a single argument. The
<i>executor</i> code may eventually call the <i>reject</i> function to indicate that the associated Promise is
rejected and will never be fulfilled. The argument passed to the <i>reject</i> function is used as the rejection value
of the promise. Typically it will be an <code>Error</code> object.</p>
</div>
<p>The resolve and reject functions passed to an <var>executor</var> function by the Promise constructor have the
capability to actually resolve and reject the associated promise. Subclasses may have different constructor behaviour
that passes in customized values for resolve and reject.</p>
</div>
<section id="sec-initializepromise">
<h1><span class="secnum" id="sec-25.4.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializepromise" title="link to this section">25.4.3.1.1</a></span> InitializePromise ( promise, executor )</h1>
<p>The abstract operation InitializePromise initializes a newly allocated <var>promise</var> object using an
<var>executor</var> function.</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>promise</i> has a [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> and it’s value is
<b>undefined.</b></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>executor</i>) is
<b>true</b>.</li>
<li>Set <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to <code>"pending"</code>.</li>
<li>Set <i>promise</i>'s [[PromiseFulfillReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Set <i>promise</i>'s [[PromiseRejectReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to a new empty <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a>.</li>
<li>Let <i>resolvingFunctions</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createresolvingfunctions">CreateResolvingFunctions</a>(<i>promise</i>).</li>
<li>Let <i>completion</i> be the result of calling the [[Call]] internal method of <i>executor</i> with
<b>undefined</b> as <i>thisArgument</i> and (<i>resolvingFunctions</i>.[[Resolve]],
<i>resolvingFunctions</i>.[[Reject]]) as <i>argumentsList</i>.</li>
<li>If <i>completion</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of
<i>resolvingFunctions</i>.[[Reject]] with <b>undefined</b> as <i>thisArgument</i> and
(<i>completion</i>.[[value]]) as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return <i>promise</i>.</li>
</ol>
</section>
</section>
<section id="sec-new-promise-argumentslist">
<h1><span class="secnum" id="sec-25.4.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-promise-argumentslist" title="link to this section">25.4.3.2</a></span> new Promise ( ... argumentsList )</h1>
<p>When <code>Promise</code> is called as part of a <code>new</code> expression it is a constructor: it initializes a
newly created object.</p>
<p><code>Promise</code> called as part of a new expression with argument list <i>argumentsList</i> performs the following
steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the Promise function object on which the <b>new</b> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <b>new</b> operator.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If Promise is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-promise-constructor">
<div class="front">
<h1><span class="secnum" id="sec-25.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-promise-constructor" title="link to this section">25.4.4</a></span> Properties of the Promise Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
<code>Promise</code> constructor is the <code>Function</code> prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is 1), the Promise constructor has the following properties:</p>
</div>
<section id="sec-promise.all">
<div class="front">
<h1><span class="secnum" id="sec-25.4.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.all" title="link to this section">25.4.4.1</a></span>
Promise.all ( iterable )</h1>
<p>The <code>all</code> function returns a new promise which is fulfilled with an array of fulfillment values for the
passed promises, or rejects with the reason of the first passed promise that rejects. It resoves all elements of the
passed iterable to promises as it runs this algorithm.</p>
<ol class="proc">
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>Let <i>promiseCapability</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>iterable</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>iterator</i>, <i>promiseCapability</i>).</li>
<li>Let <i>values</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
<li>Let <i>remainingElementsCount</i> be a new Record { [[value]]: 1 }.</li>
<li>Let <i>index</i> be 0.</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>next</i>, <i>promiseCapability</i>).</li>
<li>If <i>next</i> is <b>false</b>,
<ol class="block">
<li>Set <i>remainingElementsCount</i>.[[value]] to <i>remainingElementsCount</i>.[[value]] - 1.</li>
<li>If <i>remainingElementsCount</i>.[[value]] is 0,
<ol class="block">
<li>Let <i>resolveResult</i> be the result of calling the [[Call]] internal method of
<i>promiseCapability</i>.[[Resolve]] with <b>undefined</b> as <i>thisArgument</i> and (<i>values</i>)
as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>resolveResult</i>).</li>
</ol>
</li>
<li>Return <i>promiseCapability</i>.[[Promise]].</li>
</ol>
</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>nextValue</i>,
<i>promiseCapability</i>).</li>
<li>Let <i>nextPromise</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>C</i>, <code>"resolve"</code>,
(<i>nextValue</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>nextPromise</i>,
<i>promiseCapability</i>).</li>
<li>Let <i>resolveElement</i> be a new built-in function object as defined in Promise.all Resolve Element
Functions.</li>
<li>Set the [[AlreadyCalled]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>resolveElement</i> to <b>false</b>.</li>
<li>Set the [[Index]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>resolveElement</i> to <i>index</i>.</li>
<li>Set the [[Values]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>resolveElement</i> to <i>values</i>.</li>
<li>Set the [[Capabilities]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>resolveElement</i> to <i>promiseCapability</i>.</li>
<li>Set the [[RemainingElements]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>resolveElement</i> to <i>remainingElementsCount</i>.</li>
<li>Set <i>remainingElementsCount</i>.[[value]] to <i>remainingElementsCount</i>.[[value]] + 1.</li>
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>nextPromise</i>, <code>"then"</code>,
(<i>resolveElement</i>, <i>promiseCapability</i>.[[Reject]])).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>result</i>, <i>promiseCapability</i>).</li>
<li>Set <i>index</i> to <i>index</i> + 1.</li>
</ol>
</li>
</ol>
<p class="Note">Note: The <code>all</code> function requires its <b>this</b> value to be a constructor function that
supports the parameter conventions of the <code>Promise</code> constructor.</p>
</div>
<section id="sec-promise.all-resolve-element-functions">
<h1><span class="secnum" id="sec-25.4.4.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.all-resolve-element-functions" title="link to this section">25.4.4.1.1</a></span> Promise.all Resolve Element Functions</h1>
<p>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.all">Promise.all</a> resolve element function is an anonymous built-in function that is used
to resolve a specific <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.all">Promise.all</a> element. Each <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.all">Promise.all</a> resolve element function has [[Index]], [[Values]], [[Capabilities]],
[[RemainingElements]], and [[AlreadyCalled]] internal slots.</p>
<p>When a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.all">Promise.all</a> resolve element function <var>F</var> is called with argument
<var>x</var>, the following steps are taken:</p>
<ol class="proc">
<li>If the value of <i>F</i>'s [[AlreadyCalled]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> is <b>true</b>, then return <b>undefined</b>.</li>
<li>Set the value of <i>F</i>'s [[AlreadyCalled]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <b>true</b>.</li>
<li>Let <i>index</i> be the value of <i>F</i>'s [[Index]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>values</i> be the value of <i>F</i>'s [[Values]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>promiseCapability</i> be the value of <i>F</i>'s [[Capabilities]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>remainingElementsCount</i> be the value of <i>F</i>'s [[RemainingElements]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>values</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>index</i>), <i>x</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>result</i>, <i>promiseCapability</i>).</li>
<li>Set <i>remainingElementsCount</i>.[[value]] to <i>remainingElementsCount</i>.[[value]] - 1.</li>
<li>If <i>remainingElementsCount</i>.[[value]] is 0,
<ol class="block">
<li>Return the result of calling the [[Call]] internal method of <i>promiseCapability</i>.[[Resolve]] with
<b>undefined</b> as <i>thisArgument</i> and (<i>values</i>) as <i>argumentsList</i>.</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
<section id="sec-promise.prototype">
<h1><span class="secnum" id="sec-25.4.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype" title="link to this section">25.4.4.2</a></span> Promise.prototype</h1>
<p>The initial value of <code>Promise.prototype</code> is the Promise prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatepromise">25.4.4.6.1</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-promise.race">
<h1><span class="secnum" id="sec-25.4.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.race" title="link to this section">25.4.4.3</a></span>
Promise.race ( iterable )</h1>
<p>The <code>race</code> function returns a new promise which is settled in the same way as the first passed promise to
settle. It resolves all elements of the passed <span style="font-family: Times New Roman">iterable</span> to promises as
it runs this algorithm.</p>
<ol class="proc">
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>Let <i>promiseCapability</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>iterator</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<i>iterable</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>iterator</i>, <i>promiseCapability</i>).</li>
<li>Repeat
<ol class="block">
<li>Let <i>next</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<i>iterator</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>next</i>, <i>promiseCapability</i>).</li>
<li>If <i>next</i> is <b>false</b>, return <i>promiseCapability</i>.[[Promise]].</li>
<li>Let <i>nextValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<i>next</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>nextValue</i>, <i>promiseCapability</i>).</li>
<li>Let <i>nextPromise</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>C</i>, <code>"resolve"</code>,
(<i>nextValue</i>)).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>nextPromise</i>,
<i>promiseCapability</i>).</li>
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>nextPromise</i>, <code>"then"</code>,
(<i>promiseCapability</i>.[[Resolve]], <i>promiseCapability</i>.[[Reject]])).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a>(<i>result</i>, <i>promiseCapability</i>).</li>
</ol>
</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>race</code> function requires its <b>this</b> value to be a constructor
function that supports the parameter conventions of the <code>Promise</code> constructor. It also requires that its
<b>this</b> value provides a <code>resolve</code> method.</p>
</div>
</section>
<section id="sec-promise.reject">
<h1><span class="secnum" id="sec-25.4.4.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.reject" title="link to this section">25.4.4.4</a></span>
Promise.reject ( r )</h1>
<p>The <code>reject</code> function returns a new promise rejected with the passed argument.</p>
<ol class="proc">
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>Let <i>promiseCapability</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>rejectResult</i> be the result of calling the [[Call]] internal method of <i>promiseCapability</i>.[[Reject]]
with <b>undefined</b> as <i>thisArgument</i> and (r) as <i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>rejectResult</i>).</li>
<li>Return <i>promiseCapability</i>.[[Promise]].</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>reject</code> function requires that its <b>this</b> value to be a constructor
function that supports the parameter conventions of the <code>Promise</code> constructor.</p>
</div>
</section>
<section id="sec-promise.resolve">
<h1><span class="secnum" id="sec-25.4.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.resolve" title="link to this section">25.4.4.5</a></span>
Promise.resolve ( x )</h1>
<p>The <code>resolve</code> function returns either a new promise resolved with the passed argument, or the argument
itself if the argument a promise produced by this construtor.</p>
<ol class="proc">
<li>Let <i>C</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispromise">IsPromise</a>(<i>x</i>) is <b>true</b>,
<ol class="block">
<li>Let <i>constructor</i> be the value of <i>x</i>'s [[PromiseConstructor]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>constructor</i>, <i>C</i>) is <b>true</b>, return <i>x</i>.</li>
</ol>
</li>
<li>Let <i>promiseCapability</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>resolveResult</i> be the result of calling the [[Call]] internal method of
<i>promiseCapability</i>.[[Resolve]] with <b>undefined</b> as <i>thisArgument</i> and (<i>x</i>) as
<i>argumentsList</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>resolveResult</i>).</li>
<li>Return <i>promiseCapability</i>.[[Promise]].</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>resolve</code> function requires that its <b>this</b> value to be a
constructor function that supports the parameter conventions of the <code>Promise</code> constructor.</p>
</div>
</section>
<section id="sec-promise-@@create">
<div class="front">
<h1><span class="secnum" id="sec-25.4.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-@@create" title="link to this section">25.4.4.6</a></span> Promise [ @@create ] ( )</h1>
<p>The @@create method of a Promise function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatepromise">AllocatePromise</a>(<i>F</i>).</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</div>
<section id="sec-allocatepromise">
<h1><span class="secnum" id="sec-25.4.4.6.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-allocatepromise" title="link to this section">25.4.4.6.1</a></span> AllocatePromise ( constructor )</h1>
<p>The abstract operation AllocatePromise allocates a new promise object using the <var>constructor</var> argument.</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>constructor</i>,
<code>"%PromisePrototype%"</code>, ([[PromiseState]], [PromiseConstructor]], [[PromiseResult]],
[[PromiseFulfillReactions]], [PromiseRejectReactions]]) ).</li>
<li>Set the value of <i>obj’s</i> [[PromiseConstructor]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>constructor</i>.</li>
<li>Return <i>obj</i>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-properties-of-the-promise-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-25.4.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-promise-prototype-object" title="link to this section">25.4.5</a></span> Properties of the Promise Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
Promise prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The Promise prototype object is an ordinary object. It
does not have a [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> or any of the
other internal slots of Promise instances.</p>
</div>
<section id="sec-promise.prototype.catch">
<h1><span class="secnum" id="sec-25.4.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype.catch" title="link to this section">25.4.5.1</a></span> Promise.prototype.catch ( onRejected )</h1>
<p>When the <code>catch</code> method is called with argument <var>onRejected</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>promise</i> be the <b>this</b> value.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>promise</i>, <code>"then"</code>, (<b>undefined</b>,
<i>onRejected</i>)).</li>
</ol>
</section>
<section id="sec-promise.prototype.constructor">
<h1><span class="secnum" id="sec-25.4.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype.constructor" title="link to this section">25.4.5.2</a></span> Promise.prototype.constructor</h1>
<p>The initial value of <code>Promise.prototype.constructor</code> is the standard built-in Promise constructor.</p>
</section>
<section id="sec-promise.prototype.then">
<div class="front">
<h1><span class="secnum" id="sec-25.4.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype.then" title="link to this section">25.4.5.3</a></span> Promise.prototype.then ( onFulfilled , onRejected )</h1>
<p>When the <code>then</code> method is called with arguments <var>onFulfilled</var> and <var>onRejected</var> the
following steps are taken:</p>
<ol class="proc">
<li>Let <i>promise</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispromise">IsPromise</a>(<i>promise</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>If <i>onFulfilled</i> is <b>undefined</b> or <b>null</b>, then
<ol class="block">
<li>Let <i>onFulfilled</i> be a new Identity Function (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identity-functions">see 25.4.5.3.1</a>).</li>
</ol>
</li>
<li>If <i>onRejected</i> is <b>undefined</b> or <b>null</b>, then
<ol class="block">
<li>Let <i>onRejected</i> be a new Thrower Function (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-thrower-functions">see 25.4.5.3.3</a>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>onFulfilled) is <b>false</b> or if</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>onRejected) is <b>false</b>, then throw a <b>TypeError</b>
exception.</i></li>
<li>Let <i>C</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>promise</i>, <code>"constructor"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>C</i>).</li>
<li>Let <i>promiseCapability</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>fulfillReaction</i> be the PromiseReaction { [[Capabilities]]: <i>promiseCapability</i>, [[Handler]]:
<i>onFulfilled</i> }.</li>
<li>Let <i>rejectReaction</i> be the PromiseReaction { [[Capabilities]]: <i>promiseCapability</i>, [[Handler]]:
<i>onRejected</i>}.</li>
<li>If the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <span style="font-family:
monospace">"pending"</span>,
<ol class="block">
<li>Append <i>fulfillReaction</i> as the last element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of <i>promise</i>'s
[[PromiseFulfillReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Append <i>rejectReaction</i> as the last element of the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of <i>promise</i>'s
[[PromiseRejectReactions]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</li>
<li>Else if the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <code>"fulfilled"</code>,
<ol class="block">
<li>Let <i>value</i> be the value of <i>promise</i>'s [[PromiseResult]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-enqueuetask">EnqueueTask</a>(<span style="font-family: monospace">"PromiseTasks"</span>,
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisereactiontask">PromiseReactionTask</a>, (<i>fulfillReaction</i>, <i>value</i>)).</li>
</ol>
</li>
<li>Else if the value of <i>promise</i>'s [[PromiseState]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <code>"rejected"</code>,
<ol class="block">
<li>Let <i>reason</i> be the value of <i>promise</i>'s [[PromiseResult]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-enqueuetask">EnqueueTask</a>(<code>"PromiseTasks"</code>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promisereactiontask">PromiseReactionTask</a>, (<i>rejectReaction</i>, <i>reason</i>)).</li>
</ol>
</li>
<li>Return <i>promiseCapability</i>.[[Promise]].</li>
</ol>
</div>
<section id="sec-identity-functions">
<h1><span class="secnum" id="sec-25.4.5.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identity-functions" title="link to this section">25.4.5.3.1</a></span> Identity Functions</h1>
<p>An identify function is an anonymous built-in function that when called with argument <var>x</var>, performs the
following steps:</p>
<ol class="proc">
<li>Return <i>x</i>.</li>
</ol>
</section>
<section id="sec-promise-resolution-handler-functions">
<h1><span class="secnum" id="sec-25.4.5.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-resolution-handler-functions" title="link to this section">25.4.5.3.2</a></span> Promise Resolution Handler Functions</h1>
<p>A promise resolution handler function is an anonymous built-in function that has the ability to handle a promise
being resolved, by "unwrapping" any incoming values until they are no longer promises or thenables and can be passed to
the appropriate fulfillment handler.</p>
<p>Each promise resolution handler function has <span style="font-family: Times New Roman">[[Promise]]</span>, <span style="font-family: Times New Roman">[[FulfillmentHandler]]</span>, and <span style="font-family: Times New
Roman">[[RejectionHandler]]</span> internal slots.</p>
<p>When a promise resolution handler function <var>F</var> is called with argument <var>x</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>promise</i> be the value of <i>F</i>'s [[Promise]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>fulfillmentHandler</i> be the value of <i>F</i>'s [[FulfillmentHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>rejectionHandler</i> be the value of <i>F</i>'s [[RejectionHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>x</i>, <i>promise</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>selfResolutionError</i> be a newly-created <b>TypeError</b> object.</li>
<li>Return the result of calling the [[Call]] internal method of <i>rejectionHandler</i> with <b>undefined</b> as
<i>thisArgument</i> and (<i>selfResolutionError</i>) as <i>argumentsList</i>.</li>
</ol>
</li>
<li>Let <i>C</i> be the value of <i>promise</i>'s [[PromiseConstructor]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>promiseCapability</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-newpromisecapability">NewPromiseCapability</a>(<i>C</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>promiseCapability</i>).</li>
<li>Let <i>updateResult</i> be UpdatePromiseFromPotentialThenable(<i>x</i>, <i>promiseCapability</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>updateResult</i>).</li>
<li>If <i>updateResult</i> is not <code>"not a thenable"</code>, then
<ol class="block">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<i>promiseCapability</i>.[[Promise]], <code>"then"</code>,
(<i>fulfillmentHandler</i>, <i>rejectionHandler</i>)).</li>
</ol>
</li>
<li>Return the result of calling the [[Call]] internal method of <i>fulfillmentHandler</i> with <b>undefined</b> as
<i>thisArgument</i> and (<i>x</i>) as <i>argumentsList</i>.</li>
</ol>
</section>
<section id="sec-thrower-functions">
<h1><span class="secnum" id="sec-25.4.5.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-thrower-functions" title="link to this section">25.4.5.3.3</a></span> Thrower Functions</h1>
<p>A thrower function is an anonymous built-in function that when called with argument <var>e</var>, performs the
following steps:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">Completion</a>{[[type]]: <span style="font-family:
sans-serif">throw</span>, [[value]]: <i>e</i>, [[target]]: <span style="font-family:
sans-serif">empty</span>}.</li>
</ol>
</section>
</section>
<section id="sec-promise.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-25.4.5.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype-@@tostringtag" title="link to this section">25.4.5.4</a></span> Promise.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family:
monospace">Promise</span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
</section>
<section id="sec-properties-of-promise-instances">
<h1><span class="secnum" id="sec-25.4.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-promise-instances" title="link to this section">25.4.6</a></span> Properties of Promise Instances</h1>
<p>Promise instances are ordinary objects that inherit properties from the Promise prototype object (the intrinsic,
%PromiseProtype%). Promise instances are initially created with the internal slots described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-50">Table
50</a>.</p>
<figure>
<figcaption><span id="table-50">Table 50</span> — Internal Slots of Promise Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[PromiseState]]</td>
<td>A string value that governs how a promise will react to incoming calls to its <code>then</code> method. The possible values are: <b>undefined</b>, <code>"pending"</code><span style="font-family: Times New Roman">,</span> <code>"fulfilled"</code>, and <code>"rejected"</code><span style="font-family: Times New Roman">.</span></td>
</tr>
<tr>
<td>[[PromiseConstructor]]</td>
<td>The function object that was used to construct this promise. Checked by the <code>resolve</code> method of the <code>Promise</code> constructor.</td>
</tr>
<tr>
<td>[[PromiseResult]]</td>
<td>The value with which the promise has been fulfilled or rejected, if any. Only meaningful if <span style="font-family: Times New Roman">[[PromiseState]]</span> is not <code>"pending"</code>.</td>
</tr>
<tr>
<td>[[PromiseFulfillReactions]]</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of PromiseReaction records to be processed when/if the promise transitions from the <code>"pending"</code> state to the<code>"fulfilled"</code> state.</td>
</tr>
<tr>
<td>[[PromiseRejectReactions]]</td>
<td>A <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> of PromiseReaction records to be processed when/if the promise transitions from the <code>"pending"</code> state to the<code>"rejected"</code> state..</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-reflection">
<div class="front">
<h1><span class="secnum" id="sec-26"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflection" title="link to this section">26</a></span> Reflection</h1>
</div>
<section id="sec-reflect-object">
<div class="front">
<h1><span class="secnum" id="sec-26.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect-object" title="link to this section">26.1</a></span> The
Reflect Object</h1>
<p>The Reflect object is a single ordinary object.</p>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the Reflect
object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>).</p>
<p>The Reflect object is not a function object. It does not have a [[Construct]] internal method; it is not possible to use
the Reflect object as a constructor with the <code>new</code> operator. The Reflect object also does not have a [[Call]]
internal method; it is not possible to invoke the Reflect object as a function.</p>
</div>
<section id="sec-reflect.defineproperty">
<h1><span class="secnum" id="sec-26.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.defineproperty" title="link to this section">26.1.1</a></span> Reflect.defineProperty ( target, propertyKey, attributes )</h1>
<p>When the <code>defineProperty</code> function is called with arguments <span style="font-family: Times New
Roman"><i>target</i>, <i>propertyKey</i></span>, and <var>attributes</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Let <i>desc</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor">ToPropertyDescriptor</a> with
<i>attributes</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>Return the result of calling the [[DefineOwnProperty]] internal method of <i>obj</i> with arguments <i>key</i>, and
<i>desc</i>.</li>
</ol>
</section>
<section id="sec-reflect.deleteproperty">
<h1><span class="secnum" id="sec-26.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.deleteproperty" title="link to this section">26.1.2</a></span> Reflect.deleteProperty ( target, propertyKey )</h1>
<p>When the <code>deleteProperty</code> function is called with arguments <span style="font-family: Times New
Roman"><i>target</i> and <i>propertyKey</i></span>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Return the result of calling the [[Delete]] internal method of <i>obj</i> with argument <i>key</i>.</li>
</ol>
</section>
<section id="sec-reflect.enumerate">
<h1><span class="secnum" id="sec-26.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.enumerate" title="link to this section">26.1.3</a></span>
Reflect.enumerate ( target )</h1>
<p>When the <code>enumerate</code> function is called with argument <var>target</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>iterator</i> be the result of calling the [[Enumerate]] internal method of <i>obj</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-reflect.get">
<h1><span class="secnum" id="sec-26.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.get" title="link to this section">26.1.4</a></span>
Reflect.get ( target, propertyKey [ , receiver ])</h1>
<p>When the <code>get</code> function is called with arguments <span style="font-family: Times New Roman"><i>target</i>,
<i>propertyKey</i></span>, and <var>receiver</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>If <i>receiver</i> is not present, then
<ol class="nested proc">
<li>Let <i>receiver</i> be <i>target</i>.</li>
</ol>
</li>
<li>Return the result of calling the [[Get]] internal method of <i>obj</i> with arguments <i>key</i>, and
<i>receiver</i>.</li>
</ol>
</section>
<section id="sec-reflect.getownpropertydescriptor">
<h1><span class="secnum" id="sec-26.1.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.getownpropertydescriptor" title="link to this section">26.1.5</a></span> Reflect.getOwnPropertyDescriptor ( target, propertyKey )</h1>
<p>When the <code>getOwnPropertyDescriptor</code> function is called with arguments <span style="font-family: Times New
Roman"><i>target</i> and <i>propertyKey</i></span>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Let <i>desc</i> be the result of calling the [[GetOwnProperty]] internal method of <i>obj</i> with argument
<i>key</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>desc</i>).</li>
<li>Return the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-frompropertydescriptor">FromPropertyDescriptor</a>(<i>desc</i>).</li>
</ol>
</section>
<section id="sec-reflect.getprototypeof">
<h1><span class="secnum" id="sec-26.1.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.getprototypeof" title="link to this section">26.1.6</a></span> Reflect.getPrototypeOf ( target )</h1>
<p>When the <code>getPrototypeOf</code> function is called with argument <var>target</var> the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Return the result of calling the [[GetPrototypeOf]] internal method of <i>obj</i>.</li>
</ol>
</section>
<section id="sec-reflect.has">
<h1><span class="secnum" id="sec-26.1.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.has" title="link to this section">26.1.7</a></span>
Reflect.has ( target, propertyKey )</h1>
<p>When the <code>has</code> function is called with arguments <span style="font-family: Times New Roman"><i>target</i> and
<i>propertyKey</i></span>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Return the result of calling the [[HasProperty]] internal method of <i>obj</i> with argument <i>key</i>.</li>
</ol>
</section>
<section id="sec-reflect.hasown">
<h1><span class="secnum" id="sec-26.1.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.hasown" title="link to this section">26.1.8</a></span>
Reflect.hasOwn (target, propertyKey )</h1>
<p>When the <code>hasOwn</code> function is called with arguments <span style="font-family: Times New Roman"><i>target</i>
and <i>propertyKey</i></span>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-hasownproperty">HasOwnProperty</a>(<i>obj</i>, <i>key</i>).</li>
</ol>
</section>
<section id="sec-reflect.isextensible">
<h1><span class="secnum" id="sec-26.1.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.isextensible" title="link to this section">26.1.9</a></span>
Reflect.isExtensible (target)</h1>
<p>When the <code>isExtensible</code> function is called with argument <var>target</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Return the result of calling the [[IsExtensible]] internal method of <i>obj</i>.</li>
</ol>
</section>
<section id="sec-reflect.ownkeys">
<h1><span class="secnum" id="sec-26.1.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.ownkeys" title="link to this section">26.1.10</a></span>
Reflect.ownKeys ( target )</h1>
<p>When the <code>ownKeys</code> function is called with argument <var>target</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Return the result of calling the [[OwnPropertyKeys]] internal method of <i>obj</i>.</li>
</ol>
</section>
<section id="sec-reflect.preventextensions">
<h1><span class="secnum" id="sec-26.1.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.preventextensions" title="link to this section">26.1.11</a></span> Reflect.preventExtensions ( target )</h1>
<p>When the <code>preventExtensions</code> function is called with argument <var>target</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Return the result of calling the [[PreventExtensions]] internal method of <i>obj</i>.</li>
</ol>
</section>
<section id="sec-reflect.set">
<h1><span class="secnum" id="sec-26.1.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.set" title="link to this section">26.1.12</a></span>
Reflect.set ( target, propertyKey, V [ , receiver ] )</h1>
<p>When the <code>set</code> function is called with arguments <span style="font-family: Times New Roman"><i>target</i>,
<i>V</i>, <i>propertyKey</i></span>, and <var>receiver</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>Let <i>key</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<i>propertyKey</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>key</i>).</li>
<li>If <i>receiver</i> is not present, then
<ol class="nested proc">
<li>Let <i>receiver</i> be <i>target</i>.</li>
</ol>
</li>
<li>Return the result of calling the [[Set]] internal method of <i>obj</i> with arguments <i>key</i>, <i>V</i>, and
<i>receiver</i>.</li>
</ol>
</section>
<section id="sec-reflect.setprototypeof">
<h1><span class="secnum" id="sec-26.1.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.setprototypeof" title="link to this section">26.1.13</a></span> Reflect.setPrototypeOf ( target, proto )</h1>
<p>When the <code>setPrototypeOf</code> function is called with arguments <span style="font-family: Times New
Roman"><i>target</i> and <i>propertyKey</i></span>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>obj</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>(<i>target</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>obj</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>proto</i>) is not Object and <i>proto</i> is not
<b>null</b>, then throw a <b>TypeError</b> exception</li>
<li>Return the result of calling the [[SetPrototypeOf]] internal method of <i>obj</i> with argument <i>proto</i>.</li>
</ol>
</section>
</section>
<section id="sec-realm-objects">
<div class="front">
<h1><span class="secnum" id="sec-26.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-realm-objects" title="link to this section">26.2</a></span> Realm
Objects</h1>
</div>
<section id="sec-reflect.realm-constructor">
<div class="front">
<h1><span class="secnum" id="sec-26.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm-constructor" title="link to this section">26.2.1</a></span> The Reflect.Realm Constructor</h1>
<p>The initialize value of <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> is the %Realm% intrinsic object
<code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> is the constructor for <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>
objects. When <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> is called as a function rather than as a
constructor, it initializes its <b>this</b> value with the internal state necessary to support the
<code>Reflect.Realm.prototype</code> built-in methods.</p>
<p>The <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> constructor is designed to be subclassable. It may be
used as the value in an <code>extends</code> clause of a class definition. Subclass constructors that intend to inherit
the specified <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> behaviour must include a <code>super</code> call to <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code>.</p>
</div>
<section id="sec-reflect.realm">
<h1><span class="secnum" id="sec-26.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm" title="link to this section">26.2.1.1</a></span>
Reflect.Realm ( [ options [ , initializer ] ] )</h1>
<p>When the <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> function is called with optional arguments
<var>options</var> and <var>initializer</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object, throw a
<b>TypeError</b> exception.</li>
<li>If <i>realmObject</i> does not have a [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>evalHooks</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"eval"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>evalHooks</i>).</li>
<li>Let <i>directEval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>evalHooks</i>, <code>"direct"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>directEval</i>).</li>
<li>Let <i>translate</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>directEval</i>, <code>"translate"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>translate</i>).</li>
<li>If <i>translate</i> is not <b>undefined</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>translate</i>) is
<b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>fallback</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>directEval</i>, <code>"fallback"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>fallback</i>).</li>
<li>If <i>fallback</i> is not <b>undefined</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>fallback</i>) is
<b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>indirectEval</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"indirect"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>indirectEval</i>).</li>
<li>If <i>indirectEval</i> is not <b>undefined</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>indirectEval</i>) is
<b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>Function</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"Function"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>Function</i>).</li>
<li>If <i>Function</i> is not <b>undefined</b> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>Function</i>) is
<b>false</b>, throw a <b>TypeError</b> exception.</li>
<li>NOTE the following step ensures that this function was not rentretly applied to <var>realmObject</var> during the
above steps.</li>
<li>If the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createrealm">CreateRealm</a>( ).</li>
<li>Set <i>realm</i>.[[directEvalTranslate]] to <i>translate</i>.</li>
<li>Set <i>realm</i>.[[directEvalFallback]] to <i>fallback</i>.</li>
<li>Set <i>realm</i>.[[indirectEval]] to <i>indirectEval</i>.</li>
<li>Set <i>realm</i>.[[Function]] to <i>Function</i>.</li>
<li>Set <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>realm</i>.</li>
<li>If <i>initializer</i> is not undefined, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<i>initializer</i>) is <b>false</b>, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>status</i> be the result of calling the [[Call]] internal method of the <i>initializer</i> function,
passing <i>realmObject</i> as the <b>this</b> value and <i>builtins</i> as the single argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Return <i>realmObject</i>.</li>
</ol>
</section>
<section id="sec-new-reflect.realm-argumentslist">
<h1><span class="secnum" id="sec-26.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-reflect.realm-argumentslist" title="link to this section">26.2.1.2</a></span> new Reflect.Realm ( ...argumentsList )</h1>
<p>When <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> is called as part of a <code>new</code> expression it is
a constructor: it initializes a newly created object. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the %Realm% function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its [[Construct]] internal method will perform the
above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-reflect.realm-constructor">
<div class="front">
<h1><span class="secnum" id="sec-26.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.realm-constructor" title="link to this section">26.2.2</a></span> Properties of the Reflect.Realm Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
<code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> constructor has the following properties:</p>
</div>
<section id="sec-reflect.realm.prototype">
<h1><span class="secnum" id="sec-26.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm.prototype" title="link to this section">26.2.2.1</a></span> Reflect.Realm.prototype</h1>
<p>The initial value of <code>Reflect.Realm.prototype</code> is the intrinsic %RealmPrototype% object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.realm-prototype-object">26.2.3</a>).</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-reflect.realm-@@create">
<h1><span class="secnum" id="sec-26.2.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm-@@create" title="link to this section">26.2.2.2</a></span> Reflect.Realm [ @@create ] ( )</h1>
<p>The @@create method of a <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> function object <var>F</var>
performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%RealmPrototype%"</code>, ( [[RealmRecord]])).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-reflect.realm-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-26.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.realm-prototype-object" title="link to this section">26.2.3</a></span> Properties of the Reflect.Realm Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
<code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> prototype object is the standard built-in Object prototype
object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> prototype object is an ordinary object. It does not have a [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</div>
<section id="sec-reflect.realm.prototype.constructor">
<h1><span class="secnum" id="sec-26.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm.prototype.constructor" title="link to this section">26.2.3.1</a></span> Reflect.Realm.prototype.constructor</h1>
<p>The initial value of <code>Reflect.Realm.prototype.constructor</code> is the built-in %Realm% constructor.</p>
</section>
<section id="sec-reflect.-realm.prototype.eval-source">
<h1><span class="secnum" id="sec-26.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.-realm.prototype.eval-source" title="link to this section">26.2.3.2</a></span> Reflect. Realm.prototype.eval ( source )</h1>
<p>When <code>Reflect.Realm.prototype.eval</code> is called with arguent <var>source</var> it performs the following
steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or <i>realmObject</i>
does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return the result of IndirectEval(<i>realm,</i> <i>source</i>).</li>
</ol>
</section>
<section id="sec-get-reflect.realm.prototype.global">
<h1><span class="secnum" id="sec-26.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-reflect.realm.prototype.global" title="link to this section">26.2.3.3</a></span> get Reflect.Realm.prototype.global</h1>
<p><code>Reflect.Realm.prototype.global</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or <i>realmObject</i>
does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <i>realm</i>.[[globalThis]].</li>
</ol>
</section>
<section id="sec-get-reflect.realm.prototype.intrinsics">
<h1><span class="secnum" id="sec-26.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-reflect.realm.prototype.intrinsics" title="link to this section">26.2.3.4</a></span> get Reflect.Realm.prototype.intrinsics</h1>
<p><code>Reflect.Realm.prototype.intrinsics</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or <i>realmObject</i>
does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>table</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%).</li>
<li>For each row in Table ???, do
<ol class="nested proc">
<li>Let <i>key</i> be the string value in the row’s “Intrinsic Key” column.</li>
<li>Let <i>object</i> be the intrinsic object for <i>realm</i> described in the row’s “Intrinsic
Object” column.</li>
<li>.Perfrom <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>table</i>, <i>key</i>, <i>object</i>).</li>
</ol>
</li>
<li>Return <i>table</i>.</li>
</ol>
</section>
<section id="sec-get-reflect.realm.prototype.stdlib">
<h1><span class="secnum" id="sec-26.2.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-reflect.realm.prototype.stdlib" title="link to this section">26.2.3.5</a></span> get Reflect.Realm.prototype.stdlib</h1>
<p><code>Reflect.Realm.prototype.stdlib</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or <i>realmObject</i>
does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>props</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%).</li>
<li>For each property of the Global Object specified in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-object">clause 18</a>, , do
<ol class="nested proc">
<li>Let <i>name</i> be the string value of the property name..</li>
<li>Let <i>desc</i> be the fully populated data property descriptor for the property containing the specified
attributes for the property. For propties whose values are functions, the value the of the [[Value]] attribute
is the corresponding intrinsic function object for <i>realm</i>.</li>
<li>Let <i>status</i> be DefinePropertyOrTrhow(<i>props</i>, <i>name</i>, <i>desc</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>)</li>
</ol>
</li>
<li>Return <i>props</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The objects return is suitable for use as the second argument to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperties">Object.defineProperties</a>. A Realms’s global object can be initialized to
with its clause 18 standard values using an expression such as:</p>
<pre><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperties">Object.defineProperties</a>(newRealm.global, newRealm.stdlib);</pre>
</div>
</section>
<section id="sec-reflect.realm.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-26.2.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm.prototype-@@tostringtag" title="link to this section">26.2.3.6</a></span> Reflect.Realm.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"</b> Reflect.<b><span style="font-family:
monospace"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></span>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-realm-subclass-extension-properties">
<div class="front">
<h1><span class="secnum" id="sec-26.2.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-realm-subclass-extension-properties" title="link to this section">26.2.3.7</a></span> Realm Subclass Extension Properties</h1>
<p>The following properties are intended to be over-ridden by subclass.</p>
</div>
<section id="sec-reflect.realm.prototype.directeval">
<h1><span class="secnum" id="sec-26.2.3.7.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm.prototype.directeval" title="link to this section">26.2.3.7.1</a></span> Reflect.Realm.prototype.directEval ( source )</h1>
<p>When <code>Reflect.Realm.prototype.eval</code> is called with arguent <var>source</var> it performs the following
steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or
<i>realmObject</i> does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return IndirectEval(<i>realm,</i> <i>source</i>).</li>
</ol>
</section>
<section>
<h1><span class="secnum" id="sec-26.2.3.7.2">26.2.3.7.2</span> Reflect.Realm.prototype.indirectEval ( source )</h1>
<p>When <code>Reflect.Realm.prototype.eval</code> is called with arguent <var>source</var> it performs the following
steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or
<i>realmObject</i> does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return IndirectEval(<i>realm,</i> <i>source</i>).</li>
</ol>
</section>
<section id="sec-reflect.realm.prototype.initglobal">
<h1><span class="secnum" id="sec-26.2.3.7.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.realm.prototype.initglobal" title="link to this section">26.2.3.7.3</a></span> Reflect.Realm.prototype.initGlobal ( )</h1>
<p>When <code>Reflect.Realm.prototype.eval</code> is called with arguent <var>source</var> it performs the following
steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or
<i>realmObject</i> does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return IndirectEval(<i>realm,</i> <i>source</i>).</li>
</ol>
</section>
<section>
<h1><span class="secnum" id="sec-26.2.3.7.4">26.2.3.7.4</span> Reflect.Realm.prototype.indirectEval ( source )</h1>
<p>When <code>Reflect.Realm.prototype.eval</code> is called with arguent <var>source</var> it performs the following
steps:</p>
<ol class="proc">
<li>Let <i>realmObject</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or
<i>realmObject</i> does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b> exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return IndirectEval(<i>realm,</i> <i>source</i>).</li>
</ol>
</section>
</section>
</section>
<section id="sec-properties-of-reflect.realm-instances">
<h1><span class="secnum" id="sec-26.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-reflect.realm-instances" title="link to this section">26.2.4</a></span> Properties of Reflect.Realm Instances</h1>
<p><code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> instances are ordinary objects that inherit properties from the
<code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> prototype object. <code>Reflect.<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a></code> instances each have a [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
</section>
</section>
<section id="sec-loader-objects">
<div class="front">
<h1><span class="secnum" id="sec-26.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-objects" title="link to this section">26.3</a></span> Loader
Objects</h1>
<p>Loader objects are able to load the source code of an ECMAScript <span class="nt">Module</span> in the context of a
specific <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a>.</p>
</div>
<section id="sec-reflect.loader-reflect.-constructor">
<div class="front">
<h1><span class="secnum" id="sec-26.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader-reflect.-constructor" title="link to this section">26.3.1</a></span> The Reflect.Loader Reflect. Constructor</h1>
<p>The initialize value of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader">Reflect.Loader</a></code> is the %Loader% intrinsic object.
%Loader% is the constructor for Loader objects. When %Loader% is called as a function rather than as a constructor, it
initializes its <b>this</b> value with the internal state necessary to support the %Loader%<code>.prototype</code>
built-in methods.</p>
<p>The %Loader% constructor is designed to be subclassable. It may be used as the value in an <code>extends</code> clause
of a class definition. Subclass constructors that intend to support the specified Loader behaviour must include a
<code>super</code> call to %Loader%.</p>
</div>
<section id="sec-reflect.loader">
<h1><span class="secnum" id="sec-26.3.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader" title="link to this section">26.3.1.1</a></span>
Reflect.Loader ( [ options ] )</h1>
<p>When the Reflect.Loader function is called with optional argument <var>options</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>loader</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>loader</i> does not have a[[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a>, throw a <b>TypeError</b> exception.</li>
<li>If the value of <i>loader</i>’s [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>realmObject</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>,
<code>"realm"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>realmObject</i>).</li>
<li>If <i>realmObject</i> is <b>undefined</b>, let <i>realm</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>.</li>
<li>Else,
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>realmObject</i>) is not Object or
<i>realmObject</i> does not have [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>realm</i> be the value of <i>realmObject</i>’s [[RealmRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>realm</i> is <b>undefined</b>, throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>For each <i>name</i> in the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> (<code>"normalize"</code>,
<code>"locate"</code>, <code>"fetch"</code>, <code>"translate"</code>, <code>"instantiate"</code>),
<ol class="block">
<li>Let <i>hook</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>hook</i>).</li>
<li>If <i>hook</i> is not <b>undefined</b>,
<ol class="block">
<li>If isCallable(<i>hook</i>) is <b>false,</b> throw a <b>TypeError</b> exception.</li>
<li>Let <i>result</i> be CreatePropertyOrThrow(<i>loader</i>, <i>name</i>, <i>hook</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
</ol>
</li>
</ol>
</li>
<li>NOTE the following step ensures that this function was not rentretly applied to <var>realmObject</var> during the
above steps.</li>
<li>If the value of <i>loader</i>’s [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is not <b>undefined</b>, throw a
<b>TypeError</b> exception.</li>
<li>Let <i>loaderRecord</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloaderrecord">CreateLoaderRecord</a>(<i>realm</i>,
<i>loader</i>).</li>
<li>Set <i>loader</i>.[[LoaderRecord]] to <i>loaderRecord</i>.</li>
<li>Return <i>loader</i>.</li>
</ol>
</section>
<section id="sec-new-reflect.loader-argumentslist">
<h1><span class="secnum" id="sec-26.3.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-reflect.loader-argumentslist" title="link to this section">26.3.1.2</a></span> new Reflect.Loader ( ...argumentsList )</h1>
<p>When %Loader% is called as part of a <code>new</code> expression it is a constructor: it initializes a newly created
object. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the %Loader% function object on which the <code>new</code> operator was applied.</li>
<li>Let <i>argumentsList</i> be the <i>argumentsList</i> argument of the [[Construct]] internal method that was invoked
by the <code>new</code> operator.</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist">Construct</a>(<i>F</i>, <i>argumentsList</i>).</li>
</ol>
<p>If %Loader% is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>, its
[[Construct]] internal method will perform the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-loader-constructor">
<div class="front">
<h1><span class="secnum" id="sec-26.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-loader-constructor" title="link to this section">26.3.2</a></span> Properties of the Loader Constructor</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
%Loader% constructor is the Function prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-function-prototype-object">19.2.3</a>).</p>
<p>Besides the <code>length</code> property (whose value is <b>0</b>), the %Loader% constructor has the following
properties:</p>
</div>
<section id="sec-reflect.loader.prototype">
<h1><span class="secnum" id="sec-26.3.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype" title="link to this section">26.3.2.1</a></span> Reflect.Loader.prototype</h1>
<p>The initial value of %Loader%<code>.prototype</code> is the intrinsic %LoaderPrototype% object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.loader-prototype-object">26.3.3</a>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>false</b> }.</p>
</section>
<section id="sec-reflect.loader-@@create">
<h1><span class="secnum" id="sec-26.3.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader-@@create" title="link to this section">26.3.2.2</a></span> Reflect.Loader [ @@create ] ( )</h1>
<p>The @@create method of a %Loader% function object <var>F</var> performs the following steps:</p>
<ol class="proc">
<li>Let <i>F</i> be the <b>this</b> value.</li>
<li>Let <i>obj</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a>(<i>F</i>,
<code>"%LoaderPrototype%"</code>, ([[LoaderRecord]])).</li>
<li>Return <i>obj</i>.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.create]"</code>.</p>
<p>This property has the attributes { [[Writable]]: <b>false</b>, [[Enumerable]]: <b>false</b>, [[Configurable]]:
<b>true</b> }.</p>
</section>
</section>
<section id="sec-properties-of-the-reflect.loader-prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-26.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-reflect.loader-prototype-object" title="link to this section">26.3.3</a></span> Properties of the Reflect.Loader Prototype Object</h1>
<p>The value of the [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of the
%Loader% prototype object is the standard built-in Object prototype object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-object-prototype-object">19.1.3</a>). The %Loader% prototype object is an ordinary object. It
does not have [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>The phrase "<span style="font-family: Times New Roman">this Loader</span>" within the specification of the following
methods refers to the result returned by performing the abstract operation thisLoader with the <b>this</b> value of the
current method invocation passed as the argument.</p>
<p>The abstract operation thisLoader with argument <var>value</var> performs the following steps:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>value</i>) is Object and value has a [[LoaderRecord]]
<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Let <i>r</i> be <i>value</i>’s [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>r</i> is not <b>undefined</b>, then return <i>value</i>.</li>
</ol>
</li>
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</div>
<section id="sec-reflect.loader.prototype.constructor">
<h1><span class="secnum" id="sec-26.3.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.constructor" title="link to this section">26.3.3.1</a></span> Reflect.Loader.prototype.constructor</h1>
<p>The initial value of %Loader<code>.prototype.constructor</code> is the built-in %Loader% constructor.</p>
</section>
<section id="sec-reflect.loader.prototype.define">
<h1><span class="secnum" id="sec-26.3.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.define" title="link to this section">26.3.3.2</a></span> Reflect.Loader.prototype.define ( name, source [ , options ] )</h1>
<p>The <code>define</code> method installs a module in this <var>loader</var>'s module registry for <var>source</var>
using <var>name</var> as the registry key. The module is not immediately available. The <code>translate</code> and
<code>instantiate</code> hooks are called asynchronously, and dependencies are loaded asynchronously. <code>define</code>
returns a Promise object that resolves to <var>undefined</var> when the new module and its dependencies are installed in
the registry.</p>
<p>When the <code>define</code> method is called with arguments <var>name</var>, <var>source</var>, and optional argument
<var>options</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Let <i>address</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"address"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>address</i>).</li>
<li>Let <i>metadata</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"metadata"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>metadata</i>).</li>
<li>If <i>metadata</i> is <i>undefined</i> then let <i>metadata</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(%ObjectPrototype%).</li>
<li>Let <i>p</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promiseofstartloadpartwaythrough">PromiseOfStartLoadPartwayThrough</a>(<code>"translate"</code>,
<i>loaderRecord</i>, <i>name</i>, <i>metadata</i>, <i>source</i>, <i>address</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>p</i>).</li>
<li>Let <i>G</i> be a new function as defined by ReturnUndefined.</li>
<li>Let <i>p</i> be the result of calling PromiseThen(<i>p</i>, <i>G</i>).</li>
<li>Return <i>p</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>define</code> method is <b>2</b>.</p>
</section>
<section id="sec-loader.prototype.delete">
<h1><span class="secnum" id="sec-26.3.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader.prototype.delete" title="link to this section">26.3.3.3</a></span> Loader.prototype.delete ( name )</h1>
<p>The <code>define</code> method remove an entry whose key is <var>name</var> from this <var>loader</var>'s module
registry. It performs the following steps:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Let <i>modules</i> be the value of of <i>loaderRecord</i>. [[Modules]],</li>
<li>Repeat for each Record {[[<i>name</i>]], [[value]]} <i>p</i> that is an element of <i>modules</i>,
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>name</i>), then
<ol class="block">
<li>Set <i>p</i>.[[key]] to <span style="font-family: sans-serif">empty</span>.</li>
<li>Set <i>p</i>.[[value]] to <span style="font-family: sans-serif">empty</span>.</li>
<li>Return <b>true</b>.</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
</section>
<section id="sec-reflect.loader.prototype.entries">
<h1><span class="secnum" id="sec-26.3.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.entries" title="link to this section">26.3.3.4</a></span> Reflect.Loader.prototype.entries ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloaderiterator">CreateLoaderIterator</a>(<i>loader</i>,
<code>"key+value"</code>).</li>
</ol>
</section>
<section id="sec-reflect.loader.prototype.get">
<h1><span class="secnum" id="sec-26.3.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.get" title="link to this section">26.3.3.5</a></span> Reflect.Loader.prototype.get ( name )</h1>
<p>If this Loader's module registry contains a Module with the given normalized <var>name</var>, return it. Otherwise,
return <span class="value">undefined</span>. If the module is in the registry but has never been evaluated, first
synchronously evaluate the bodies of the module and any dependencies that have not evaluated yet.</p>
<p>When the <code>get</code> method is called with the argument <var>name</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Let <i>modules</i> be the value of of <i>loaderRecord.</i>[[ Modules]],</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>modules</i>,
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>name</i>) is <b>true</b>, then
<ol class="block">
<li>Let <i>module</i> be <i>p</i>.[[value]].</li>
<li>Let <i>result</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ensureevaluated">EnsureEvaluated</a>(<i>module</i>,
(),<i>loaderRecord</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>result</i>).</li>
<li>Return <i>p</i>.[[value]].</li>
</ol>
</li>
</ol>
</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
<section id="sec-get-loader.prototype.global">
<h1><span class="secnum" id="sec-26.3.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-loader.prototype.global" title="link to this section">26.3.3.6</a></span> get Loader.prototype.global</h1>
<p><code>Loader.prototype.global</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ul>
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>realm</i> be the value of <i>loaderRecord</i>.[[ Realm]].</li>
<li>Return <i>realm</i>.[[globalThis]].</li>
</ul>
</section>
<section id="sec-reflect.loader.prototype.has">
<h1><span class="secnum" id="sec-26.3.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.has" title="link to this section">26.3.3.7</a></span> Reflect.Loader.prototype.has ( name )</h1>
<p>When the <code>has</code> method is called with argument <var>name</var> the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>Let <i>modules</i> be the value of of <i>loaderRecord.</i>[[ Modules]],</li>
<li>Repeat for each Record {[[key]], [[value]]} <i>p</i> that is an element of <i>modules</i>,
<ol class="nested proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>name</i>) is <b>true</b>, then return
<b>true</b>.</li>
</ol>
</li>
<li>Return <b>false</b>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> This method does not call any hooks or run any module code.</p>
</div>
</section>
<section id="sec-reflect.loader.prototype.import">
<h1><span class="secnum" id="sec-26.3.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.import" title="link to this section">26.3.3.8</a></span> Reflect.Loader.prototype.import ( name [ , options ] )</h1>
<p>The <code>import</code> method asynchronously loads, links, and evaluates a module and all its dependencies if these
actions have not already been performed. The argument <var>name</var> is the registry key for the module.
<code>import</code> returns a Promise that resolves to the <code>Module</code> object once it has been committed to the
registry and evaluated.</p>
<p>When the <code>import</code> method is called with argument <var>name</var> and optional arguments <var>options</var>
the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>p</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loadmodule">LoadModule</a>(<i>loaderRecord</i>, <i>name</i>,
<i>options</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>p</i>).</li>
<li>Let <i>F</i> be a new function object as defined by EvaluateLoadedModule.</li>
<li>Set <i>F</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to
<i>loaderRecord</i>.</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, <i>F</i>).</li>
<li>Return <i>p</i>.</li>
</ol>
<p>If the optional argument <var>options</var> is an object with an <code>address</code> property the string value of that
property is used as the module location and module loading starts with the fetch step. If an <code>address</code> property
is not present, module loading starts with the locate step.</p>
<p>The <code>length</code> property of the <code>import</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> Invoking the <code>import</code> method is the dynamic equivalent (when combined with
normalization) of:<br> <span class="prod"><span class="nt">ImportDeclaration</span> <span class="geq">::</span> <code class="t">import</code> <span class="nt">ModuleSpecifier</span> <code class="t">;</code></span></p>
</div>
</section>
<section id="sec-reflect.loader.prototype.keys">
<h1><span class="secnum" id="sec-26.3.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.keys" title="link to this section">26.3.3.9</a></span> Reflect.Loader.prototype.keys ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloaderiterator">CreateLoaderIterator</a>(<i>loader</i>,
<code>"key"</code>).</li>
</ol>
</section>
<section id="sec-reflect.loader.prototype.load">
<h1><span class="secnum" id="sec-26.3.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.load" title="link to this section">26.3.3.10</a></span> Reflect.Loader.prototype.load ( name [ , options ] )</h1>
<p>The <code>load</code> method asynchronously loads and links and all its dependencies if these actions have not already
been performed. The argument <var>name</var> is the registry key for the module. <code>load</code> returns a Promise that
resolves to the <code>Module</code> object once it has been committed to the registry.</p>
<p>When the <code>load</code> method is called with argument <var>name</var> and optional arguments <var>options</var> the
following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>p</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loadmodule">LoadModule</a>(<i>loaderRecord</i>, <i>name</i>,
<i>options</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>p</i>).</li>
<li>Let <i>p</i> be PromiseThen(<i>p</i>, %ReturnUndefined%).</li>
<li>Return <i>p</i>.</li>
</ol>
<p>If the optional argument <var>options</var> is an object with an <code>address</code> property. The string value of
that property is used as the module location and module loading starts with the fetch step. If an <code>address</code>
property is not present, module loading starts with the locate step.</p>
<p>The <code>length</code> property of the <code>import</code> method is <b>1</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>load</code> method differs from the <code>import</code> method in that it does
not force evaluation of the loaded module.</p>
</div>
</section>
<section id="sec-reflect.loader.prototype.module">
<h1><span class="secnum" id="sec-26.3.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.module" title="link to this section">26.3.3.11</a></span> Reflect.Loader.prototype.module ( source, options )</h1>
<p>The <code>module</code> method asynchronously loads, links, and evaluates an anonymous module from <var>source</var>.
The module's dependencies, if any, are loaded and committed to the registry. The anonymous module itself is not added to
the registry. <code>module</code> returns a Promise object that resolves to a new Module instance object once the given
module body has been evaluated.</p>
<p>When the <code>module</code> method is called with argument <var>source</var> and optional arguments <var>options</var>
the following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>address</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getoption">GetOption</a>(<i>options</i>, <code>"address"</code>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>address</i>).</li>
<li>Let <i>load</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createload">CreateLoad</a>(<b>undefined</b>).</li>
<li>Set <i>load</i>.[[Address]] field of <i>load</i> to <i>address</i>.</li>
<li>Let <i>linkSet</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createlinkset">CreateLinkSet</a>(<i>loaderRecord</i>, <i>load</i>).</li>
<li>Let <i>successCallback</i> be a new function object as defined by EvaluateLoadedModule.</li>
<li>Set <i>successCallback</i>’s [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>loaderRecord</i>.</li>
<li>Set <i>successCallback</i>’s [[Load]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to <i>load</i>.</li>
<li>Let <i>p</i> be the result of calling PromiseThen(<i>linkSet</i>.[[Done]], <i>successCallback</i>).</li>
<li>Let <i>sourcePromise</i> be PromiseOf(<i>source</i>).</li>
<li>Perform <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proceedtotranslate">ProceedToTranslate</a>(<i>loaderRecord</i>, <i>load</i>,
<i>sourcePromise</i>).</li>
<li>Return <i>p</i>.</li>
</ol>
<p>If the optional argument <var>options</var> is an object with an <code>address</code> property.</p>
<p>The <code>length</code> property of the <code>module</code> method is <b>1</b>.</p>
</section>
<section id="sec-reflect.loader.prototype.newmodule">
<h1><span class="secnum" id="sec-26.3.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.newmodule" title="link to this section">26.3.3.12</a></span> Reflect.Loader.prototype.newModule ( obj )</h1>
<p style="background-color: #FFC000">TO DO</p>
<p style="background-color: #FFC000">In the prototype this is the Module Factory Function. However, this factory seems to
have only specialized utility and it seems to unnecessarily clutter the “global” namespace of Module
abstractions. Making it a method of module loaders seems like a more sanity thing to do, but we can break it out if
that;s what people really want.</p>
<p style="background-color: #FFC000">Also need to reconcile with are execute factory returns by the instantiate hook. Is
this method intended to be able as an execute factory. If sho it probably needs to accept multiple arguments.</p>
<p>When the <code>newModule</code> method is called with argument <var>obj</var> it creates a new Module objects whose
export properties are derived form the properties of <var>obj</var>. The following steps are performed:</p>
<ol class="proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>obj</i>) is not Object, throw a TypeError
exception.</li>
<li>Let <i>mod</i> be CreateLinkedModuleInstance( )</li>
<li>Let <i>keys</i> be the result of calling the ObjectKeys abstract operation passing <i>obj</i> as the argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>keys</i>).
<ol class="nested proc">
<li>For each <i>key</i> in <i>keys</i>, do</li>
<li>Let <i>value</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>obj</i>, <i>key</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>value</i>).</li>
<li>Let <i>F</i> be the result of calling CreateConstantGetter(<i>key</i>, <i>value</i>).</li>
<li>Let <i>desc</i> be the PropertyDescriptor {[[Configurable]]: <b>false</b>, [[Enumerable]]: <b>true</b>, [[Get]]:
<i>F</i>, [[Set]]: <b>undefined</b>}.</li>
<li>Let <i>status</i> be the result of calling the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>
abstract operation passing <i>mod</i>, <i>key</i>, and <i>desc</i> as arguments.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
</ol>
</li>
<li>Call the [[PreventExtensions]] internal method of <i>mod</i>.</li>
<li>Return <i>mod</i>.</li>
</ol>
</section>
<section id="sec-get-reflect.loader.prototype.realm">
<h1><span class="secnum" id="sec-26.3.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-reflect.loader.prototype.realm" title="link to this section">26.3.3.13</a></span> get Reflect.Loader.prototype.realm</h1>
<p><code>Loader.prototype.realm</code> is an accessor property whose set accessor function is <span class="value">undefined</span>. Its get accessor function performs the following steps:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Return RealmObjectFor(<i>loaderRecord</i>.[[Realm]]).</li>
</ol>
</section>
<section id="sec-reflect.loader.prototype.set">
<h1><span class="secnum" id="sec-26.3.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.set" title="link to this section">26.3.3.14</a></span> Reflect.Loader.prototype.set ( name, module )</h1>
<p>Store a <span style="font-family: Times New Roman">Module obj</span> in this Loader's <var>module</var> registry,
overwriting any existing entry with the same <var>name</var>.</p>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Let <i>loaderRecord</i> be <i>loader’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>name</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>name</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>name</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>module</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>Let <i>modules</i> be the value of of <i>loaderRecord.</i>[[ Modules]],</li>
<li>Repeat for each Record {[[ key]], [[value]]} <i>p</i> that is an element of <i>modules</i>,
<ol class="nested proc">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue">SameValue</a>(<i>p</i>.[[key]], <i>name</i>) is <b>true</b>, then
<ol class="nested proc">
<li>Set <i>p</i>.[[value]] to <i>module</i>.</li>
<li>Return <i>loader</i>.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>p</i> be the Record {[[key]]: <i>name</i>, [[value]]: <i>module</i>}.</li>
<li>Append <i>p</i> as the last record of <i>loaderRecord</i>.[[ Modules]].</li>
<li>Return <i>loader</i>.</li>
</ol>
</section>
<section id="sec-reflect.loader.prototype.values">
<h1><span class="secnum" id="sec-26.3.3.15"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.values" title="link to this section">26.3.3.15</a></span> Reflect.Loader.prototype.values ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Let <i>loader</i> be this Loader.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>loader</i>).</li>
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloaderiterator">CreateLoaderIterator</a>(<i>loader</i>,
<code>"value"</code>).</li>
</ol>
</section>
<section id="sec-reflect.loader.prototype-@@iterator">
<h1><span class="secnum" id="sec-26.3.3.16"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype-@@iterator" title="link to this section">26.3.3.16</a></span> Reflect.Loader.prototype[@@iterator] ( )</h1>
<p>The initial value of the @@iterator property is the same function object as the initial value of the
<code>entries</code> property.</p>
</section>
<section id="sec-reflect.loader.prototype-@@tostringtag">
<h1><span class="secnum" id="sec-26.3.3.17"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype-@@tostringtag" title="link to this section">26.3.3.17</a></span> Reflect.Loader.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader">Reflect.Loader</a>"</b>.</p>
<p>This property has the attributes { [[Writable]]: <span class="value">false</span>, [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }.</p>
</section>
<section id="sec-reflect.loader-pipeline-hook-properties">
<div class="front">
<h1><span class="secnum" id="sec-26.3.3.18"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader-pipeline-hook-properties" title="link to this section">26.3.3.18</a></span> Reflect.Loader Pipeline Hook Properties</h1>
<p>Loader hooks are methods that are called at various points in the process of loading a module. The %Loader% prototype
provide default implementations for the hook methods. However, individual Loader object may over-ride these defaults
using own properties.</p>
</div>
<section id="sec-reflect.-reflect.loader.prototype.normalize-name-referername-refereraddress">
<h1><span class="secnum" id="sec-26.3.3.18.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.-reflect.loader.prototype.normalize-name-referername-refereraddress" title="link to this section">26.3.3.18.1</a></span> Reflect. Reflect.Loader.prototype.normalize ( name, refererName,
refererAddress )</h1>
<p>When the <code>normalize</code> loader hook is called with arguments <var>name</var>, <var>refererName</var>, and
<var>refererAddress</var> <var>loadRequest</var>, the following steps are taken:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>name</i>) is String.</li>
<li>Return <i>name</i>.</li>
</ol>
<p>This is a Loader hook that may be over-riden by an own property of Loader instances. The <code>normalize</code> hook
is called once per distinct <span class="nt">ModuleSpecifier</span> String value in a <span class="nt">ModuleBody</span>, while the module <span class="nt">ModuleBody</span> with that is being loaded. The
<var>name</var> argument is the StringValue of a <span class="nt">ModuleSpecifier</span>.</p>
<p>The <code>normalize</code> hook returns an eventual String, the normalized module name, which is used for the rest of
the import process. In particular, the [[Loads]] and [[Modules]] Lists of a ModuleLinkage record are both keyed by
normalized module names. The module registry contains at most one module for a given normalized module name.</p>
<p>After calling this hook, if the normalized module <var>name</var> is in the registry or the load table, no new Load
Record is created. Otherwise the loader initialtes a load for that module that starts by calling the <code>locate</code>
hook.</p>
</section>
<section id="sec-reflect.loader.prototype.locate">
<h1><span class="secnum" id="sec-26.3.3.18.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.locate" title="link to this section">26.3.3.18.2</a></span> Reflect.Loader.prototype.locate ( loadRequest )</h1>
<p>When the locate method is called with argument <var>loadRequest</var> the following steps are taken:</p>
<ol class="proc">
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>loadRequest</i>, <code>"name"</code>).</li>
</ol>
<p>This is a Loader hook that may be over-riden by an own property of Loader instances. The <code>locate</code> hook is
called for each distinct normalized import <span class="nt">ModuleSpecifier</span> immediately after the
<code>normalize</code> hook returns successfully, unless the module is already loaded or loading.</p>
<p>The <code>locate</code> hook is called to obtain to determine the Loader-dependent resource address (URL, path, etc.)
corresponding to normalized module name. The resource address is used later in the Loader pipeline to retrive the source
code of the requested module.</p>
<p>When a <code>locate</code> hook is called by an Loader object the argument <var>loadRequest</var> is a LoadRequest
object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-load-records-and-loadrequest-objects">15.2.3.2</a>). The value of the <code>name</code> property
is the normalized module name. The <code>locate</code> hook returns an eventual value that is used as the resource
address. When the returned value is resolved, loading will continue with the <code>fetch</code> hook.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>System.locate</code> hook typically is significantly more complicated than
the default <code>locate</code> hook.</p>
</div>
</section>
<section id="sec-reflect.loader.prototype.fetch">
<h1><span class="secnum" id="sec-26.3.3.18.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.fetch" title="link to this section">26.3.3.18.3</a></span> Reflect.Loader.prototype.fetch ( loadRequest )</h1>
<p>When the <code>fetch</code> loader hook is called with argument <var>loadRequest</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Throw a TypeError exception.</li>
</ol>
<p>This is a Loader hook that will normally be over-riden by an own property of Loader instances. The <code>fetch</code>
hook is called by a Loader for all modules whose source code was not directly provided to the Loader. It is also used to
process the <code>import</code> keyword. The <code>fetch</code> hook is not called for module bodies directly provided
as arguments to <code>loader.module()</code> or <code>loader.define()</code>. However, the <code>fetch</code> hook may
be called when loading other modules imported by such modules.</p>
<p>When a <code>fetch</code> hook is called by an Loader object the argument <var>loadRequest</var> is a LoadRequest
object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-load-records-and-loadrequest-objects">15.2.3.2</a>) with an <code>address</code> property. The
value of the <code>address</code> property identifies the module source code to fetch. The fetch hook returns an
eventual String containing the source code of the module.</p>
</section>
<section id="sec-reflect.loader.prototype.translate">
<h1><span class="secnum" id="sec-26.3.3.18.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.translate" title="link to this section">26.3.3.18.4</a></span> Reflect.Loader.prototype.translate ( load )</h1>
<p>When the translate method is called, the following steps are taken:</p>
<ol class="proc">
<li>Return the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<i>load</i>, <code>"source"</code>).</li>
</ol>
<p>This is a <code>Loader</code> hook that may be over-riden by an own property of Loader instances. The
<code>translate</code> hook is called for each <span class="nt">ModuleBody</span> including those passed to
<code>loader.module()</code> or <code>loader.define()</code>.The <code>translate</code> hook is called prior to parsing
the <span class="nt">ModuleBody</span> and provides a Loader the opportunity to modify or replace the source code that
will be parse.</p>
<div class="note">
<p><span class="nh">NOTE</span> An example of the use of the <code>translate</code> hook would be to translate source
code for a another programing language into an ECMAScript <i>ModuleBody</i>.</p>
</div>
<p>When a <code>translate</code> hook is called by an Loader object the argument <var>loadRequest</var> is a LoadRequest
object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-load-records-and-loadrequest-objects">15.2.3.2</a>) with <code>address</code> and
<code>source</code> properties. The value of the <code>address</code> property identifies the module source code to
fetch. The value of the <code>source</code> property is the resolved value returned from the <code>fetch</code> hook.
The <code>translate</code> hook returns either an eventual String value ECMAScript that will be parsed as a <span class="nt">ModuleBody</span>.</p>
</section>
<section id="sec-reflect.loader.prototype.instantiate">
<h1><span class="secnum" id="sec-26.3.3.18.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.instantiate" title="link to this section">26.3.3.18.5</a></span> Reflect.Loader.prototype.instantiate ( loadRequest )</h1>
<p>When the instantiate loader hook is called with argument <var>loadRequest</var>, the following steps are taken:</p>
<ol class="proc">
<li>Return <b>undefined</b>.</li>
</ol>
<p>This hook allows a Loader to provide interoperability with other module systems.</p>
<p>When a <code>instantiate</code> hook is called by an Loader object the argument, <var>loadRequest</var>, is a
LoadRequest object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-load-records-and-loadrequest-objects">15.2.3.2</a>) with <code>address</code> and
<code>source</code> properties. <var>loadRequest</var><code>.name</code>, <var>loadRequest</var><code>.metadata</code>,
and <var>loadRequest</var><code>.address</code> are the same values passed to the <code>fetch</code> and
<code>translate</code> hooks. <var>loadRequest</var><code>.source</code> is the the value produced by the
<code>translate</code> hook.</p>
<p>If the <code>instantiate</code> hook returns an eventual <b>undefined</b>, then the loader uses the default linking
behavior. It parses <var>loadRequest</var><code>.source</code> as a Module, looks at its imports, loads its dependencies
asynchronously, and finally links them together and adds them to the registry.</p>
<p>Otherwise, the <code>instantiate</code> hook must return an eventual <var>instantiationRequest</var> object. An
<var>instantiateRequest</var> object has two required properties. The value of the <code>deps</code> property is an
array of strings. Each string is the name of a module upon which the module identified by <var>loadRequest</var> has
dependencies. The value of the <code>execute</code> property is a function which the loader will use to create the
module and link it with its clients and dependencies. The function should expect to receive the same number of arguments
as the size of the <code>deps</code> array and must return an eventual Module object. The arguments are Module objects
and have a one-to-one correspondence with elements of the <code>deps</code> array.</p>
<p>The module is evaluated during the linking process. First all of the modules it depends upon are linked and evaluated
, and then passed to the <code>execute</code> function. Then the resulting module is linked with the downstream
dependencies.</p>
<div class="note">
<p><span class="nh">NOTE</span> This feature is provided in order to permit custom loaders to support using
<code>import</code> to import pre-ES6 modules such as AMD modules. The design requires incremental linking when such
modules are present, but it ensures that modules implemented with standard source-level module declarations can still
be statically validated.</p>
</div>
</section>
</section>
</section>
<section id="sec-properties-of-reflect.loader-instances">
<h1><span class="secnum" id="sec-26.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-reflect.loader-instances" title="link to this section">26.3.4</a></span> Properties of Reflect.Loader Instances</h1>
<p>Loader instances are ordinary objects that inherit properties from the %LoaderPrototype% intrinsic object. Loader
instances each have a [[Loader]] interal slot whose value after initialization is the Loader Record that the Load instance
reflects.</p>
</section>
<section id="sec-loader-iterator-objects">
<div class="front">
<h1><span class="secnum" id="sec-26.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-loader-iterator-objects" title="link to this section">26.3.5</a></span> Loader Iterator Objects</h1>
<p>A Loader Iterator object represents a specific iteration over the module registry of some specific Loader instance
object. There is not a named constructor for Loader Iterator objects. Instead, Loader iterator objects are created by
calling certain methods of Loader instance objects.</p>
</div>
<section id="sec-createloaderiterator">
<h1><span class="secnum" id="sec-26.3.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createloaderiterator" title="link to this section">26.3.5.1</a></span> CreateLoaderIterator Abstract Operation</h1>
<p>Several methods of Loader objects return Iterator objects. The abstract operation CreateLoaderIterator with arguments
<var>loader</var> and <var>kind</var> is used to create such iterator objects. It performs the following steps:</p>
<ol class="proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>loader</i> is an initialized Loader instance object.</li>
<li>Let <i>iterator</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>(<span style="font-family:
sans-serif">%LoaderIteratorPrototype%</span>, ([[Loader]], [[LoaderNextIndex]], [[LoaderIterationKind]])).</li>
<li>Set <i>iterator’s</i> [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
to <i>loader</i>.</li>
<li>Set <i>iterator’s</i> [[Loader NextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> to 0.</li>
<li>Set <i>iterator’s</i> [[Loader IterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>kind</i>.</li>
<li>Return <i>iterator</i>.</li>
</ol>
</section>
<section id="sec-%loaderteratorprototype%-object">
<div class="front">
<h1><span class="secnum" id="sec-26.3.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%loaderteratorprototype%-object" title="link to this section">26.3.5.2</a></span> The %LoaderteratorPrototype% Object</h1>
<p>All Loader Iterator Objects inherit properties from the %LoaderIteratorPrototype% intrinsic object. The
%LoaderIteratorPrototype% intrinsic object is an ordinary object and its [[Prototype]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is the %ObjectPrototype% intrinsic object. In
addition, %LoaderIteratorPrototype% has the following properties:</p>
</div>
<section id="sec-%loaderiteratorprototype%.next">
<h1><span class="secnum" id="sec-26.3.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%loaderiteratorprototype%.next" title="link to this section">26.3.5.2.1</a></span> %LoaderIteratorPrototype%.next ( )</h1>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object, throw a <b>TypeError</b>
exception.</li>
<li>If <i>O</i> does not have all of the internal slots of a Loader Iterator Instance (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-loader-iterator-instances">26.3.5.3</a>), throw a <b>TypeError</b> exception.</li>
<li>Let <i>m</i> be the value of the [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of <i>O</i>.</li>
<li>Let <i>loaderRecord</i> be <i>m’s</i> [[LoaderRecord]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>index</i> be the value of the [[LoaderNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>Let <i>itemKind</i> be the value of the [[LoaderIterationKind]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i>.</li>
<li>If <i>m</i> is <b>undefined</b>, then return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
<li>Let <i>entries</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-list-and-record-specification-type">List</a> that is the value of the
<i>loaderRecord</i>.[[Modules]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>m</i>.</li>
<li>Repeat while <i>index</i> is less than the total number of elements of <i>entries</i>. The number of elements must
be redetermined each time this method is evaluated.
<ol class="nested proc">
<li>Let <i>e</i> be the Record {[[key]], [[value]]} that is the value of <i>entries</i>[<i>index</i>].</li>
<li>Set <i>index</i> to <i>index</i>+1;</li>
<li>Set the [[LoaderNextIndex]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>O</i> to <i>index</i>.</li>
<li>If <i>e</i>.[[key]] is not <span style="font-family: sans-serif">empty</span>, then
<ol class="nested proc">
<li>If <i>itemKind</i> is <b>"<span style="font-family: monospace">key</span>"</b> then, let <i>result</i> be
<i>e</i>.[[key]].</li>
<li>Else if <i>itemKind</i> is <b>"<span style="font-family: monospace">value</span>"</b> then, let
<i>result</i> be <i>e</i>.[[value]].</li>
<li>Else,
<ol class="nested proc">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>itemKind</i> is <code>"key+value"</code>.</li>
<li>Let <i>result</i> be the result of performing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(2).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>result</i> is a new, well-formed Array object so
the following operations will never fail.</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family: monospace">0</span>"</b>, <i>e</i>.[[key]]) .</li>
<li>Call <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <b>"<span style="font-family: monospace">1</span>"</b>, <i>e</i>.[[value]]).</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<i>result</i>, <b>false</b>).</li>
</ol>
</li>
</ol>
</li>
<li>Set the [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>O</i> to
<b>undefined</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createiterresultobject">CreateIterResultObject</a>(<b>undefined</b>, <b>true</b>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> Setting the [[Loader]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to undefined when the iterator is exhausted
ensures that the same iterator can not restarted if new entries are subsequently added. This condition is tested in
step 7.</p>
</div>
</section>
<section id="sec-%loaderiteratorprototype%-@@iterator">
<h1><span class="secnum" id="sec-26.3.5.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%loaderiteratorprototype%-@@iterator" title="link to this section">26.3.5.2.2</a></span> %LoaderIteratorPrototype% [ @@iterator ] ( )</h1>
<p>The following steps are taken:</p>
<ol class="proc">
<li>Return the <b>this</b> value.</li>
</ol>
<p>The value of the <code>name</code> property of this function is <code>"[Symbol.iterator]"</code>.</p>
</section>
<section id="sec-%loaderteratorprototype%-@@tostringtag">
<h1><span class="secnum" id="sec-26.3.5.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-%loaderteratorprototype%-@@tostringtag" title="link to this section">26.3.5.2.3</a></span> %LoaderteratorPrototype% [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the string value <b>"<span style="font-family: monospace">Loader
Iterator</span>"</b>.</p>
</section>
</section>
<section id="sec-properties-of-loader-iterator-instances">
<h1><span class="secnum" id="sec-26.3.5.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-loader-iterator-instances" title="link to this section">26.3.5.3</a></span> Properties of Loader Iterator Instances</h1>
<p>Loader Iterator instances are ordinary objects that inherit properties from the %LoaderIteratorPrototype% intrinsic
object. Loader Iterator instances are initially created with the internal slots described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#table-51">Table
51</a>.</p>
<figure>
<figcaption><span id="table-51">Table 51</span> — Internal Slots of Loader Iterator Instances</figcaption>
<table class="real-table">
<tbody><tr>
<th style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 2px solid #000000">Internal Slot</th>
<th style="border-bottom: 1px solid #000000; border-left: 0px solid black; border-right: 1px solid #000000; border-top: 2px solid #000000">Description</th>
</tr>
<tr>
<td>[[Loader]]</td>
<td>The Loader object that is being iterated.</td>
</tr>
<tr>
<td>[[LoaderNextIndex]]</td>
<td>The integer index of the next Loader registry data element to be examined by this iterator.</td>
</tr>
<tr>
<td>[[LoaderterationKind]]</td>
<td>A string value that identifies what is to be returned for each element of the iteration. The possible values are: <b>"<span style="font-family: monospace">key</span>"</b>, <b>"<span style="font-family: monospace">value</span>"</b>, <b>"<span style="font-family: monospace">key+value</span>"</b>.</td>
</tr>
</tbody></table>
</figure>
</section>
</section>
</section>
<section id="sec-system-object">
<h1><span class="secnum" id="sec-26.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-system-object" title="link to this section">26.4</a></span> The System
Object</h1>
<p>The System object is the Loader Object instance associated with the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms">Realm</a> of the current
global object.</p>
</section>
<section id="sec-proxy-objects">
<div class="front">
<h1><span class="secnum" id="sec-26.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-objects" title="link to this section">26.5</a></span> Proxy
Objects</h1>
</div>
<section id="sec-proxy-constructor-function">
<div class="front">
<h1><span class="secnum" id="sec-26.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-constructor-function" title="link to this section">26.5.1</a></span> The Proxy Constructor Function</h1>
<p>The Proxy Constructor is a Built-in Function with unique [[Construct]] behavior. It is not intended to be
subclassed.</p>
<p>The Proxy Constructor does not have a <code>prototype</code> property.</p>
<p>The value of the <code>length</code> property of the Proxy Constructor is 2.</p>
</div>
<section id="sec-proxy-target-handler">
<h1><span class="secnum" id="sec-26.5.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-target-handler" title="link to this section">26.5.1.1</a></span> Proxy ( target, handler )</h1>
<p>The <code>Proxy</code> function is not intended to be directly called as a function. If it is called, the following
steps are performed:</p>
<ol class="proc">
<li>Throw a TypeError exception.</li>
</ol>
</section>
<section id="sec-new-proxy-target-handler">
<h1><span class="secnum" id="sec-26.5.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-new-proxy-target-handler" title="link to this section">26.5.1.2</a></span> new Proxy ( target, handler )</h1>
<p>When <code>Proxy</code> is called as part of a <code>new</code> expression it is a constructor: it creates and
initializes a new exotic proxy object. <code>Proxy</code> called as part of a new expression with arguments
<var>target</var> and <var>handler</var> performs the following steps:</p>
<ol class="proc">
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxycreate">ProxyCreate</a>(<i>target</i>, <i>handler</i>).</li>
</ol>
<p>If <code>Proxy</code> is implemented as an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>,
it most have a [[Construct]] internal method that performs the above steps.</p>
</section>
</section>
<section id="sec-properties-of-the-proxy-constructor-function">
<div class="front">
<h1><span class="secnum" id="sec-26.5.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-proxy-constructor-function" title="link to this section">26.5.2</a></span> Properties of the Proxy Constructor Function</h1>
</div>
<section id="sec-proxy.revocable">
<div class="front">
<h1><span class="secnum" id="sec-26.5.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy.revocable" title="link to this section">26.5.2.1</a></span> Proxy.revocable ( target, handler )</h1>
<p>The <code>Proxy.revocable</code> function is used to create a revocable Proxy object. When
<code>Proxy.revocable</code> is called with arguments <var>target</var> and <var>handler</var> the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>p</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxycreate">ProxyCreate</a>(<i>target</i>, <i>handler</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>p</i>).</li>
<li>Let <i>revoker</i> be a new built-in function object as defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-revocation-functions">26.5.2.1.1</a>.</li>
<li>Set the [[RevokableProxy]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
<i>revoker</i> to <i>p</i>.</li>
<li>Let <i>result</i> be the result of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-objectcreate">ObjectCreate</a>().</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <code>"proxy"</code>, <i>p</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdataproperty">CreateDataProperty</a>(<i>result</i>, <code>"revoke"</code>,
<i>revoker</i>).</li>
<li>Return <i>result</i>.</li>
</ol>
</div>
<section id="sec-proxy-revocation-functions">
<h1><span class="secnum" id="sec-26.5.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-revocation-functions" title="link to this section">26.5.2.1.1</a></span> Proxy Revocation Functions</h1>
<p>A Proxy revocation function is an anonymous function that has the ability to invalidate a specific Proxy object.</p>
<p>Each Proxy revocation function has a [[RevokableProxy]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</p>
<p>When a Proxy revocation function, <var>F</var>, is called the following steps are taken:</p>
<ol class="proc">
<li>Let <i>p</i> be the value of <i>F</i>’s [[RevokableProxy]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>p</i> is <b>null</b>, then return <b>undefined</b>.</li>
<li>Set the value of <i>F</i>’s [[RevokableProxy]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <b>null</b>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>p</i> is a Proxy object.</li>
<li>Set the [[ProxyTarget]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>p</i> to
<b>null</b>.</li>
<li>Set the [[ProxyHandler]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of <i>p</i>
to <b>null</b>.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
</section>
</section>
</section>
<section id="sec-grammar-summary">
<div class="front">
<h1><span class="secnum" id="sec-A"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grammar-summary" title="link to this section">Annex&nbsp;A</a></span> <span class="section-status">(informative)</span> Grammar Summary</h1>
<p style="background-color: #FFC000"><b>TODO: The Grammars in the Annex have not yet been updated for ES6. For now, see the
grammars in the main body of the specification.</b></p>
</div>
<section>
<h1>Lexical Grammar</h1>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">See clause 6</a></div>
<div class="lhs"><span class="nt">SourceCharacter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="gprose">any Unicode code unit</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations">See clause 7</a></div>
<div class="lhs"><span class="nt">InputElementDiv</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
<div class="rhs"><span class="nt">Comment</span></div>
<div class="rhs"><span class="nt">Token</span></div>
<div class="rhs"><span class="nt">DivPunctuator</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations">See clause 7</a></div>
<div class="lhs"><span class="nt">InputElementRegExp</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
<div class="rhs"><span class="nt">Comment</span></div>
<div class="rhs"><span class="nt">Token</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-testing-and-comparison-operations">See 7.2</a></div>
<div class="lhs"><span class="nt">WhiteSpace</span> <span class="geq">::</span> </div>
<div class="rhs">&lt;TAB&gt;</div>
<div class="rhs">&lt;VT&gt;</div>
<div class="rhs">&lt;FF&gt;</div>
<div class="rhs">&lt;SP&gt;</div>
<div class="rhs">&lt;NBSP&gt;</div>
<div class="rhs">&lt;BOM&gt;</div>
<div class="rhs">&lt;USP&gt;</div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-objects">See 7.3</a></div>
<div class="lhs"><span class="nt">LineTerminator</span> <span class="geq">::</span> </div>
<div class="rhs">&lt;LF&gt;</div>
<div class="rhs">&lt;CR&gt;</div>
<div class="rhs">&lt;LS&gt;</div>
<div class="rhs">&lt;PS&gt;</div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-objects">See 7.3</a></div>
<div class="lhs"><span class="nt">LineTerminatorSequence</span> <span class="geq">::</span> </div>
<div class="rhs">&lt;LF&gt;</div>
<div class="rhs">&lt;CR&gt; <span class="grhsannot">[lookahead ∉ &lt;LF&gt; ]</span></div>
<div class="rhs">&lt;LS&gt;</div>
<div class="rhs">&lt;PS&gt;</div>
<div class="rhs">&lt;CR&gt; &lt;LF&gt;</div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">Comment</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">MultiLineComment</span></div>
<div class="rhs"><span class="nt">SingleLineComment</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">MultiLineComment</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">/*</code> <span class="nt">MultiLineCommentChars</span><sub>opt</sub> <code class="t">*/</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">MultiLineCommentChars</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">MultiLineNotAsteriskChar</span> <span class="nt">MultiLineCommentChars</span><sub>opt</sub></div>
<div class="rhs"><code class="t">*</code> <span class="nt">PostAsteriskCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">PostAsteriskCommentChars</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">MultiLineNotForwardSlashOrAsteriskChar</span> <span class="nt">MultiLineCommentChars</span><sub>opt</sub></div>
<div class="rhs"><code class="t">*</code> <span class="nt">PostAsteriskCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">MultiLineNotAsteriskChar</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <code class="t">*</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">MultiLineNotForwardSlashOrAsteriskChar</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">/</code> <span class="grhsmod">or</span> <code class="t">*</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">SingleLineComment</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">//</code> <span class="nt">SingleLineCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">SingleLineCommentChars</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SingleLineCommentChar</span> <span class="nt">SingleLineCommentChars</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-iterator-objects">See 7.4</a></div>
<div class="lhs"><span class="nt">SingleLineCommentChar</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-operations-on-promise-objects">See 7.5</a></div>
<div class="lhs"><span class="nt">Token</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">Punctuator</span></div>
<div class="rhs"><span class="nt">NumericLiteral</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">Identifier</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">IdentifierName</span> <span class="grhsmod">but not</span> <span class="nt">ReservedWord</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">IdentifierName</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">IdentifierStart</span></div>
<div class="rhs"><span class="nt">IdentifierName</span> <span class="nt">IdentifierPart</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">IdentifierStart</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">UnicodeLetter</span></div>
<div class="rhs"><code class="t">$</code></div>
<div class="rhs"><code class="t">_</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">UnicodeEscapeSequence</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">IdentifierPart</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">IdentifierStart</span></div>
<div class="rhs"><span class="nt">UnicodeCombiningMark</span></div>
<div class="rhs"><span class="nt">UnicodeDigit</span></div>
<div class="rhs"><span class="nt">UnicodeConnectorPunctuation</span></div>
<div class="rhs">&lt;ZWNJ&gt;</div>
<div class="rhs">&lt;ZWJ&gt;</div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">UnicodeLetter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="gprose">any character in the Unicode categories “Uppercase letter (Lu)”, “Lowercase letter (Ll)”, “Titlecase letter (Lt)”, “Modifier letter (Lm)”, “Other letter (Lo)”, or “Letter number (Nl)”.</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">UnicodeCombiningMark</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="gprose">any character in the Unicode categories “Non-spacing mark (Mn)” or “Combining spacing mark (Mc)”</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">UnicodeDigit</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="gprose">any character in the Unicode category “Decimal number (Nd)”</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6</div>
<div class="lhs"><span class="nt">UnicodeConnectorPunctuation</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="gprose">any character in the Unicode category “Connector punctuation (Pc)”</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6.1</div>
<div class="lhs"><span class="nt">ReservedWord</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">Keyword</span></div>
<div class="rhs"><span class="nt">FutureReservedWord</span></div>
<div class="rhs"><span class="nt">NullLiteral</span></div>
<div class="rhs"><span class="nt">BooleanLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.6.1.1</div>
<div class="lhs"><span class="nt">Keyword</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
</div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">break</span></td>
<td><span style="font-family: monospace">do</span></td>
<td><span style="font-family: monospace">instanceof</span></td>
<td><span style="font-family: monospace">typeof</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">case</span></td>
<td><span style="font-family: monospace">else</span></td>
<td><span style="font-family: monospace">new</span></td>
<td><span style="font-family: monospace">var</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">catch</span></td>
<td><span style="font-family: monospace">finally</span></td>
<td><span style="font-family: monospace">return</span></td>
<td><span style="font-family: monospace">void</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">continue</span></td>
<td><span style="font-family: monospace">for</span></td>
<td><span style="font-family: monospace">switch</span></td>
<td><span style="font-family: monospace">while</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">debugger</span></td>
<td><span style="font-family: monospace">function</span></td>
<td><span style="font-family: monospace">this</span></td>
<td><span style="font-family: monospace">with</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">default</span></td>
<td><span style="font-family: monospace">if</span></td>
<td><span style="font-family: monospace">throw</span></td>
<td></td>
</tr>
<tr>
<td><span style="font-family: monospace">delete</span></td>
<td><span style="font-family: monospace">in</span></td>
<td><span style="font-family: monospace">try</span></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="gp">
<div class="gsumxref">See 7.6.1.2</div>
<div class="lhs"><span class="nt">FutureReservedWord</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
</div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">class</span></td>
<td><span style="font-family: monospace">enum</span></td>
<td><span style="font-family: monospace">extends</span></td>
<td><span style="font-family: monospace">super</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">const</span></td>
<td><span style="font-family: monospace">export</span></td>
<td><span style="font-family: monospace">import<br></span></td>
<td></td>
</tr>
</tbody></table>
</figure>
<p>The following tokens are also considered to be <span class="nt">FutureReservedWords</span> when parsing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see 10.2.1</a>).</p>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">implements</span></td>
<td><span style="font-family: monospace">let</span></td>
<td><span style="font-family: monospace">private</span></td>
<td><span style="font-family: monospace">public</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">interface</span></td>
<td><span style="font-family: monospace">package</span></td>
<td><span style="font-family: monospace">protected</span></td>
<td><span style="font-family: monospace">static</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">yield</span></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="gp">
<div class="gsumxref">See 7.7</div>
<div class="lhs"><span class="nt">Punctuator</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
</div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">{</span></td>
<td><span style="font-family: monospace">}</span></td>
<td><span style="font-family: monospace">(</span></td>
<td><span style="font-family: monospace">)</span></td>
<td><span style="font-family: monospace">[</span></td>
<td><span style="font-family: monospace">]</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">.</span></td>
<td><span style="font-family: monospace">;</span></td>
<td><span style="font-family: monospace">,</span></td>
<td><span style="font-family: monospace">&lt;</span></td>
<td><span style="font-family: monospace">&gt;</span></td>
<td><span style="font-family: monospace">&lt;=</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">&gt;=</span></td>
<td><span style="font-family: monospace">==</span></td>
<td><span style="font-family: monospace">!=</span></td>
<td><span style="font-family: monospace">===</span></td>
<td><span style="font-family: monospace">!==</span></td>
<td></td>
</tr>
<tr>
<td><span style="font-family: monospace">+</span></td>
<td><span style="font-family: monospace">-</span></td>
<td><span style="font-family: monospace">*</span></td>
<td><span style="font-family: monospace">%</span></td>
<td><span style="font-family: monospace">++</span></td>
<td><span style="font-family: monospace">--</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">&lt;&lt;</span></td>
<td><span style="font-family: monospace">&gt;&gt;</span></td>
<td><span style="font-family: monospace">&gt;&gt;&gt;</span></td>
<td><span style="font-family: monospace">&amp;</span></td>
<td><span style="font-family: monospace">|</span></td>
<td><span style="font-family: monospace">^</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">!</span></td>
<td><span style="font-family: monospace">~</span></td>
<td><span style="font-family: monospace">&amp;&amp;</span></td>
<td><span style="font-family: monospace">||</span></td>
<td><span style="font-family: monospace">?</span></td>
<td><span style="font-family: monospace">:</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">=</span></td>
<td><span style="font-family: monospace">+=</span></td>
<td><span style="font-family: monospace">-=</span></td>
<td><span style="font-family: monospace">*=</span></td>
<td><span style="font-family: monospace">%=</span></td>
<td><span style="font-family: monospace">&lt;&lt;=</span></td>
</tr>
<tr>
<td><span style="font-family: monospace">&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&gt;&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&amp;=</span></td>
<td><span style="font-family: monospace">|=</span></td>
<td><span style="font-family: monospace">^=</span></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="gp">
<div class="gsumxref">See 7.7</div>
<div class="lhs"><span class="nt">DivPunctuator</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
</div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">/</span></td>
<td><span style="font-family: monospace">/=</span></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
</figure>
<div class="gp">
<div class="gsumxref">See 7.8</div>
<div class="lhs"><span class="nt">Literal</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">NullLiteral</span></div>
<div class="rhs"><span class="nt">BooleanLiteral</span></div>
<div class="rhs"><span class="nt">NumericLiteral</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
<div class="rhs"><span class="nt">RegularExpressionLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.1</div>
<div class="lhs"><span class="nt">NullLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">null</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.2</div>
<div class="lhs"><span class="nt">BooleanLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">true</code></div>
<div class="rhs"><code class="t">false</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">NumericLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalLiteral</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">DecimalLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalIntegerLiteral</span> <code class="t">.</code> <span class="nt">DecimalDigits</span><sub>opt</sub> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">DecimalIntegerLiteral</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">DecimalIntegerLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">0</code></div>
<div class="rhs"><span class="nt">NonZeroDigit</span> <span class="nt">DecimalDigits</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">DecimalDigits</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">DecimalDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">NonZeroDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">ExponentPart</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">ExponentIndicator</span> <span class="nt">SignedInteger</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">ExponentIndicator</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">e</code> <code class="t">E</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">SignedInteger</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">DecimalDigits</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">HexIntegerLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">0x</code> <span class="nt">HexDigit</span></div>
<div class="rhs"><code class="t">0X</code> <span class="nt">HexDigit</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.3</div>
<div class="lhs"><span class="nt">HexDigit</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code> <code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">StringLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">"</code> <span class="nt">DoubleStringCharacters</span><sub>opt</sub> <code class="t">"</code></div>
<div class="rhs"><code class="t">'</code> <span class="nt">SingleStringCharacters</span><sub>opt</sub> <code class="t">'</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">DoubleStringCharacters</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DoubleStringCharacter</span> <span class="nt">DoubleStringCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">SingleStringCharacters</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SingleStringCharacter</span> <span class="nt">SingleStringCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">DoubleStringCharacter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">"</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">EscapeSequence</span></div>
<div class="rhs"><span class="nt">LineContinuation</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">SingleStringCharacter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">'</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></div>
<div class="rhs"><code class="t">\</code> <span class="nt">EscapeSequence</span></div>
<div class="rhs"><span class="nt">LineContinuation</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">LineContinuation</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">\</code> <span class="nt">LineTerminatorSequence</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">EscapeSequence</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">CharacterEscapeSequence</span></div>
<div class="rhs"><code class="t">0</code> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
<div class="rhs"><span class="nt">HexEscapeSequence</span></div>
<div class="rhs"><span class="nt">UnicodeEscapeSequence</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">CharacterEscapeSequence</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SingleEscapeCharacter</span></div>
<div class="rhs"><span class="nt">NonEscapeCharacter</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">SingleEscapeCharacter</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">'</code> <code class="t">"</code> <code class="t">\</code> <code class="t">b</code> <code class="t">f</code> <code class="t">n</code> <code class="t">r</code> <code class="t">t</code> <code class="t">v</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">NonEscapeCharacter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <span class="nt">EscapeCharacter</span> <span class="grhsmod">or</span> <span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">EscapeCharacter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SingleEscapeCharacter</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><code class="t">x</code></div>
<div class="rhs"><code class="t">u</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">HexEscapeSequence</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">x</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.4</div>
<div class="lhs"><span class="nt">UnicodeEscapeSequence</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">u</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionLiteral</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">/</code> <span class="nt">RegularExpressionBody</span> <code class="t">/</code> <span class="nt">RegularExpressionFlags</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionBody</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">RegularExpressionFirstChar</span> <span class="nt">RegularExpressionChars</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionChars</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">RegularExpressionChars</span> <span class="nt">RegularExpressionChar</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionFirstChar</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="grhsmod">but not one of</span> <code class="t">*</code> <span class="grhsmod">or</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">/</code> <span class="grhsmod">or</span> <code class="t">[</code></div>
<div class="rhs"><span class="nt">RegularExpressionBackslashSequence</span></div>
<div class="rhs"><span class="nt">RegularExpressionClass</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionChar</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="grhsmod">but not</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">/</code> <span class="grhsmod">or</span> <code class="t">[</code></div>
<div class="rhs"><span class="nt">RegularExpressionBackslashSequence</span></div>
<div class="rhs"><span class="nt">RegularExpressionClass</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionBackslashSequence</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">\</code> <span class="nt">RegularExpressionNonTerminator</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionClass</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">[</code> <span class="nt">RegularExpressionClassChars</span> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionClassChars</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">RegularExpressionClassChars</span> <span class="nt">RegularExpressionClassChar</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionClassChar</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">RegularExpressionNonTerminator</span> <span class="grhsmod">but not</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">\</code></div>
<div class="rhs"><span class="nt">RegularExpressionBackslashSequence</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 7.8.5</div>
<div class="lhs"><span class="nt">RegularExpressionFlags</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">RegularExpressionFlags</span> <span class="nt">IdentifierPart</span></div>
</div>
</section>
<section>
<h1>Number Conversions</h1>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">StringNumericLiteral</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">StrWhiteSpace</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">StrWhiteSpace</span><sub>opt</sub> <span class="nt">StrNumericLiteral</span> <span class="nt">StrWhiteSpace</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">StrWhiteSpace</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">StrWhiteSpaceChar</span> <span class="nt">StrWhiteSpace</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">StrWhiteSpaceChar</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">WhiteSpace</span></div>
<div class="rhs"><span class="nt">LineTerminator</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">StrNumericLiteral</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">StrDecimalLiteral</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">StrDecimalLiteral</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">StrUnsignedDecimalLiteral</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">StrUnsignedDecimalLiteral</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">StrUnsignedDecimalLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">StrUnsignedDecimalLiteral</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">Infinity</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <code class="t">.</code> <span class="nt">DecimalDigits</span><sub>opt</sub> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><code class="t">.</code> <span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">ExponentPart</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">DecimalDigits</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">DecimalDigits</span> <span class="nt">DecimalDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">DecimalDigit</span> <span class="geq">:::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">ExponentPart</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">ExponentIndicator</span> <span class="nt">SignedInteger</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">ExponentIndicator</span> <span class="geq">:::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">e</code> <code class="t">E</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">SignedInteger</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">DecimalDigits</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">DecimalDigits</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">HexIntegerLiteral</span> <span class="geq">:::</span> </div>
<div class="rhs"><code class="t">0x</code> <span class="nt">HexDigit</span></div>
<div class="rhs"><code class="t">0X</code> <span class="nt">HexDigit</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 9.1.3.1</div>
<div class="lhs"><span class="nt">HexDigit</span> <span class="geq">:::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code> <code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code> <code class="t">8</code> <code class="t">9</code> <code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code></div>
</div>
</section>
<section>
<h1>Expressions</h1>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unicode-format-control-characters">See 11.1</a></div>
<div class="lhs"><span class="nt">PrimaryExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">this</code></div>
<div class="rhs"><span class="nt">Identifier</span></div>
<div class="rhs"><span class="nt">Literal</span></div>
<div class="rhs"><span class="nt">ArrayLiteral</span></div>
<div class="rhs"><span class="nt">ObjectLiteral</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.4</div>
<div class="lhs"><span class="nt">ArrayLiteral</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">[</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">ElementList</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <span class="nt">ElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.4</div>
<div class="lhs"><span class="nt">ElementList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">ElementList</span> <code class="t">,</code> <span class="nt">Elision</span><sub>opt</sub> <span class="nt">AssignmentExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.4</div>
<div class="lhs"><span class="nt">Elision</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">,</code></div>
<div class="rhs"><span class="nt">Elision</span> <code class="t">,</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.5</div>
<div class="lhs"><span class="nt">ObjectLiteral</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">{</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">PropertyDefinitionList</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.5</div>
<div class="lhs"><span class="nt">PropertyDefinitionList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">PropertyDefinition</span></div>
<div class="rhs"><span class="nt">PropertyDefinitionList</span> <code class="t">,</code> <span class="nt">PropertyDefinition</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.5</div>
<div class="lhs"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><code class="t">get</code> <span class="nt">PropertyName</span> <code class="t">(</code> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">set</code> <span class="nt">PropertyName</span> <code class="t">(</code> <span class="nt">PropertySetParameterList</span> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.5</div>
<div class="lhs"><span class="nt">PropertyName</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">IdentifierName</span></div>
<div class="rhs"><span class="nt">StringLiteral</span></div>
<div class="rhs"><span class="nt">NumericLiteral</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.1.5</div>
<div class="lhs"><span class="nt">PropertySetParameterList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Identifier</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">See 11.2</a></div>
<div class="lhs"><span class="nt">MemberExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">PrimaryExpression</span></div>
<div class="rhs"><span class="nt">FunctionExpression</span></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">MemberExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
<div class="rhs"><code class="t">new</code> <span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">See 11.2</a></div>
<div class="lhs"><span class="nt">NewExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">MemberExpression</span></div>
<div class="rhs"><code class="t">new</code> <span class="nt">NewExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">See 11.2</a></div>
<div class="lhs"><span class="nt">CallExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">MemberExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <span class="nt">Arguments</span></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">[</code> <span class="nt">Expression</span> <code class="t">]</code></div>
<div class="rhs"><span class="nt">CallExpression</span> <code class="t">.</code> <span class="nt">IdentifierName</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">See 11.2</a></div>
<div class="lhs"><span class="nt">Arguments</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">(</code> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <span class="nt">ArgumentList</span> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">See 11.2</a></div>
<div class="lhs"><span class="nt">ArgumentList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">ArgumentList</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-white-space">See 11.2</a></div>
<div class="lhs"><span class="nt">LeftHandSideExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">NewExpression</span></div>
<div class="rhs"><span class="nt">CallExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-line-terminators">See 11.3</a></div>
<div class="lhs"><span class="nt">PostfixExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">++</code></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <code class="t">--</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comments">See 11.4</a></div>
<div class="lhs"><span class="nt">UnaryExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">PostfixExpression</span></div>
<div class="rhs"><code class="t">delete</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">void</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">typeof</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">++</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">--</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">+</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">-</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">~</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><code class="t">!</code> <span class="nt">UnaryExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tokens">See 11.5</a></div>
<div class="lhs"><span class="nt">MultiplicativeExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">*</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">/</code> <span class="nt">UnaryExpression</span></div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span> <code class="t">%</code> <span class="nt">UnaryExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-names-and-keywords">See 11.6</a></div>
<div class="lhs"><span class="nt">AdditiveExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">MultiplicativeExpression</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">+</code> <span class="nt">MultiplicativeExpression</span></div>
<div class="rhs"><span class="nt">AdditiveExpression</span> <code class="t">-</code> <span class="nt">MultiplicativeExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-punctuators">See 11.7</a></div>
<div class="lhs"><span class="nt">ShiftExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&lt;&lt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
<div class="rhs"><span class="nt">ShiftExpression</span> <code class="t">&gt;&gt;&gt;</code> <span class="nt">AdditiveExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-lexical-grammar-literals">See 11.8</a></div>
<div class="lhs"><span class="nt">RelationalExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&lt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">&gt;=</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">instanceof</code> <span class="nt">ShiftExpression</span></div>
<div class="rhs"><span class="nt">RelationalExpression</span> <code class="t">in</code> <span class="nt">ShiftExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-automatic-semicolon-insertion">See 11.9</a></div>
<div class="lhs"><span class="nt">EqualityExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">==</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!=</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">===</code> <span class="nt">RelationalExpression</span></div>
<div class="rhs"><span class="nt">EqualityExpression</span> <code class="t">!==</code> <span class="nt">RelationalExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.10</div>
<div class="lhs"><span class="nt">BitwiseANDExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">EqualityExpression</span></div>
<div class="rhs"><span class="nt">BitwiseANDExpression</span> <code class="t">&amp;</code> <span class="nt">EqualityExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.10</div>
<div class="lhs"><span class="nt">BitwiseXORExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">BitwiseANDExpression</span></div>
<div class="rhs"><span class="nt">BitwiseXORExpression</span> <code class="t">^</code> <span class="nt">BitwiseANDExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.10</div>
<div class="lhs"><span class="nt">BitwiseORExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">BitwiseXORExpression</span></div>
<div class="rhs"><span class="nt">BitwiseORExpression</span> <code class="t">|</code> <span class="nt">BitwiseXORExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.11</div>
<div class="lhs"><span class="nt">LogicalANDExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">BitwiseORExpression</span></div>
<div class="rhs"><span class="nt">LogicalANDExpression</span> <code class="t">&amp;&amp;</code> <span class="nt">BitwiseORExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.11</div>
<div class="lhs"><span class="nt">LogicalORExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">LogicalANDExpression</span></div>
<div class="rhs"><span class="nt">LogicalORExpression</span> <code class="t">||</code> <span class="nt">LogicalANDExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.12</div>
<div class="lhs"><span class="nt">ConditionalExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">LogicalORExpression</span></div>
<div class="rhs"><span class="nt">LogicalORExpression</span> <code class="t">?</code> <span class="nt">AssignmentExpression</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.13</div>
<div class="lhs"><span class="nt">AssignmentExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">ConditionalExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <code class="t">=</code> <span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">LeftHandSideExpression</span> <span class="nt">AssignmentOperator</span> <span class="nt">AssignmentExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 11.13</div>
<div class="lhs"><span class="nt">AssignmentOperator</span> <span class="geq">:</span> <span class="grhsmod">one of</span> </div>
</div>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td><span style="font-family: monospace">*=</span></td>
<td><span style="font-family: monospace">/=</span></td>
<td><span style="font-family: monospace">%=</span></td>
<td><span style="font-family: monospace">+=</span></td>
<td><span style="font-family: monospace">-=</span></td>
<td><span style="font-family: monospace">&lt;&lt;=</span></td>
<td><span style="font-family: monospace">&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&gt;&gt;&gt;=</span></td>
<td><span style="font-family: monospace">&amp;=</span></td>
<td><span style="font-family: monospace">^=</span></td>
<td><span style="font-family: monospace">|=</span></td>
</tr>
</tbody></table>
</figure>
<div class="gp">
<div class="gsumxref">See 11.14</div>
<div class="lhs"><span class="nt">Expression</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">AssignmentExpression</span></div>
<div class="rhs"><span class="nt">Expression</span> <code class="t">,</code> <span class="nt">AssignmentExpression</span></div>
</div>
</section>
<section>
<h1>Statements</h1>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-expressions">See clause 12</a></div>
<div class="lhs"><span class="nt">Statement</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Block</span></div>
<div class="rhs"><span class="nt">VariableStatement</span></div>
<div class="rhs"><span class="nt">EmptyStatement</span></div>
<div class="rhs"><span class="nt">ExpressionStatement</span></div>
<div class="rhs"><span class="nt">IfStatement</span></div>
<div class="rhs"><span class="nt">IterationStatement</span></div>
<div class="rhs"><span class="nt">ContinueStatement</span></div>
<div class="rhs"><span class="nt">BreakStatement</span></div>
<div class="rhs"><span class="nt">ReturnStatement</span></div>
<div class="rhs"><span class="nt">WithStatement</span></div>
<div class="rhs"><span class="nt">LabelledStatement</span></div>
<div class="rhs"><span class="nt">SwitchStatement</span></div>
<div class="rhs"><span class="nt">ThrowStatement</span></div>
<div class="rhs"><span class="nt">TryStatement</span></div>
<div class="rhs"><span class="nt">DebuggerStatement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers">See 12.1</a></div>
<div class="lhs"><span class="nt">Block</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">{</code> <span class="nt">StatementList</span><sub>opt</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers">See 12.1</a></div>
<div class="lhs"><span class="nt">StatementList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Statement</span></div>
<div class="rhs"><span class="nt">StatementList</span> <span class="nt">Statement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression">See 12.2</a></div>
<div class="lhs"><span class="nt">VariableStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">var</code> <span class="nt">VariableDeclarationList</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression">See 12.2</a></div>
<div class="lhs"><span class="nt">VariableDeclarationList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">VariableDeclaration</span></div>
<div class="rhs"><span class="nt">VariableDeclarationList</span> <code class="t">,</code> <span class="nt">VariableDeclaration</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression">See 12.2</a></div>
<div class="lhs"><span class="nt">VariableDeclaration</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Identifier</span> <span class="nt">Initialiser</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression">See 12.2</a></div>
<div class="lhs"><span class="nt">Initialiser</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">=</code> <span class="nt">AssignmentExpression</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-left-hand-side-expressions">See 12.3</a></div>
<div class="lhs"><span class="nt">EmptyStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-postfix-expressions">See 12.4</a></div>
<div class="lhs"><span class="nt">ExpressionStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="grhsannot">[lookahead ∉ {<code class="t">{</code>, <code class="t">function</code>}]</span> <span class="nt">Expression</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unary-operators">See 12.5</a></div>
<div class="lhs"><span class="nt">IfStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span> <code class="t">else</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">if</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-multiplicative-operators">See 12.6</a></div>
<div class="lhs"><span class="nt">IterationStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">do</code> <span class="nt">Statement</span> <code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">while</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">VariableDeclarationList</span> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">;</code> <span class="nt">Expression</span><sub>opt</sub> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <span class="nt">LeftHandSideExpression</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
<div class="rhs"><code class="t">for</code> <code class="t">(</code> <code class="t">var</code> <span class="nt">VariableDeclaration</span> <code class="t">in</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additive-operators">See 12.7</a></div>
<div class="lhs"><span class="nt">ContinueStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">continue</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">continue</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Identifier</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-bitwise-shift-operators">See 12.8</a></div>
<div class="lhs"><span class="nt">BreakStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">break</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">break</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Identifier</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-relational-operators">See 12.9</a></div>
<div class="lhs"><span class="nt">ReturnStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">return</code> <code class="t">;</code></div>
<div class="rhs"><code class="t">return</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-equality-operators">See 12.10</a></div>
<div class="lhs"><span class="nt">WithStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">with</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">Statement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators">See 12.11</a></div>
<div class="lhs"><span class="nt">SwitchStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">switch</code> <code class="t">(</code> <span class="nt">Expression</span> <code class="t">)</code> <span class="nt">CaseBlock</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators">See 12.11</a></div>
<div class="lhs"><span class="nt">CaseBlock</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">CaseClauses</span><sub>opt</sub> <span class="nt">DefaultClause</span> <span class="nt">CaseClauses</span><sub>opt</sub> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators">See 12.11</a></div>
<div class="lhs"><span class="nt">CaseClauses</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">CaseClause</span></div>
<div class="rhs"><span class="nt">CaseClauses</span> <span class="nt">CaseClause</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators">See 12.11</a></div>
<div class="lhs"><span class="nt">CaseClause</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">case</code> <span class="nt">Expression</span> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-bitwise-operators">See 12.11</a></div>
<div class="lhs"><span class="nt">DefaultClause</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">default</code> <code class="t">:</code> <span class="nt">StatementList</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-binary-logical-operators">See 12.12</a></div>
<div class="lhs"><span class="nt">LabelledStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Identifier</span> <code class="t">:</code> <span class="nt">Statement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-conditional-operator">See 12.13</a></div>
<div class="lhs"><span class="nt">ThrowStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">throw</code> <span class="grhsannot">[no <span class="nt">LineTerminator</span> here]</span> <span class="nt">Expression</span> <code class="t">;</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">See 12.14</a></div>
<div class="lhs"><span class="nt">TryStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span></div>
<div class="rhs"><code class="t">try</code> <span class="nt">Block</span> <span class="nt">Finally</span></div>
<div class="rhs"><code class="t">try</code> <span class="nt">Block</span> <span class="nt">Catch</span> <span class="nt">Finally</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">See 12.14</a></div>
<div class="lhs"><span class="nt">Catch</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">catch</code> <code class="t">(</code> <span class="nt">Identifier</span> <code class="t">)</code> <span class="nt">Block</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">See 12.14</a></div>
<div class="lhs"><span class="nt">Finally</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">finally</code> <span class="nt">Block</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-comma-operator">See 12.15</a></div>
<div class="lhs"><span class="nt">DebuggerStatement</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">debugger</code> <code class="t">;</code></div>
</div>
</section>
<section>
<h1>Functions and Scripts</h1>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations">See clause 13</a></div>
<div class="lhs"><span class="nt">FunctionDeclaration</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">function</code> <span class="nt">Identifier</span> <code class="t">(</code> <span class="nt">FormalParameterList</span><sub>opt</sub> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations">See clause 13</a></div>
<div class="lhs"><span class="nt">FunctionExpression</span> <span class="geq">:</span> </div>
<div class="rhs"><code class="t">function</code> <span class="nt">Identifier</span><sub>opt</sub> <code class="t">(</code> <span class="nt">FormalParameterList</span><sub>opt</sub> <code class="t">)</code> <code class="t">{</code> <span class="nt">FunctionBody</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations">See clause 13</a></div>
<div class="lhs"><span class="nt">FormalParameterList</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Identifier</span></div>
<div class="rhs"><span class="nt">FormalParameterList</span> <code class="t">,</code> <span class="nt">Identifier</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-statements-and-declarations">See clause 13</a></div>
<div class="lhs"><span class="nt">FunctionBody</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">SourceElements</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-functions-and-classes">See clause 14</a></div>
<div class="lhs"><span class="nt">Program</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">SourceElements</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-functions-and-classes">See clause 14</a></div>
<div class="lhs"><span class="nt">SourceElements</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">SourceElement</span></div>
<div class="rhs"><span class="nt">SourceElements</span> <span class="nt">SourceElement</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-functions-and-classes">See clause 14</a></div>
<div class="lhs"><span class="nt">SourceElement</span> <span class="geq">:</span> </div>
<div class="rhs"><span class="nt">Statement</span></div>
<div class="rhs"><span class="nt">FunctionDeclaration</span></div>
</div>
</section>
<section>
<h1>Universal Resource Identifier Character Classes</h1>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uri</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">uriCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriCharacters</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">uriCharacter</span> <span class="nt">uriCharacters</span><sub>opt</sub></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriCharacter</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">uriReserved</span></div>
<div class="rhs"><span class="nt">uriUnescaped</span></div>
<div class="rhs"><span class="nt">uriEscaped</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriReserved</span> <span class="geq">:::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">;</code> <code class="t">/</code> <code class="t">?</code> <code class="t">:</code> <code class="t">@</code> <code class="t">&amp;</code> <code class="t">=</code> <code class="t">+</code> <code class="t">$</code> <code class="t">,</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriUnescaped</span> <span class="geq">:::</span> </div>
<div class="rhs"><span class="nt">uriAlpha</span></div>
<div class="rhs"><span class="nt">DecimalDigit</span></div>
<div class="rhs"><span class="nt">uriMark</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriEscaped</span> <span class="geq">:::</span> </div>
<div class="rhs"><code class="t">%</code> <span class="nt">HexDigit</span> <span class="nt">HexDigit</span></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriAlpha</span> <span class="geq">:::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">g</code> <code class="t">h</code> <code class="t">i</code> <code class="t">j</code> <code class="t">k</code> <code class="t">l</code> <code class="t">m</code> <code class="t">n</code> <code class="t">o</code> <code class="t">p</code> <code class="t">q</code> <code class="t">r</code> <code class="t">s</code> <code class="t">t</code> <code class="t">u</code> <code class="t">v</code> <code class="t">w</code> <code class="t">x</code> <code class="t">y</code> <code class="t">z</code></div>
<div class="rhs"><code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code> <code class="t">G</code> <code class="t">H</code> <code class="t">I</code> <code class="t">J</code> <code class="t">K</code> <code class="t">L</code> <code class="t">M</code> <code class="t">N</code> <code class="t">O</code> <code class="t">P</code> <code class="t">Q</code> <code class="t">R</code> <code class="t">S</code> <code class="t">T</code> <code class="t">U</code> <code class="t">V</code> <code class="t">W</code> <code class="t">X</code> <code class="t">Y</code> <code class="t">Z</code></div>
</div>
<div class="gp">
<div class="gsumxref"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-scripts-static-semantics-lexicallydeclarednames">See 15.1.3</a></div>
<div class="lhs"><span class="nt">uriMark</span> <span class="geq">:::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">-</code> <code class="t">_</code> <code class="t">.</code> <code class="t">!</code> <code class="t">~</code> <code class="t">*</code> <code class="t">'</code> <code class="t">(</code> <code class="t">)</code></div>
</div>
</section>
<section>
<h1>Regular Expressions</h1>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Pattern</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">Disjunction</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Disjunction</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">Alternative</span></div>
<div class="rhs"><span class="nt">Alternative</span> <code class="t">|</code> <span class="nt">Disjunction</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Alternative</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">Alternative</span> <span class="nt">Term</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Term</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">Assertion</span></div>
<div class="rhs"><span class="nt">Atom</span></div>
<div class="rhs"><span class="nt">Atom</span> <span class="nt">Quantifier</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Assertion</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">^</code></div>
<div class="rhs"><code class="t">$</code></div>
<div class="rhs"><code class="t">\</code> <code class="t">b</code></div>
<div class="rhs"><code class="t">\</code> <code class="t">B</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">=</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">!</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Quantifier</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">QuantifierPrefix</span></div>
<div class="rhs"><span class="nt">QuantifierPrefix</span> <code class="t">?</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">QuantifierPrefix</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">*</code></div>
<div class="rhs"><code class="t">+</code></div>
<div class="rhs"><code class="t">?</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">,</code> <code class="t">}</code></div>
<div class="rhs"><code class="t">{</code> <span class="nt">DecimalDigits</span> <code class="t">,</code> <span class="nt">DecimalDigits</span> <code class="t">}</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">Atom</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">PatternCharacter</span></div>
<div class="rhs"><code class="t">.</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">AtomEscape</span></div>
<div class="rhs"><span class="nt">CharacterClass</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">:</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">PatternCharacter</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">-</code></div>
<div class="rhs"><code class="t">^</code> <code class="t">$</code> <code class="t">\</code> <code class="t">.</code> <code class="t">*</code> <code class="t">+</code> <code class="t">?</code> <code class="t">(</code> <code class="t">)</code> <code class="t">[</code> <code class="t">]</code> <code class="t">{</code> <code class="t">}</code> <code class="t">|</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">AtomEscape</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalEscape</span></div>
<div class="rhs"><span class="nt">CharacterEscape</span></div>
<div class="rhs"><span class="nt">CharacterClassEscape</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">CharacterEscape</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">ControlEscape</span></div>
<div class="rhs"><code class="t">c</code> <span class="nt">ControlLetter</span></div>
<div class="rhs"><span class="nt">HexEscapeSequence</span></div>
<div class="rhs"><span class="nt">UnicodeEscapeSequence</span></div>
<div class="rhs"><span class="nt">IdentityEscape</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">ControlEscape</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">f</code> <code class="t">n</code> <code class="t">r</code> <code class="t">t</code> <code class="t">v</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">ControlLetter</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">a</code> <code class="t">b</code> <code class="t">c</code> <code class="t">d</code> <code class="t">e</code> <code class="t">f</code> <code class="t">g</code> <code class="t">h</code> <code class="t">i</code> <code class="t">j</code> <code class="t">k</code> <code class="t">l</code> <code class="t">m</code> <code class="t">n</code> <code class="t">o</code> <code class="t">p</code> <code class="t">q</code> <code class="t">r</code> <code class="t">s</code> <code class="t">t</code> <code class="t">u</code> <code class="t">v</code> <code class="t">w</code> <code class="t">x</code> <code class="t">y</code> <code class="t">z</code></div>
<div class="rhs"><code class="t">A</code> <code class="t">B</code> <code class="t">C</code> <code class="t">D</code> <code class="t">E</code> <code class="t">F</code> <code class="t">G</code> <code class="t">H</code> <code class="t">I</code> <code class="t">J</code> <code class="t">K</code> <code class="t">L</code> <code class="t">M</code> <code class="t">N</code> <code class="t">O</code> <code class="t">P</code> <code class="t">Q</code> <code class="t">R</code> <code class="t">S</code> <code class="t">T</code> <code class="t">U</code> <code class="t">V</code> <code class="t">W</code> <code class="t">X</code> <code class="t">Y</code> <code class="t">Z</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">IdentityEscape</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <span class="nt">IdentifierPart</span></div>
<div class="rhs">&lt;ZWJ&gt;</div>
<div class="rhs">&lt;ZWNJ&gt;</div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">DecimalEscape</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalIntegerLiteral</span> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">CharacterClassEscape</span> <span class="geq">::</span> <span class="grhsmod">one of</span> </div>
<div class="rhs"><code class="t">d</code> <code class="t">D</code> <code class="t">s</code> <code class="t">S</code> <code class="t">w</code> <code class="t">W</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">CharacterClass</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">[</code> <span class="grhsannot">[lookahead ∉ {<code class="t">^</code>}]</span> <span class="nt">ClassRanges</span> <code class="t">]</code></div>
<div class="rhs"><code class="t">[</code> <code class="t">^</code> <span class="nt">ClassRanges</span> <code class="t">]</code></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">ClassRanges</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="grhsannot">[empty]</span></div>
<div class="rhs"><span class="nt">NonemptyClassRanges</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">NonemptyClassRanges</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">ClassAtom</span></div>
<div class="rhs"><span class="nt">ClassAtom</span> <span class="nt">NonemptyClassRangesNoDash</span></div>
<div class="rhs"><span class="nt">ClassAtom</span> <code class="t">–</code> <span class="nt">ClassAtom</span> <span class="nt">ClassRanges</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">NonemptyClassRangesNoDash</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">ClassAtom</span></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span> <span class="nt">NonemptyClassRangesNoDash</span></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span> <code class="t">–</code> <span class="nt">ClassAtom</span> <span class="nt">ClassRanges</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">ClassAtom</span> <span class="geq">::</span> </div>
<div class="rhs"><code class="t">-</code></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">ClassAtomNoDash</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">-</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">ClassEscape</span></div>
</div>
<div class="gp">
<div class="gsumxref">See 15.10.1</div>
<div class="lhs"><span class="nt">ClassEscape</span> <span class="geq">::</span> </div>
<div class="rhs"><span class="nt">DecimalEscape</span></div>
<div class="rhs"><code class="t">b</code></div>
<div class="rhs"><span class="nt">CharacterEscape</span></div>
<div class="rhs"><span class="nt">CharacterClassEscape</span></div>
</div>
</section>
</section>
<section id="sec-additional-ecmascript-features-for-web-browsers">
<div class="front">
<h1><span class="secnum" id="sec-B"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-ecmascript-features-for-web-browsers" title="link to this section">Annex&nbsp;B</a></span> <span class="section-status">(normative)</span> Additional ECMAScript
Features for Web Browsers</h1>
<p>The ECMAScript language syntax and semantics defined in this annex are required when the ECMAScript host is a web browser.
The content of this annex is normative but optional if the ECMAScript host is not a web browser.</p>
</div>
<section id="sec-additional-syntax">
<div class="front">
<h1><span class="secnum" id="sec-B.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax" title="link to this section">B.1</a></span>
Additional Syntax</h1>
</div>
<section id="sec-additional-syntax-numeric-literals">
<h1><span class="secnum" id="sec-B.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-numeric-literals" title="link to this section">B.1.1</a></span> Numeric Literals</h1>
<p>The syntax and semantics of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a> is extended as follows except that this
extension is not allowed for <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>:</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">NumericLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">DecimalLiteral</span></div>
<div class="rhs"><span class="nt">BinaryIntegerLiteral</span></div>
<div class="rhs"><span class="nt">OctalIntegerLiteral</span></div>
<div class="rhs"><span class="nt">HexIntegerLiteral</span></div>
<div class="rhs"><span class="nt">LegacyOctalIntegerLiteral</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">LegacyOctalIntegerLiteral</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">0</code> <span class="nt">OctalDigit</span></div>
<div class="rhs"><span class="nt">LegacyOctalIntegerLiteral</span> <span class="nt">OctalDigit</span></div>
</div>
<p><b>Static Semantics</b></p>
<ul>
<li>
<p>The MV of <span class="prod"><span class="nt">LegacyOctalIntegerLiteral</span> <span class="geq">::</span> <code class="t">0</code> <span class="nt">OctalDigit</span></span> is the MV of <span class="nt">OctalDigit</span>.</p>
</li>
<li>
<p>The MV of <span class="prod"><span class="nt">LegacyOctalIntegerLiteral</span> <span class="geq">::</span> <span class="nt">LegacyOctalIntegerLiteral</span> <span class="nt">OctalDigit</span></span> is (the MV of <span class="nt">LegacyOctalIntegerLiteral</span> times 8) plus the MV of <span class="nt">OctalDigit</span>.</p>
</li>
</ul>
</section>
<section id="sec-additional-syntax-string-literals">
<h1><span class="secnum" id="sec-B.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-string-literals" title="link to this section">B.1.2</a></span> String Literals</h1>
<p>The syntax and semantics of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals">11.8.4</a> is extended as follows except that this
extension is not allowed for <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>:</p>
<h2>Syntax</h2>
<div class="gp">
<div class="lhs"><span class="nt">EscapeSequence</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">CharacterEscapeSequence</span></div>
<div class="rhs"><span class="nt">OctalEscapeSequence</span></div>
<div class="rhs"><span class="nt">HexEscapeSequence</span></div>
<div class="rhs"><span class="nt">UnicodeEscapeSequence</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">OctalEscapeSequence</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">OctalDigit</span> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
<div class="rhs"><span class="nt">ZeroToThree</span> <span class="nt">OctalDigit</span> <span class="grhsannot">[lookahead ∉ <span class="nt">DecimalDigit</span>]</span></div>
<div class="rhs"><span class="nt">FourToSeven</span> <span class="nt">OctalDigit</span></div>
<div class="rhs"><span class="nt">ZeroToThree</span> <span class="nt">OctalDigit</span> <span class="nt">OctalDigit</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ZeroToThree</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">0</code> <code class="t">1</code> <code class="t">2</code> <code class="t">3</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">FourToSeven</span> <span class="geq">::</span> <span class="grhsmod">one of</span></div>
<div class="rhs"><code class="t">4</code> <code class="t">5</code> <code class="t">6</code> <code class="t">7</code></div>
</div>
<h2>Static Semantics</h2>
<ul>
<li>The CV of <span class="prod"><span class="nt">EscapeSequence</span> <span class="geq">::</span> <span class="nt">OctalEscapeSequence</span></span> is the CV of the <i>OctalEscapeSequence</i>.</li>
<li>The CV of <span class="prod"><span class="nt">OctalEscapeSequence</span> <span class="geq">::</span> <span class="nt">OctalDigit</span></span> is the character whose code unit value is the MV of the <i>OctalDigit</i>.</li>
<li>The CV of <span class="prod"><span class="nt">OctalEscapeSequence</span> <span class="geq">::</span> <span class="nt">ZeroToThree</span> <span class="nt">OctalDigit</span></span> is the character whose code unit value is (8
times the MV of the <i>ZeroToThree</i>) plus the MV of the <i>OctalDigit</i>.</li>
<li>The CV of <span class="prod"><span class="nt">OctalEscapeSequence</span> <span class="geq">::</span> <span class="nt">FourToSeven</span> <span class="nt">OctalDigit</span></span> is the character whose code unit value is (8
times the MV of the <i>FourToSeven</i>) plus the MV of the <i>OctalDigit</i>.</li>
<li>The CV of <span class="prod"><span class="nt">OctalEscapeSequence</span> <span class="geq">::</span> <span class="nt">ZeroToThree</span> <span class="nt">OctalDigit</span> <span class="nt">OctalDigit</span></span> is the
character whose code unit value is (64 (that is, 8<sup>2</sup>) times the MV of the <i>ZeroToThree</i>) plus (8 times
the MV of the first <i>OctalDigit</i>) plus the MV of the second <i>OctalDigit</i>.</li>
<li>The MV of <span class="prod"><span class="nt">ZeroToThree</span> <span class="geq">::</span> <code class="t">0</code></span> is 0.</li>
<li>The MV of <span class="prod"><span class="nt">ZeroToThree</span> <span class="geq">::</span> <code class="t">1</code></span> is 1.</li>
<li>The MV of <span class="prod"><span class="nt">ZeroToThree</span> <span class="geq">::</span> <code class="t">2</code></span> is 2.</li>
<li>The MV of <span class="prod"><span class="nt">ZeroToThree</span> <span class="geq">::</span> <code class="t">3</code></span> is 3.</li>
<li>The MV of <span class="prod"><span class="nt">FourToSeven</span> <span class="geq">::</span> <code class="t">4</code></span> is 4.</li>
<li>The MV of <span class="prod"><span class="nt">FourToSeven</span> <span class="geq">::</span> <code class="t">5</code></span> is 5.</li>
<li>The MV of <span class="prod"><span class="nt">FourToSeven</span> <span class="geq">::</span> <code class="t">6</code></span> is 6.</li>
<li>The MV of <span class="prod"><span class="nt">FourToSeven</span> <span class="geq">::</span> <code class="t">7</code></span> is 7.</li>
</ul>
</section>
<section id="sec-html-like-comments">
<h1><span class="secnum" id="sec-B.1.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-html-like-comments" title="link to this section">B.1.3</a></span>
HTML-like Comments</h1>
<p style="background-color: #F79646">TODO See <a href="http://javascript.spec.whatwg.org/">http://javascript.spec.whatwg.org/</a>#comment-syntax</p>
</section>
<section id="sec-regular-expressions-patterns">
<h1><span class="secnum" id="sec-B.1.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regular-expressions-patterns" title="link to this section">B.1.4</a></span> Regular Expressions Patterns</h1>
<p>The syntax of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns">21.2.1</a> is extended as modified and extended as follows. These changes introduce
ambiguities that are broken by the ordering or grammar productions and by contextual information. The following grammar is
used, with each alternative considered only if previous production alternatives do not match.</p>
<p><b>Syntax</b></p>
<div class="gp">
<div class="lhs"><span class="nt">Term</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">ExtendedTerm</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">Assertion</span><sub>[U]</sub></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">Atom</span><sub>[U]</sub></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">Atom</span><sub>[U]</sub> <span class="nt">Quantifier</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ExtendedTerm</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">Assertion</span></div>
<div class="rhs"><span class="nt">AtomNoBrace</span> <span class="nt">Quantifier</span></div>
<div class="rhs"><span class="nt">Atom</span></div>
<div class="rhs"><span class="nt">QuantifiableAssertion</span> <span class="nt">Quantifier</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AtomNoBrace</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">PatternCharacterNoBrace</span></div>
<div class="rhs"><code class="t">.</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">AtomEscape</span></div>
<div class="rhs"><span class="nt">CharacterClass</span></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">:</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Atom</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">PatternCharacter</span></div>
<div class="rhs"><code class="t">.</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">AtomEscape</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">CharacterClass</span><sub>[?U]</sub></div>
<div class="rhs"><code class="t">(</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">:</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PatternCharacterNoBrace</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span></div>
<div class="rhs"><code class="t">^</code> <code class="t">$</code> <code class="t">\</code> <code class="t">.</code> <code class="t">*</code> <code class="t">+</code> <code class="t">?</code> <code class="t">(</code> <code class="t">)</code> <code class="t">[</code> <code class="t">]</code> <code class="t">{</code> <code class="t">}</code> <code class="t">|</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">PatternCharacter</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span></div>
<div class="rhs"><code class="t">^</code> <code class="t">$</code> <code class="t">\</code> <code class="t">.</code> <code class="t">*</code> <code class="t">+</code> <code class="t">?</code> <code class="t">(</code> <code class="t">)</code> <code class="t">[</code> <code class="t">]</code> <code class="t">|</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">QuantifiableAssertion</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">=</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
<div class="rhs"><code class="t">(</code> <code class="t">?</code> <code class="t">!</code> <span class="nt">Disjunction</span> <code class="t">)</code></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">Assertion</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><code class="t">^</code></div>
<div class="rhs"><code class="t">$</code></div>
<div class="rhs"><code class="t">\</code> <code class="t">b</code></div>
<div class="rhs"><code class="t">\</code> <code class="t">B</code></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <code class="t">(</code> <code class="t">?</code> <code class="t">=</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <code class="t">(</code> <code class="t">?</code> <code class="t">!</code> <span class="nt">Disjunction</span><sub>[?U]</sub> <code class="t">)</code></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">QuantifiableAssertion</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">AtomEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">DecimalEscape</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">DecimalEscape</span> <code class="t">but</code> <code class="t">only</code> <code class="t">if</code> <code class="t">the</code> <code class="t">integer</code> <code class="t">value</code> <code class="t">of</code> <span class="nt">DecimalEscape</span> <code class="t">is</code> <code class="t">&lt;=</code> <span class="nt">NCapturingParens</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">CharacterEscape</span><sub>[U]</sub></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">CharacterClassEscape</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">CharacterClassEscape</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">CharacterEscape</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">CharacterEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ControlEscape</span></div>
<div class="rhs"><code class="t">c</code> <span class="nt">ControlLetter</span></div>
<div class="rhs"><span class="nt">HexEscapeSequence</span></div>
<div class="rhs"><span class="nt">RegExpUnicodeEscapeSequence</span><sub>[?U]</sub></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">OctalEscapeSequence</span></div>
<div class="rhs"><span class="nt">IdentityEscape</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">IdentityEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">SyntaxCharacter</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not</span> <code class="t">c</code></div>
<div class="rhs"><span class="grhsannot">[~U]</span> &lt;ZWJ&gt;</div>
<div class="rhs"><span class="grhsannot">[~U]</span> &lt;ZWNJ&gt;</div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NonemptyClassRanges</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub> <span class="nt">NonemptyClassRangesNoDash</span><sub>[?U]</sub></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">ClassAtom</span><sub>[U]</sub> <code class="t">-</code> <span class="nt">ClassAtom</span><sub>[U]</sub> <span class="nt">ClassRanges</span><sub>[U]</sub></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">ClassAtomInRange</span> <code class="t">-</code> <span class="nt">ClassAtomInRange</span> <span class="nt">ClassRanges</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">NonemptyClassRangesNoDash</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">ClassAtom</span><sub>[?U]</sub></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span><sub>[?U]</sub> <span class="nt">NonemptyClassRangesNoDash</span><sub>[?U]</sub></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">ClassAtomNoDash</span><sub>[U]</sub> <code class="t">-</code> <span class="nt">ClassAtom</span><sub>[U]</sub> <span class="nt">ClassRanges</span><sub>[U]</sub></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">ClassAtomNoDashInRange</span> <code class="t">-</code> <span class="nt">ClassAtomInRange</span> <span class="nt">ClassRanges</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassAtom</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><code class="t">-</code></div>
<div class="rhs"><span class="nt">ClassAtomNoDash</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassAtomNoDash</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">-</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">ClassEscape</span><sub>[?U]</sub></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassAtomInRange</span> <span class="geq">::</span></div>
<div class="rhs"><code class="t">-</code></div>
<div class="rhs"><span class="nt">ClassAtomNoDashInRange</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassAtomNoDashInRange</span> <span class="geq">::</span></div>
<div class="rhs"><span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">-</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">ClassEscape</span> <code class="t">but</code> <code class="t">only</code> <code class="t">if</code> <span class="nt">ClassEscape</span> <code class="t">evaluates</code> <code class="t">to</code> <code class="t">a</code> <span class="nt">CharSet</span> <code class="t">with</code> <code class="t">exactly</code> <code class="t">one</code> <code class="t">character</code></div>
<div class="rhs"><code class="t">\</code> <span class="nt">IdentityEscape</span></div>
</div>
<div class="gp">
<div class="lhs"><span class="nt">ClassEscape</span><sub>[U]</sub> <span class="geq">::</span></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">DecimalEscape</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">DecimalEscape</span> <code class="t">but</code> <code class="t">only</code> <code class="t">if</code> <code class="t">the</code> <code class="t">integer</code> <code class="t">value</code> <code class="t">of</code> <span class="nt">DecimalEscape</span> <code class="t">is</code> <code class="t">&lt;=</code> <span class="nt">NCapturingParens</span></div>
<div class="rhs"><code class="t">b</code></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">CharacterEscape</span><sub>[U]</sub></div>
<div class="rhs"><span class="grhsannot">[+U]</span> <span class="nt">CharacterClassEscape</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">CharacterClassEscape</span></div>
<div class="rhs"><span class="grhsannot">[~U]</span> <span class="nt">CharacterEscape</span></div>
</div>
<p><b>Pattern Semantics</b></p>
<p>The semantics of <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-pattern-semantics">21.2.2</a> is extended as follows:</p>
<p>Within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-term">21.2.2.5</a> reference to “<span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> ”
are to be interpreted as meaning “<span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> or <span class="prod"><span class="nt">AtomNoBrace</span> <span class="geq">::</span> <code class="t">(</code> <span class="nt">Disjunction</span> <code class="t">)</code></span> ”.</p>
<p>Term (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-term">21.2.2.5</a>) includes the following additional evaluation rule:</p>
<p>The production <span class="prod"><span class="nt">Term</span> <span class="geq">::</span> <span class="nt">QuantifiableAssertion</span> <span class="nt">Quantifier</span></span> evaluates the same as the production <span class="prod"><span class="nt">Term</span> <span class="geq">::</span> <span class="nt">Atom</span></span> <span style="font-family: Times New Roman"><i>Quantifier</i> but with <i>QuantifiableAssertion</i></span> <span style="font-family: Times New Roman">substituted for <i>Atom</i>.</span></p>
<p>Atom (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-atom">21.2.2.8</a>) evaluation rules for the <span class="nt">Atom</span> productions except for
<span class="prod"><span class="nt">Atom</span> <span class="geq">::</span> <span class="nt">PatternCharacter</span></span>
are also used for the <span class="nt">AtomNoBrace</span> productions, but with <span class="nt">AtomNoBrace</span>
substituted for <span style="font-family: Times New Roman"><i>Atom</i>.</span> The following evaluation rule is also
added:</p>
<p>The production <span class="prod"><span class="nt">AtomNoBrace</span> <span class="geq">::</span> <span class="nt">PatternCharacterNoBrace</span></span> evaluates as follows:</p>
<ol class="proc">
<li>Let <i>ch</i> be the character represented by <i>PatternCharacterNoBrace</i>.</li>
<li>Let <i>A</i> be a one-element CharSet containing the character <i>ch</i>.</li>
<li>Call CharacterSetMatcher(<i>A</i>, <b>false</b>) and return its Matcher result.</li>
</ol>
<p>CharacterEscape (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-characterescape">21.2.2.10</a>) includes the following additional evaluation rule:</p>
<p>The production <span class="prod"><span class="nt">CharacterEscape</span> <span class="geq">::</span> <span class="nt">OctalEscapeSequence</span></span> evaluates by evaluating the CV of the <span class="nt">OctalscapeSequence</span> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-string-literals">see B.1.2</a>) and returning its
character result.</p>
<p>ClassAtom (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-classatom">21.2.2.17</a>) includes the following additional evaluation rules:</p>
<p>The production <span class="prod"><span class="nt">ClassAtomInRange</span> <span class="geq">::</span> <code class="t">-</code></span> evaluates by returning the CharSet containing the one character <code>-</code>.</p>
<p>The production <span class="prod"><span class="nt">ClassAtomInRange</span> <span class="geq">::</span> <span class="nt">ClassAtomNoDashInRange</span></span> evaluates by evaluating <span class="nt">ClassAtomNoDashInRange</span> to
obtain a CharSet and returning that CharSet.</p>
<p>ClassAtomNoDash (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-classatomnodash">21.2.2.18</a>) includes the following additional evaluation rules:</p>
<p>The production <span class="prod"><span class="nt">ClassAtomNoDashInRange</span> <span class="geq">::</span> <span class="nt">SourceCharacter</span> <span class="grhsmod">but not one of</span> <code class="t">\</code> <span class="grhsmod">or</span> <code class="t">]</code> <span class="grhsmod">or</span> <code class="t">-</code></span> evaluates
by returning a one-element CharSet containing the character represented by <span class="nt">SourceCharacter</span>.</p>
<p>The production <span class="prod"><span class="nt">ClassAtomNoDashInRange</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">ClassEscape</span></span> but ony if…, evaluates by evaluating <span class="nt">ClassEscape</span> to obtain a CharSet and returning that CharSet.</p>
<p>The production <span class="prod"><span class="nt">ClassAtomNoDashInRange</span> <span class="geq">::</span> <code class="t">\</code> <span class="nt">IdentityEscape</span></span> evaluates by returning the character represented by <span class="nt">IdentityEscape</span>.</p>
</section>
</section>
<section id="sec-additional-built-in-properties">
<div class="front">
<h1><span class="secnum" id="sec-B.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-built-in-properties" title="link to this section">B.2</a></span> Additional Built-in Properties</h1>
<p>When the ECMAScript host is a web browser the following additional properties of the standard built-in objects are
defined.</p>
</div>
<section id="sec-additional-properties-of-the-global-object">
<div class="front">
<h1><span class="secnum" id="sec-B.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-global-object" title="link to this section">B.2.1</a></span> Additional Properties of the Global Object</h1>
</div>
<section id="sec-escape-string">
<h1><span class="secnum" id="sec-B.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-escape-string" title="link to this section">B.2.1.1</a></span>
escape (string)</h1>
<p>The <code>escape</code> function is a property of the global object. It computes a new version of a String value in
which certain characters have been replaced by a hexadecimal escape sequence.</p>
<p>For those characters being replaced whose code unit value is <code>0xFF</code> or less, a two-digit escape sequence of
the form <code>%</code><i>xx</i> is used. For those characters being replaced whose code unit value is greater than
<code>0xFF</code>, a four-digit escape sequence of the form <code>%u</code><i>xxxx</i> is used.</p>
<p>When the <code>escape</code> function is called with one argument <var>string</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>string</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>string</i>).</li>
<li>Let <i>length</i> be the number of code units in <i>string</i>.</li>
<li>Let <i>R</i> be the empty string.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> &lt; <i>length</i>,
<ol class="block">
<li>Let <i>char</i> be the code unit (represented as a 16-bit unsigned integer) at position <i>k</i> within
<i>string</i>.</li>
<li>If <i>char</i> is the code point of one of the 69 nonblank
characters<br><code>″ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./″<br></code>then,
<ol class="block">
<li>Let <i>S</i> be a String containing the single character <i>char</i>.</li>
</ol>
</li>
<li>Else if <i>char</i> &gt; 256,
<ol class="block">
<li>Let <i>S</i> be a String containing six characters <code>″%u</code><i>wxyz</i><code>″</code>
where <i>wxyz</i> are four hexadecimal digits encoding the value of <i>char</i>.</li>
</ol>
</li>
<li>Else, <i>char</i> &lt; 256
<ol class="block">
<li>Let <i>S</i> be a String containing three characters <code>″%</code><i>xy</i><code>″</code>
where <i>xy</i> are two hexadecimal digits encoding the value of <i>char</i>.</li>
</ol>
</li>
<li>Let <i>R</i> be a new String value computed by concatenating the previous value of <i>R</i> and <i>S</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>R</i>.</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The encoding is partly based on the encoding described in RFC 1738, but the entire
encoding specified in this standard is described above without regard to the contents of RFC 1738. This encoding does
not reflect changes to RFC 1738 made by RFC 3986.</p>
</div>
</section>
<section id="sec-unescape-string">
<h1><span class="secnum" id="sec-B.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-unescape-string" title="link to this section">B.2.1.2</a></span>
unescape (string)</h1>
<p>The <code>unescape</code> function is a property of the global object. It computes a new version of a String value in
which each escape sequence of the sort that might be introduced by the <code>escape</code> function is replaced with the
character that it represents.</p>
<p>When the <code>unescape</code> function is called with one argument <var>string</var>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>string</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>string</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>string</i>).</li>
<li>Let <i>length</i> be the number of code units in <i>string</i>.</li>
<li>Let <i>R</i> be the empty String.</li>
<li>Let <i>k</i> be 0.</li>
<li>Repeat, while <i>k</i> ≠ <i>length</i>
<ol class="block">
<li>Let <i>c</i> be the code unit at position <i>k</i> within <i>string</i>.</li>
<li>If <i>c</i> is <code>%</code>,
<ol class="block">
<li>If <i>k</i> ≤ <i>length</i>−6 and the code unit at position <i>k</i>+1 within <i>string</i> is
<code>u</code> and the four code units at positions <i>k</i>+2, <i>k</i>+3, <i>k</i>+4, and <i>k</i>+5
within <i>string</i> are all hexadecimal digits, then
<ol class="block">
<li>Let <i>c</i> be the code unit whose value is the integer represented by the four hexadecimal digits at
positions <i>k</i>+2, <i>k</i>+3, <i>k</i>+4, and <i>k</i>+5 within <i>string</i>.</li>
<li>Increase <i>k</i> by 5.</li>
</ol>
</li>
<li>Else if <i>k</i> ≤ <i>length</i>−3 and the two code units at positions <i>k</i>+1 and <i>k</i>+2
within <i>string</i> are both hexadecimal digits, then
<ol class="block">
<li>Let <i>c</i> be the code unit whose value is the integer represented by two zeroes plus the two
hexadecimal digits at positions <i>k</i>+1 and <i>k</i>+2 within <i>string</i>.</li>
<li>Increase <i>k</i> by 2.</li>
</ol>
</li>
</ol>
</li>
<li>Let <i>R</i> be a new String value computed by concatenating the previous value of <i>R</i> and <i>c</i>.</li>
<li>Increase <i>k</i> by 1.</li>
</ol>
</li>
<li>Return <i>R</i>.</li>
</ol>
</section>
</section>
<section id="sec-additional-properties-of-the-object.prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-B.2.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-object.prototype-object" title="link to this section">B.2.2</a></span> Additional Properties of the Object.prototype Object</h1>
</div>
<section id="sec-object.prototype.__proto__">
<div class="front">
<h1><span class="secnum" id="sec-B.2.2.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.__proto__" title="link to this section">B.2.2.1</a></span> Object.prototype.__proto__</h1>
<p>Object.prototype.__proto__ is an accessor property with attributes { [[Enumerable]]: <span class="value">false</span>, [[Configurable]]: <span class="value">true</span> }. The [[Get]] and [[Set]] attributes are
defined as follows</p>
</div>
<section id="sec-get-object.prototype.__proto__">
<h1><span class="secnum" id="sec-B.2.2.1.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-object.prototype.__proto__" title="link to this section">B.2.2.1.1</a></span> get Object.prototype.__proto__</h1>
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following
steps:</p>
<ol class="proc">
<li>Let <i>O</i> be the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> passing the <b>this</b> value as the
argument.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>Return the result of calling the [[GetPrototypeOf]] internal method of <i>O</i>.</li>
</ol>
</section>
<section id="sec-set-object.prototype.__proto__">
<h1><span class="secnum" id="sec-B.2.2.1.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-object.prototype.__proto__" title="link to this section">B.2.2.1.2</a></span> set Object.prototype.__proto__</h1>
<p>The value of the [[Set]] attribute is a built-in function that takes an argument <var>proto</var>. It performs the
following steps:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value)<i>.</i></li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>O</i>).</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>proto</i>) is neither Object nor Null, then return
<b>undefined</b>.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O)</i> is not Object, then return
<b>undefined</b>.</li>
<li>Let <i>status</i> be the result of calling the [[SetPrototypeOf]] internal method of <i>O</i> with argument
<i>proto</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>status</i>).</li>
<li>If <i>status</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>Return <b>undefined</b>.</li>
</ol>
</section>
</section>
</section>
<section id="sec-additional-properties-of-the-string.prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-B.2.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-string.prototype-object" title="link to this section">B.2.3</a></span> Additional Properties of the String.prototype Object</h1>
</div>
<section id="sec-string.prototype.substr">
<h1><span class="secnum" id="sec-B.2.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.substr" title="link to this section">B.2.3.1</a></span> String.prototype.substr (start, length)</h1>
<p>The <code>substr</code> method takes two arguments, <var>start</var> and <var>length</var>, and returns a substring of
the result of converting the <b>this</b> object to a String, starting from character position <var>start</var> and running
for <var>length</var> characters (or through the end of the String if <var>length</var> is <b>undefined</b>). If
<var>start</var> is negative, it is treated as <span style="font-family: Times New
Roman">(<i>sourceLength</i>+<i>start</i>)</span> where <var>sourceLength</var> is the length of the String. The result is
a String value, not a String object. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>O</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<b>this</b> value).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>O</i>).</li>
<li>Let <i>intStart</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>start</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>intStart</i>).</li>
<li>If <i>length</i> is <b>undefined</b>, let <i>end</i> be <b>+∞</b>; otherwise let <i>end</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>length</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>end</i>).</li>
<li>Let <i>size</i> be the number of characters in <i>S</i>.</li>
<li>If <i>intStart</i> is negative, then let <i>intStart</i> be max(<i>size</i> + <i>intStart</i>,0).</li>
<li>Let <i>resultLength</i> be min(max(<i>end</i>,0), <i>size</i> – <i>intStart</i>).</li>
<li>If <i>resultLength</i> ≤ 0, return the empty String <code>""</code>.</li>
<li>Return a String containing <i>resultLength</i> consecutive characters from <i>S</i> beginning with the character at
position <i>intStart</i>.</li>
</ol>
<p>The <code>length</code> property of the <code>substr</code> method is <b>2</b>.</p>
<div class="note">
<p><span class="nh">NOTE</span> The <code>substr</code> function is intentionally generic; it does not require that its
<b>this</b> value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
</div>
</section>
<section id="sec-string.prototype.anchor">
<h1><span class="secnum" id="sec-B.2.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.anchor" title="link to this section">B.2.3.2</a></span> String.prototype.anchor ( name )</h1>
<p>When the <b>anchor</b> method is called with argument <var>name</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"a"</code>, <code>"name"</code>, <i>name</i>).</li>
</ol>
<p>The abstract operation <span style="font-family: Times New Roman">CreateHTML</span> is called with arguments
<var>string, tag</var>, <var>attribute</var>, and <span style="font-family: Times New Roman"><i>value</i>.</span> The
arguments <var>tag</var> and <var>attribute</var> must be string values. The following steps are taken:</p>
<ol class="proc">
<li>Let <i>str</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-checkobjectcoercible">CheckObjectCoercible</a>(<i>string</i>).</li>
<li>Let <i>S</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>str</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>S</i>).</li>
<li>Let <i>p1</i> be the string value that is the concatenation of <code>"&lt;"</code> and <i>tag</i>.</li>
<li>If <i>attribute</i> is not the empty String, then
<ol class="block">
<li>Let <i>V</i> <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<i>value</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>V</i>).</li>
<li>Let <i>escapedV</i> be the string value that is the same as <i>V</i> except that each occurrence of the
character <code>"</code> (code unit value 0x0022) in <i>V</i> has been replaced with the six character sequence
<code>"&amp;quot;"</code>.</li>
<li>Let <i>p1</i> be the string value that is the concatenation of the following string values:
<ul>
<li>The string value of <i>p1</i></li>
<li>Code unit 0x0020 (a single SPACE)</li>
<li><code>attribute=</code></li>
<li>Code unit 0x0022 (a single QUATATION MARK)</li>
<li>The string value of <i>escapedV</i></li>
<li>Code unit 0x0022 (a single QUATATION MARK)</li>
</ul>
</li>
</ol>
</li>
<li>Let <i>p2</i> be the string value that is the concatenation of <i>p1</i> and <code>"&gt;"</code>.</li>
<li>Let <i>p3</i> be the string value that is the concatenation of <i>p2</i> and <i>S</i>.</li>
<li>Let <i>p4</i> be the string value that is the concatenation of <i>p2</i>, <code>"&lt;/"</code>, <i>tag</i>, and
<code>"&gt;"</code>.</li>
<li>Return <i>p4</i>.</li>
</ol>
</section>
<section id="sec-string.prototype.big">
<h1><span class="secnum" id="sec-B.2.3.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.big" title="link to this section">B.2.3.3</a></span> String.prototype.big ()</h1>
<p>When the <b>big</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"big"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.blink">
<h1><span class="secnum" id="sec-B.2.3.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.blink" title="link to this section">B.2.3.4</a></span> String.prototype.blink ()</h1>
<p>When the <b>blink</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"blink"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.bold">
<h1><span class="secnum" id="sec-B.2.3.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.bold" title="link to this section">B.2.3.5</a></span> String.prototype.bold ()</h1>
<p>When the <b>bold</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"b"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.fixed">
<h1><span class="secnum" id="sec-B.2.3.6"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.fixed" title="link to this section">B.2.3.6</a></span> String.prototype.fixed ()</h1>
<p>When the <b>fixed</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"tt"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.fontcolor">
<h1><span class="secnum" id="sec-B.2.3.7"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.fontcolor" title="link to this section">B.2.3.7</a></span> String.prototype.fontcolor ( color )</h1>
<p>When the <b>fontcolor</b> method is called with argument <var>color</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"font"</code>, <code>"color"</code>, <i>color</i>).</li>
</ol>
</section>
<section id="sec-string.prototype.fontsize">
<h1><span class="secnum" id="sec-B.2.3.8"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.fontsize" title="link to this section">B.2.3.8</a></span> String.prototype.fontsize ( size )</h1>
<p>When the <b>fontsize</b> method is called with argument <var>size</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"font"</code>, <code>"size"</code>, <i>size</i>).</li>
</ol>
</section>
<section id="sec-string.prototype.italics">
<h1><span class="secnum" id="sec-B.2.3.9"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.italics" title="link to this section">B.2.3.9</a></span> String.prototype.italics ()</h1>
<p>When the <b>italics</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"i"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.link">
<h1><span class="secnum" id="sec-B.2.3.10"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.link" title="link to this section">B.2.3.10</a></span> String.prototype.link ( url )</h1>
<p>When the <b>link</b> method is called with argument <var>url</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"a"</code>, <code>"href"</code>, <i>url</i>).</li>
</ol>
</section>
<section id="sec-string.prototype.small">
<h1><span class="secnum" id="sec-B.2.3.11"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.small" title="link to this section">B.2.3.11</a></span> String.prototype.small ()</h1>
<p>When the <b>small</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"small"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.strike">
<h1><span class="secnum" id="sec-B.2.3.12"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.strike" title="link to this section">B.2.3.12</a></span> String.prototype.strike ()</h1>
<p>When the <b>strike</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"strike"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
<section id="sec-string.prototype.sub">
<h1><span class="secnum" id="sec-B.2.3.13"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.sub" title="link to this section">B.2.3.13</a></span> String.prototype.sub ()</h1>
<p>When the <b>sub</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"sub"</code>, <code>""</code>, <code>""</code>.</li>
</ol>
</section>
<section id="sec-string.prototype.sup">
<h1><span class="secnum" id="sec-B.2.3.14"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.sup" title="link to this section">B.2.3.14</a></span> String.prototype.sup ()</h1>
<p>When the <b>sup</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>S</i> be the <b>this</b> value.</li>
<li>Return CreateHTML(<i>S</i>, <code>"sup"</code>, <code>""</code>, <code>""</code>).</li>
</ol>
</section>
</section>
<section id="sec-additional-properties-of-the-date.prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-B.2.4"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-date.prototype-object" title="link to this section">B.2.4</a></span> Additional Properties of the Date.prototype Object</h1>
</div>
<section id="sec-date.prototype.getyear">
<h1><span class="secnum" id="sec-B.2.4.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.getyear" title="link to this section">B.2.4.1</a></span> Date.prototype.getYear ( )</h1>
<div class="note">
<p><span class="nh">NOTE</span> The <code>getFullYear</code> method is preferred for nearly all purposes, because it
avoids the “year 2000 problem.”</p>
</div>
<p>When the <b>getYear</b> method is called with no arguments, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>t</i>).</li>
<li>If <i>t</i> is <b>NaN</b>, return <b>NaN</b>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-year-number">YearFromTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<i>t</i>)) −
1900.</li>
</ol>
</section>
<section id="sec-date.prototype.setyear">
<h1><span class="secnum" id="sec-B.2.4.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.setyear" title="link to this section">B.2.4.2</a></span> Date.prototype.setYear (year)</h1>
<div class="note">
<p><span class="nh">NOTE</span> The <code>setFullYear</code> method is preferred for nearly all purposes, because it
avoids the “year 2000 problem.”</p>
</div>
<p>When the <b>setYear</b> method is called with one argument <var>year</var>, the following steps are taken:</p>
<ol class="proc">
<li>Let <i>t</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">LocalTime</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this
time value</a>); but if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">this time value</a> is <b>NaN</b>,
let <i>t</i> be <b>+0</b>.</li>
<li>Let <i>y</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tonumber">ToNumber</a>(<i>year</i>).</li>
<li>If <i>y</i> is <b>NaN</b>, set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal
slot</a> of this Date object to <b>NaN</b> and return <b>NaN</b>.</li>
<li>If <i>y</i> is not <b>NaN</b> and 0 ≤ <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>y</i>) ≤ 99 then let
<i>yyyy</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger">ToInteger</a>(<i>y</i>) +&nbsp;1900. Otherwise, let <i>yyyy</i> be
<i>y</i>.</li>
<li>Let <i>d</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeday">MakeDay</a>(<i>yyyy</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-month-number">MonthFromTime</a>(<i>t</i>), <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date-number">DateFromTime</a>(<i>t</i>)).</li>
<li>Let <i>date</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-local-time">UTC</a>(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makedate">MakeDate</a>(<i>d</i>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-day-number-and-time-within-day">TimeWithinDay</a>(<i>t</i>))).</li>
<li>Set the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of this Date
object to <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-timeclip">TimeClip</a>(<i>date</i>).</li>
<li>Return the value of the [[DateValue]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> of
this Date object.</li>
</ol>
</section>
<section id="sec-date.prototype.togmtstring">
<h1><span class="secnum" id="sec-B.2.4.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.togmtstring" title="link to this section">B.2.4.3</a></span> Date.prototype.toGMTString ( )</h1>
<div class="note">
<p><span class="nh">NOTE</span> The property <code>toUTCString</code> is preferred. The <code>toGMTString</code>
property is provided principally for compatibility with old code. It is recommended that the <code>toUTCString</code>
property be used in new ECMAScript code.</p>
</div>
<p>The Function object that is the initial value of <code>Date.prototype.toGMTString</code> is the same Function object
that is the initial value of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.toutcstring">Date.prototype.toUTCString</a></code>.</p>
</section>
</section>
<section id="sec-additional-properties-of-the-regexp.prototype-object">
<div class="front">
<h1><span class="secnum" id="sec-B.2.5"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-properties-of-the-regexp.prototype-object" title="link to this section">B.2.5</a></span> Additional Properties of the RegExp.prototype Object</h1>
</div>
<section id="sec-regexp.prototype.compile">
<h1><span class="secnum" id="sec-B.2.5.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.compile" title="link to this section">B.2.5.1</a></span> RegExp.prototype.compile (pattern, flags )</h1>
<p>When the <b>compile</b> method is called with arguments <i>pattern</i> and <i>flags</i>, the following steps are
taken:</p>
<ol class="proc">
<li>Let <i>O</i> be the <b>this</b> value.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is not Object or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>O</i>) is Object and <i>O</i> does not have a
[[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>Throw a <b>TypeError</b> exception.</li>
</ol>
</li>
<li>Let <i>extensible</i> be the result of calling the [[IsExtensible]] internal method of <i>O</i>.</li>
<li>If <i>extensible</i> is <b>false</b>, then throw a <b>TypeError</b> exception.</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>pattern</i>) is Object and <i>pattern</i> has a
[[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>, then
<ol class="block">
<li>If the value of <i>pattern’s</i> [[RegExpMatcher]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> is <b>undefined</b>, then throw a
<b>TypeError</b> exception.</li>
<li>If <i>flags</i> is not <b>undefined</b>, then throw a <b>TypeError</b> exception.</li>
<li>Let <i>P</i> be the value of <i>pattern’s</i> [[OriginalSource]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>Let <i>F</i> be the value of <i>pattern’s</i> [[OriginalFlags]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
</ol>
</li>
<li>Else,
<ol class="block">
<li>Let <i>P</i> be <i>pattern</i>.</li>
<li>Let <i>F</i> be <i>flags</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpinitialize">RegExpInitialize</a>(<i>O,</i> <i>P</i>, <i>F</i>).</li>
</ol>
<div class="note">
<p><span class="nh">NOTE</span> The <code>compile</code> method completely reinitializes the <b>this</b> object RegExp
with a new pattern and flags. An implementaton may interpret use of this method as an assertion that the resulting
RegExp object will be used multiple times and hence is a candidate for extra optimization.</p>
</div>
</section>
</section>
</section>
<section id="sec-other-additional-features">
<div class="front">
<h1><span class="secnum" id="sec-B.3"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-other-additional-features" title="link to this section">B.3</a></span>
Other Additional Features</h1>
</div>
<section id="sec-__proto___-property-names-in-object-initializers">
<h1><span class="secnum" id="sec-B.3.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-__proto___-property-names-in-object-initializers" title="link to this section">B.3.1</a></span> __proto___ Property Names in Object Initializers</h1>
<p>In 0 the PropertyDefinitionEvaluation algorithm for the production <span class="prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></span> is replaced with the following:</p>
<div class="gp prod"><span class="nt">PropertyDefinition</span> <span class="geq">:</span> <span class="nt">PropertyName</span> <code class="t">:</code> <span class="nt">AssignmentExpression</span></div>
<ol class="proc">
<li>Let <i>propKey</i> be the result of evaluating <i>PropertyName</i>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propKey</i>).</li>
<li>Let <i>exprValueRef</i> be the result of evaluating <i>AssignmentExpression</i>.</li>
<li>Let <i>propValue</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue">GetValue</a>(<i>exprValueRef</i>).</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<i>propValue</i>).</li>
<li>If <i>propKey</i> is the string value <code>"__proto__"</code> and if IsComputedPropertyKey(<i>propKey</i>) is
<b>false</b>, then
<ol class="block">
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<i>propValue</i>) is either Object or Null, then
<ol class="block">
<li>Return the result of calling the [[SetPrototypeOf]] internal method of <i>object</i> with argument
<i>propValue</i>.</li>
</ol>
</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
</li>
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a>(<i>AssignmentExpression</i>) is
<b>true</b>, then
<ol class="block">
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>propValue</i> is an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects">ECMAScript function object</a>.</li>
<li>Let <i>referencesSuper</i> be the value of <i>propValue</i>’s [[[NeedsSuper]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
<li>If <i>referencesSuper</i> is <b>true</b>, then
<ol class="block">
<li>Set the <i>propValue</i>’s [[HomeObject]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>object</i>.</li>
<li>Set the <i>propValue</i>’s [[MethodName]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> to <i>propKey</i>.</li>
</ol>
</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-setfunctionname">SetFunctionName</a>(<i>propValue</i>, <i>propKey</i>).</li>
</ol>
</li>
<li>Let <i>desc</i> be the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-descriptor-specification-type">Property Descriptor</a>{[[Value]]:
<i>propValue</i>, [[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-definepropertyorthrow">DefinePropertyOrThrow</a>(<i>object</i>, <i>propKey</i>,
<i>desc</i>).</li>
</ol>
</section>
<section id="sec-web-legacy-compatibility-for-block-level-function-declarations">
<h1><span class="secnum" id="sec-B.3.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-web-legacy-compatibility-for-block-level-function-declarations" title="link to this section">B.3.2</a></span> Web Legacy Compatibility for Block-Level Function Declarations</h1>
<p>Prior to the Sixth Edition, the ECMAScript specification did not define the occurrence of a <span class="nt">FunctionDeclaration</span> as an element of a <span class="nt">Block</span> statement’s <span class="nt">StatementList</span>. However, support for that form of <span class="nt">FunctionDeclaration</span> was an
allowable extension and most browser-hosted ECMAScript implementations permitted them. Unfortunately, the semantics of such
declarations differ among those implementations. Because of these semantic differences, existing web ECMAScript code that
uses <span class="nt">Block</span> level function declarations is only portable among browser implementation if the usage
only depends upon the semantic intersection of all of the browser implementations for such declarations. The following are
the use cases that fall within that intersection semantics:</p>
<ol class="proc">
<li>A function is declared and only referenced within a single block
<ul>
<li>
<p>A function declaration with the name <var>f</var> is declared exactly once within the function code of an
enclosing function <var>g</var> and that declaration is nested within a <span class="nt">Block</span>.</p>
</li>
<li>
<p>No other declaration of <var>f</var> that is not a <code>var</code> declaration occurs within the function code
of <var>g</var></p>
</li>
<li>
<p>All references to <var>f</var> occur within the <span class="nt">StatementList</span> of the <span class="nt">Block</span> containing the declaration of <var>f</var>.</p>
</li>
</ul>
</li>
<li>A function is declared and possibly used within a single <span class="nt">Block</span> but also referenced by an inner
function definition that is not contained within that same <span class="nt">Block</span>.
<ul>
<li>
<p>A function declaration with the name <var>f</var> is declared exactly once within the function code of an
enclosing function <var>g</var> and that declaration is nested within a <span class="nt">Block</span>.</p>
</li>
<li>
<p>No other declaration of <var>f</var> that is not a <code>var</code> declaration occurs within the function code
of <var>g</var></p>
</li>
<li>
<p>References to <var>f</var> may occur within the <span class="nt">StatementList</span> of the <span class="nt">Block</span> containing the declaration of <var>f</var>.</p>
</li>
<li>
<p>References to <var>f</var> occur within the function code of <var>g</var> that lexically follows the <span class="nt">Block</span> containing the declaration of <var>f</var>.</p>
</li>
</ul>
</li>
<li>A function is declared and possibly used within a single block but also referenced within subsequent blocks.
<ul>
<li>
<p>A function declaration with the name <var>f</var> is declared exactly once within the function code of an
enclosing function <var>g</var> and that declaration is nested within a <span class="nt">Block</span>.</p>
</li>
<li>
<p>No other declaration of <var>f</var> that is not a <code>var</code> declaration occurs within the function code
of <var>g</var></p>
</li>
<li>
<p>References to <var>f</var> may occur within the <span class="nt">StatementList</span> of the <span class="nt">Block</span> containing the declaration of <var>f</var>.</p>
</li>
<li>
<p>References to <var>f</var> occur within another function <var>h</var> that is nested within <var>g</var> and no
other declaration of <var>f</var> shadows the references to <var>f</var> from within <var>h</var>.</p>
</li>
<li>
<p>All invocations of <i>h</i> occur after the declaration of <i>f</i> has been evaluated.</p>
</li>
</ul>
</li>
</ol>
<p>The first use case is interoperable with the semantics of <span class="nt">Block</span> level function declarations
provded by ECMA-262 Edition 6. Any pre-existing ECMAScript code that employees that use case will operate using the Block
level function declarations semantics defined by clauses 9, 13, and 14 of this specification.</p>
<p>Sixth edition interoperability for the second and third use cases requires the following extensions to the <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-and-exotic-objects-behaviours">clause 9</a> and 14 semantics. These extensions are applied to each
non-strict mode functions <var>g</var> for each <i>FunctionDeclaration</i> <i>f</i> that is directly contained in the
<i>StatementList</i> of a <i>Block</i>, <i>CaseClause</i>, or <i>DefaultClause</i> that is part of the function code of
<i>g</i></p>
<ol class="proc">
<li>Let <i>F</i> be StringValue the <i>BindingIdentifier</i> of <i>FunctionDeclaration</i> <i>f</i>.</li>
<li>If replacing the <i>FunctionDeclaration</i> <i>f</i> with a <i>VariableStatement</i> that has F as a
<i>BindingIdentyifier</i> would not produce any Early Errors for <i>g</i>, then
<ol class="block">
<li>During FunctionDeclarationInstantiation (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation">9.2.14</a>) for
<i>g</i> perform the following steps immediately before performing step 26:
<ol class="block">
<li>Let <i>alreadyDeclared</i> be the result of calling <i>env’s</i> HasBinding concrete method passing
<i>F</i> as the argument.</li>
<li><span style="font-family: sans-serif">NOTE A var binding for</span> <i>F</i> <span style="font-family:
sans-serif">is only instantiated here if it is not also a VarDeclaredName, the name of a formal parameter, or
another</span> <i>FunctionDeclarations</i>.</li>
<li>If <i>alreadyDeclared</i> is <b>false</b>, then
<ol class="block">
<li>Let <i>status</i> be the result of calling <i>env’s</i> CreateMutableBinding concrete method passing
<i>F</i> as the argument.</li>
<li>NOTE The new binding is not initialized during <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation">Function
Declaration Instantiation</a>.</li>
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-algorithm-conventions">Assert</a>: <i>status</i> is never an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-completion-record-specification-type">abrupt completion</a>.</li>
</ol>
</li>
</ol>
</li>
<li>If <i>alreadyDeclared</i> was <b>false</b> after step 2.a.i above then in place of the <i>FunctionDeclaration</i>
Evaluation algorithm provide in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-static-semantics-vardeclarednames">14.1.17</a>,
perform the following steps to evaluate the <i>FuncitonDeclaration</i> <i>f</i>:
<ol class="block">
<li>Let <i>fenv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s
VariableEnviornment.</li>
<li>Let <i>benv</i> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts">the running execution context</a>’s
LexicalEnviornment.</li>
<li>Let <i>fobj</i> be the result of calling the GetBindingValue concrete methjod of <i>benv</i> with arguments
<i>F</i> and <b>false</b>.</li>
<li>If .the binding for <i>F</i> in <i>fenv</i> has not been initialized, then</li>
<li>Call the InitializeBinding concrete method of <i>fenv</i> with aruments <i>F</i> and <i>fobj</i>.</li>
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-normalcompletion">NormalCompletion</a>(<span style="font-family:
sans-serif">empty</span>).</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>If an ECMAScript implication has a mechanism for reporting diagnostic warning messages, a warning should be produced for
each function <i>g</i> whose function code contains a <i>FunctionDeclaration</i> for which step 2.a above will be
performed.</p>
</section>
</section>
</section>
<section id="sec-strict-mode-of-ecmascript">
<h1><span class="secnum" id="sec-C"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-of-ecmascript" title="link to this section">Annex&nbsp;C</a></span> <span class="section-status">(informative)</span> The Strict Mode of
ECMAScript</h1>
<p><b>The strict mode restriction and exceptions</b></p>
<ul>
<li>
<p>The identifiers "<code>implements</code>", "<code>interface</code>", "<code>let</code>", "<code>package</code>",
"<code>private</code>", "<code>protected</code>", "<code>public</code>", "<code>static</code>", and "<code>yield</code>" are
classified as <i>FutureReservedWord</i> tokens within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>. (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words">11.6.2.2</a>).</p>
</li>
<li>
<p>A conforming implementation, when processing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, may not extend the
syntax of <i>NumericLiteral</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals">11.8.3</a>) to include
<i>LegacyOctalIntegerLiteral</i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-numeric-literals">B.1.1</a>.</p>
</li>
<li>
<p>A conforming implementation, when processing <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">see 10.2.1</a>), may not extend the syntax of <i>EscapeSequence</i> to include
<i>LegacyOctalEscapeSequence</i> as described in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additional-syntax-string-literals">B.1.2</a>.</p>
</li>
<li>
<p>Assignment to an undeclared identifier or otherwise unresolvable reference does not create a property in the global
object. When a simple assignment occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, its <i>LeftHandSide</i>
must not evaluate to an <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">unresolvable Reference</a>. If it does a
<b>ReferenceError</b> exception is thrown (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-putvalue">6.2.3.2</a>). The <i>LeftHandSide</i> also may not be a
reference to a data property with the attribute value {[[Writable]]:<b>false</b>}, to an accessor property with the
attribute value {[[Set]]:<b>undefined</b>}, nor to a non-existent property of an object whose [[Extensible]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a> has the value <b>false</b>. In these cases a
<code>TypeError</code> exception is thrown (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">12.14</a>).</p>
</li>
<li>
<p>The identifier <code>eval</code> or <code>arguments</code> may not appear as the <i>LeftHandSideExpression</i> of an
Assignment operator (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">12.14</a>) or of a <i>PostfixExpression</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators">12.14</a>) or as the <i>UnaryExpression</i> operated upon by a Prefix Increment (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-increment-operator">12.5.7</a>) or a Prefix Decrement (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-prefix-decrement-operator">12.5.8</a>) operator.</p>
</li>
<li>
<p>Arguments objects for strict mode functions define non-configurable accessor properties named "<code>caller</code>" and
"<code>callee</code>" which throw a <b>TypeError</b> exception on access (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-addrestrictedfunctionproperties">9.2.8</a>).</p>
</li>
<li>
<p>Arguments objects for strict mode functions do not dynamically share their array indexed property values with the
corresponding formal parameter bindings of their functions. (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects">9.4.4</a>).</p>
</li>
<li>
<p>For strict mode functions, if an arguments object is created the binding of the local identifier <code>arguments</code>
to the arguments object is immutable and hence may not be the target of an assignment expression. (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-declaration-instantiation">9.2.14</a>).</p>
</li>
<li>
<p>It is a <b>SyntaxError</b> if <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> contains an <i>ObjectLiteral</i> with
more than one definition of any data property (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-early-errors">12.2.5.1</a>).</p>
</li>
<li>
<p>It is a <b>SyntaxError</b> if the <i>Identifier</i> <code>"eval"</code> or the <i>Identifier</i> <code>"arguments"</code>
occurs as the <i>Identifier</i> in a <span class="nt">PropertySetParameterList</span> of a <span class="nt">PropertyDefinition</span> that is contained in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> or if its
<i>FunctionBody</i> is <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-initializer-static-semantics-early-errors">12.2.5.1</a>).</p>
</li>
<li>
<p>Strict mode eval code cannot instantiate variables or functions in the variable environment of the caller to eval.
Instead, a new variable environment is created and that environment is used for declaration binding instantiation for the
eval code (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-eval-x">18.2.1</a>).</p>
</li>
<li>
<p>If <b>this</b> is evaluated within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, then the <b>this</b> value is
not coerced to an object. A <b>this</b> value of <b>null</b> or <b>undefined</b> is not converted to the global object and
primitive values are not converted to wrapper objects. The <b>this</b> value passed via a function call (including calls
made using <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.apply">Function.prototype.apply</a></code> and <b><span style="font-family: monospace"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.call">Function.prototype.call</a></span>)</b> do not coerce
the passed this value to an object (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getthisenvironment">8.3.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-this-keyword">12.2.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.apply">19.2.3.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.call">19.2.3.3</a>).</p>
</li>
<li>
<p>When a <code>delete</code> operator occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, a
<b>SyntaxError</b> is thrown if its <i>UnaryExpression</i> is a direct reference to a variable, function argument, or
function name(<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-delete-operator">12.5.4</a>).</p>
</li>
<li>
<p>When a <code>delete</code> operator occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a>, a
<b>TypeError</b> is thrown if the property to be deleted has the attribute { [[Configurable]]:<b>false</b> } (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-delete-operator">12.5.4</a>).</p>
</li>
<li>
<p>It is a <b>SyntaxError</b> if a <i>VariableDeclaration</i> occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a>
and its <i>Identifier</i> is <code>eval</code> or <code>arguments</code> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-variable-statement">13.2.2</a>).</p>
</li>
<li>
<p>Strict mode code may not include a <i>WithStatement</i>. The occurrence of a <i>WithStatement</i> in such a context is an
<b>SyntaxError</b> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-with-statement">13.10</a>).</p>
</li>
<li>
<p>It is a <b>SyntaxError</b> if a <i>TryStatement</i> with a <i>Catch</i> occurs within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict code</a> and the <i>Identifier</i> of the <i>Catch</i> production is <code>eval</code>
or <code>arguments</code> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement">13.14</a>)</p>
</li>
<li>
<p>It is a <b>SyntaxError</b> if the identifier <code>eval</code> or <code>arguments</code> appears within the
<i>FormalParameters</i> of a strict mode <i>FunctionDeclaration</i> or <i>FunctionExpression</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors">12.1.1</a>)</p>
</li>
<li>
<p>A strict mode function may not have two or more formal parameters that have the same name. An attempt to create such a
function using a <i>FunctionDeclaration</i>, <i>FunctionExpression</i>, or <code>Function</code> constructor is a
<b>SyntaxError</b> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions">14.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-constructor">19.2.1</a>).</p>
</li>
<li>
<p>An implementation may not extend, beyond that defined in this specification, the meanings within strict mode functions of
properties named <code>caller</code> or <code>arguments</code> of function instances. ECMAScript code may not create or
modify properties with these names on function objects that correspond to strict mode functions (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-getownproperty-p">9.2.2</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arguments-exotic-objects">9.4.4</a>).</p>
</li>
<li>
<p>It is a <b>SyntaxError</b> to use within <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-strict-mode-code">strict mode code</a> the identifiers
<code>eval</code> or <code>arguments</code> as the <i>Identifier</i> of a <i>FunctionDeclaration</i> or
<i>FunctionExpression</i> (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors">12.1.1</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions">14.1</a>). Attempting to dynamically define such a strict mode function using the
<code>Function</code> constructor (<a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-constructor">19.2.1</a>) will throw a <b>SyntaxError</b>
exception.</p>
</li>
</ul>
</section>
<section id="sec-additions-and-changes-that-introduce-incompatibilities-with-prior-editions">
<div class="front">
<h1><span class="secnum" id="sec-D"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-additions-and-changes-that-introduce-incompatibilities-with-prior-editions" title="link to this section">Annex&nbsp;D</a></span> <span class="section-status">(informative)</span> Additions and
Changes that Introduce Incompatibilities with Prior Editions</h1>
</div>
<section id="sec-in-the-6th-edition">
<h1><span class="secnum" id="sec-D.1"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-in-the-6th-edition" title="link to this section">D.1</a></span> In the
6<sup>th</sup> Edition</h1>
<p>9: In Edition 6, Function calls are not allowed to return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reference-specification-type">Reference</a>
value.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements">13.6</a>: In Edition 6, a terminating semi-colon is no longer required at the end of a
do-while statement.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements">13.6</a>: Prior to Edition 6, an initialisation expression could appear as part of the
<i>VariableDeclaration</i> that precedes the <code>in</code> keyword. The value of that expression was always discarded. In
Edition 6, the <i>ForBind</i> in that same position does not allow the occurance of such an initialiser.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-try-statement">13.14</a>: In Edition 6, it is an early error for a <span class="nt">Catch</span> clause to
contained a <code>var</code> declaration for the same <span class="nt">Identifier</span> that appears as the <span class="nt">Catch</span> clause parameter. In previous editions, such a variable declaration would be instantiated in the
enclosing variable environment but the declaration’s <span class="nt">Initialiser</span> value would be assigned to the
<span class="nt">Catch</span> parameter.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions">14.3</a> In Edition 6, the function objects that are created as the values of the [[Get]]
or [[Set]] attribute of accessor properties in an <span class="nt">ObjectLiteral</span> are not constructor functions. In
Edition 5, they were constructors.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.create">19.1.2.2</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperties">19.1.2.3</a>: In Edition 6, all
property additions and changes are processed, even if one of them throws an exception. If an exception occurs during such
processing, the first such exception is thrown after all propertie are processed. In Edition 5, processing of property
additions and changes immediately terminated when the first exception occurred.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.freeze">19.1.2.5</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.freeze">Object.freeze</a></code> is not an object it is treated as if it was a non-extensible ordinary
object with no own properties. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be
thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertydescriptor">19.1.2.6</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertydescriptor">Object.getOwnPropertyDescriptor</a></code> is not an object an attempt is make to
coerce the argument using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>. If the coerecion is successful the result is used in place of
the original argument value. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be
thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertynames">19.1.2.7</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertynames">Object.getOwnPropertyNames</a></code> is not an object an attempt is make to coerce the
argument using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>. If the coerecion is successful the result is used in place of the
original argument value. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be
thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getprototypeof">19.1.2.9</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getprototypeof">Object.getPrototypeOf</a></code> is not an object an attempt is make to coerce the argument
using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>. If the coerecion is successful the result is used in place of the original
argument value. In Edition 5, a non-object argument always causes a <b>TypeError</b> to be thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isextensible">19.1.2.11</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isextensible">Object.isExtensible</a></code> is not an object it is treated as if it was a non-extensible
ordinary object with no own properties. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isfrozen">19.1.2.12</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isfrozen">Object.isFrozen</a></code> is not an object it is treated as if it was a non-extensible ordinary
object with no own properties. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be
thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.issealed">19.1.2.13</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.issealed">Object.isSealed</a></code> is not an object it is treated as if it was a non-extensible ordinary
object with no own properties. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be
thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys">19.1.2.14</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys">Object.keys</a></code> is not an object an attempt is make to coerce the argument using <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a>. If the coerecion is successful the result is used in place of the original argument value.
In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.preventextensions">19.1.2.15</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.preventextensions">Object.preventExtensions</a></code> is not an object it is treated as if it was a
non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.seal">19.1.2.17</a>: In Edition 6, if the argument to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.seal">Object.seal</a></code> is not an object it is treated as if it was a non-extensible ordinary object
with no own properties. In Edition 5, a non-object argument always causes a <span class="value">TypeError</span> to be
thrown.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-instances-length">19.2.4.1</a>: In Edition 6, the <code>length</code> property of function instances
is configurable. In previous editions it was non-configurable.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-boolean-prototype-object">19.3.3</a> In Edition 6, the Boolean prototype object is not a
Boolean instance. In previous editions it was a Boolean instance whose Boolean value was <b>false</b>.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-number-prototype-object">20.1.3</a> In Edition 6, the Number prototype object is not a
Number instance. In previous editions it was a Number instance whose number value was +0.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object">20.3.4</a> In Edition 6, the Date prototype object is not a Date
instance. In previous editions it was a Date instance whose TimeValue was NaN.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-prototype-object">22.1.3</a> In Edition 6, the Array prototype object is not an Array
instance. In previous editions it was an Array instance with a length property whose value was +0.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-string-prototype-object">21.1.3</a> In Edition 6, the String prototype object is not a
String instance. In previous editions it was a String instance whose String value was the empty string.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.tolowercase">21.1.3.22</a> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.touppercase">21.1.3.24</a> In
Edition 6, lowercase/upper conversion processing operates on code points. In previous editions such the conversion processing
was only applied to individual code units. The only affected code points are those in the Deseret block of Unicode</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.trim">21.1.3.25</a> In Edition 6, the <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.trim">String.prototype.trim</a></code> method is defined to recognize white space code points that
may exists outside of the Unicode BMP. However, as of Unicode 6.1 no such code points are defined. In previous editions such
code points would not have been recognized as white space.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-prototype-object">21.2.5</a> In Edition 6, the RegExp prototype object is not a
RegExp instance. In previous editions it was a RegExp instance whose pattern is the empty string.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-regexp-prototype-object">21.2.5</a> In Edition 6, <code>source</code>, <code>global</code>,
<code>ignoreCase</code>, and <code>multiline</code> are accessor properties defined on the RegExp prototype object. In
previous editions they were data properties defined on RegExp instances.</p>
<p><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-array-prototype-object">22.1.3</a> In Edition 6, the Array prototype object is not an Array
instance. In previous editions it was an Array instance with a length property whose value was +0.</p>
</section>
<section id="sec-in-the-5th-edition">
<h1><span class="secnum" id="sec-D.2"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-in-the-5th-edition" title="link to this section">D.2</a></span> In the
5<sup>th</sup> Edition</h1>
<p>Clause references in this list refer to the clause numbers used in Edition 5 and 5.1.</p>
<p>7.1: Unicode format control characters are no longer stripped from ECMAScript source text before processing. In Edition 5,
if such a character appears in a <span class="nt">StringLiteral</span> or <span class="nt">RegularExpressionLiteral</span> the
character will be incorporated into the literal where in Edition 3 the character would not be incorporated into the
literal.</p>
<p>7.2: Unicode character &lt;BOM&gt; is now treated as whitespace and its presence in the middle of what appears to be an
identifier could result in a syntax error which would not have occurred in Edition 3</p>
<p>7.3: Line terminator characters that are preceded by an escape sequence are now allowed within a string literal token. In
Edition 3 a syntax error would have been produced.</p>
<p>7.8.5: Regular expression literals now return a unique object each time the literal is evaluated. This change is detectable
by any programs that test the object identity of such literal values or that are sensitive to the shared side effects.</p>
<p>7.8.5: Edition 5 requires early reporting of any possible RegExp constructor errors that would be produced when converting
a <span class="nt">RegularExpressionLiteral</span> to a RegExp object. Prior to Edition 5 implementations were permitted to
defer the reporting of such errors until the actual execution time creation of the object.</p>
<p>7.8.5: In Edition 5 unescaped “/” characters may appear as a <span class="nt">CharacterClass</span> in a
regular expression literal. In Edition 3 such a character would have been interpreted as the final character of the
literal.</p>
<p>10.4.2: In Edition 5, indirect calls to the <code>eval</code> function use <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the
global environment</a> as both the variable environment and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-lexical-environments">lexical environment</a> for
the eval code. In Edition 3, the variable and lexical environments of the caller of an indirect <code>eval</code> was used as
the environments for the eval code.</p>
<p>15.4.3: In Edition 5 all methods of <code>Array.prototype</code> are intentionally generic. In Edition 3
<code>toString</code> and <code>toLocaleString</code> were not generic and would throw a <code>TypeError</code> exception if
applied to objects that were not instances of Array.</p>
<p>10.6: In Edition 5 the array indexed properties of argument objects that correspond to actual formal parameters are
enumerable. In Edition 3, such properties were not enumerable.</p>
<p>10.6: In Edition 5 the value of the [[Class]] <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots">internal slot</a>
of an arguments object is <code>"Arguments"</code>. In Edition 3, it was <code>"Object"</code>. This is observable if
<code>toString</code> is called as a method of an arguments object.</p>
<p>12.6.4: for-in statements no longer throw a <b>TypeError</b> if the <code>in</code> expression evaluates to <b>null</b> or
<b>undefined</b>. Instead, the statement behaves as if the value of the expression was an object with no enumerable
properties.</p>
<p>15: In Edition 5, the following new properties are defined on built-in objects that exist in Edition 3: <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getprototypeof">Object.getPrototypeOf</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertydescriptor">Object.getOwnPropertyDescriptor</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertynames">Object.getOwnPropertyNames</a></code>, <b><span style="font-family: monospace"><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.create">Object.create</a></span>,</b> <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperty">Object.defineProperty</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.defineproperties">Object.defineProperties</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.seal">Object.seal</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.freeze">Object.freeze</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.preventextensions">Object.preventExtensions</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.issealed">Object.isSealed</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isfrozen">Object.isFrozen</a></code>,
<code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.isextensible">Object.isExtensible</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys">Object.keys</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.bind">Function.prototype.bind</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.indexof">Array.prototype.indexOf</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.lastindexof">Array.prototype.lastIndexOf</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.every">Array.prototype.every</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.some">Array.prototype.some</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.foreach">Array.prototype.forEach</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.map">Array.prototype.map</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.filter">Array.prototype.filter</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduce">Array.prototype.reduce</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduceright">Array.prototype.reduceRight</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.trim">String.prototype.trim</a></code>, <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.now">Date.now</a></code>,
<code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.toisostring">Date.prototype.toISOString</a>, <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.prototype.tojson">Date.prototype.toJSON</a></code>.</p>
<p>15: Implementations are now required to ignore extra arguments to standard built-in methods unless otherwise explicitly
specified. In Edition 3 the handling of extra arguments was unspecified and implementations were explicitly allowed to throw a
<b>TypeError</b> exception.</p>
<p>15.1.1: The value properties <b>NaN</b>, <b>Infinity</b>, and <b>undefined</b> of the Global Object have been changed to be
read-only properties.</p>
<p>15.1.2.1. Implementations are no longer permitted to restrict the use of eval in ways that are not a direct call. In
addition, any invocation of eval that is not a direct call uses <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global
environment</a> as its variable environment rather than the caller’s variable environment.</p>
<p>15.1.2.2: The specification of the function <code>parseInt</code> no longer allows implementations to treat Strings
beginning with a <code>0</code> character as octal values.</p>
<p>15.3.3.3: In Edition 3, a <b>TypeError</b> is thrown if the second argument passed to <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.apply">Function.prototype.apply</a></code> is neither an array object nor an arguments object.
In Edition 5, the second argument may be any kind of generic array-like object that has a valid <code>length</code>
property.</p>
<p>15.3.3.3,&nbsp;15.3.3.4: In Edition 3 passing <b>undefined</b> or <b>null</b> as the first argument to either <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.apply">Function.prototype.apply</a></code> or <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.call">Function.prototype.call</a></code> causes the global object to be passed to the indirectly
invoked target function as the <b>this</b> value. If the first argument is a primitive value the result of calling <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject">ToObject</a> on the primitive value is passed as the <b>this</b> value. In Edition 5, these
transformations are not performed and the actual first argument value is passed as the <b>this</b> value. This difference will
normally be unobservable to existing ECMAScript Edition 3 code because a corresponding transformation takes place upon
activation of the target function. However, depending upon the implementation, this difference may be observable by host
object functions called using <code>apply</code> or <code>call</code>. In addition, invoking a standard built-in function in
this manner with <b>null</b> or <b>undefined</b> passed as the <b>this</b> value will in many cases cause behaviour in Edition
5 implementations that differ from Edition 3 behaviour. In particular, in Edition 5 built-in functions that are specified to
actually use the passed <b>this</b> value as an object typically throw a <b>TypeError</b> exception if passed <b>null</b> or
<b>undefined</b> as the <b>this</b> value.</p>
<p>15.3.4.2: In Edition 5, the <code>prototype</code> property of Function instances is not enumerable. In Edition 3, this
property was enumerable.</p>
<p>15.5.5.2: In Edition 5, the individual characters of a String object’s [[StringData]] may be accessed as array
indexed properties of the String object. These properties are non-writable and non-configurable and shadow any inherited
properties with the same names. In Edition 3, these properties did not exist and ECMAScript code could dynamically add and
remove writable properties with such names and could access inherited properties with such names.</p>
<p>15.9.4.2: <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-date.parse">Date.parse</a></code> is now required to first attempt to parse its argument as
an ISO format string. Programs that use this format but depended upon implementation specific behaviour (including failure)
may behave differently.</p>
<p>15.10.2.12: In Edition 5, <code>\s</code> now additionally matches &lt;BOM&gt;.</p>
<p>15.10.4.1: In Edition 3, the exact form of the String value of the <code>source</code> property of an object created by the
<code>RegExp</code> constructor is implementation defined. In Edition 5, the String must conform to certain specified
requirements and hence may be different from that produced by an Edition 3 implementation.</p>
<p>15.10.6.4: In Edition 3, the result of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexp.prototype.tostring">RegExp.prototype.toString</a></code>
need not be derived from the value of the RegExp object’s <code>source</code> property. In Edition 5 the result must be
derived from the <code>source</code> property in a specified manner and hence may be different from the result produced by an
Edition 3 implementation.</p>
<p>15.11.2.1, 15.11.4.3: In Edition 5, if an initial value for the <code>message</code> property of an Error object is not
specified via the <code>Error</code> constructor the initial value of the property is the empty String. In Edition 3, such an
initial value is implementation defined.</p>
<p>15.11.4.4: In Edition 3, the result of <code><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.tostring">Error.prototype.toString</a></code>
is implementation defined. In Edition 5, the result is fully specified and hence may differ from some Edition 3
implementations.</p>
<p>15.12: In Edition 5, the name <code>JSON</code> is defined in <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-global-environment-records">the global
environment</a>. In Edition 3, testing for the presence of that name will show it to be <b>undefined</b> unless it is defined
by the program or implementation.</p>
</section>
</section>
<section>
<h1>Bibliography</h1>
<p><span class="marker">[1] </span>IEEE Std 754-2008: IEEE Standard for Floating-Point Arithmetic. Institute of Electrical
and Electronic Engineers, New York (2008)</p>
<p><span class="marker">[2] </span>The Unicode Consortium. The Unicode Standard, Version 3.0, defined by: The Unicode
Standard, Version 3.0 (Reading, MA, Addison-Wesley, 2000. ISBN 0-201-61633-5)</p>
<p><span class="marker">[3] </span>ISO 8601:2004(E) <i>Data elements and interchange formats – Information interchange
-- Representation of dates and times</i></p>
<p><span class="marker">[4] </span>RFC 1738 “Uniform Resource Locators (URL)”, available at
&lt;http://tools.ietf.org/html/rfc1738&gt;</p>
<p><span class="marker">[5] </span>RFC 2396 “Uniform Resource Identifiers (URI): Generic Syntax”, available at
&lt;http://tools.ietf.org/html/rfc2396&gt;</p>
<p><span class="marker">[6] </span>RFC 3629 “UTF-8, a transformation format of ISO 10646”, available at
&lt;http://tools.ietf.org/html/rfc3629&gt;</p>
<p><span class="marker">[7] </span>RFC 4627 “The application/json Media Type for JavaScript Object Notation
(JSON)” , available at &lt;http://tools.ietf.org/html/rfc4627&gt;</p>
<p><span class="marker">[8] </span>Unicode Inc. (2010), Unicode Technical Report #15: “Unicode Normalization
Forms”, available at &lt;http://www.unicode.org/reports/tr15/tr15-29.html&gt;</p>
<p></p>
</section>
</body></html>