Files
ask262/spec-built/multipage/ecmascript-language-statements-and-declarations.html
T

2557 lines
362 KiB
HTML

<!DOCTYPE html><html lang="en-GB-oxendict"><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><meta property="og:image" content="https://tc39.es/ecmarkup/ecma-logo.png"><meta property="og:title" content="ECMAScript® 2026 Language&nbsp;Specification"><meta property="og:description" content="Introduction
This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invent">
<link rel="icon" href="../img/favicon.ico">
<link rel="stylesheet" href="../assets/css/ecmarkup.css"><link rel="stylesheet" href="../assets/css/print.css" media="print">
<title>ECMAScript® 2026 Language&nbsp;Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script><link rel="canonical" href="../#sec-ecmascript-language-statements-and-declarations"></head>
<body><div id="spec-container"><emu-clause id="sec-ecmascript-language-statements-and-declarations">
<h1><span class="secnum">14</span> ECMAScript Language: Statements and Declarations</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="Statement" params="Yield, Await, Return" id="prod-Statement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ktzsppzs" id="prod-c1cDILr5">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21401"><a href="ecmascript-language-statements-and-declarations.html#prod-BlockStatement">BlockStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="xumq1cs6" id="prod-PfH00D1w">
<emu-nt params="?Yield, ?Await" id="_ref_21402"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableStatement">VariableStatement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="cziqu-45" id="prod-YqiTL09y">
<emu-nt id="_ref_21403"><a href="ecmascript-language-statements-and-declarations.html#prod-EmptyStatement">EmptyStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="vt4s4xgg" id="prod-WCz7iwtm">
<emu-nt params="?Yield, ?Await" id="_ref_21404"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="vpvr9yr3" id="prod-jug3e433">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21405"><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="3kwmhgcn">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21406"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="klxmhdlm" id="prod-Ro8XgDsH">
<emu-nt params="?Yield, ?Await" id="_ref_21407"><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="vtt-myod" id="prod-Rrel7YUC">
<emu-nt params="?Yield, ?Await" id="_ref_21408"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="1sriw0nt" constraints="+Return" id="prod-twdIgE_o"><emu-constraints>[+Return]</emu-constraints>
<emu-nt params="?Yield, ?Await" id="_ref_21409"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="_gejjak9" id="prod-xepAqppR">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21410"><a href="ecmascript-language-statements-and-declarations.html#prod-WithStatement">WithStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="90_gq6ig">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21411"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="ukgcnqlt" id="prod-GHPcIp4f">
<emu-nt params="?Yield, ?Await" id="_ref_21412"><a href="ecmascript-language-statements-and-declarations.html#prod-ThrowStatement">ThrowStatement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="z7s8kfe1" id="prod-HB_2xdti">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21413"><a href="ecmascript-language-statements-and-declarations.html#prod-TryStatement">TryStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="iseu28qi" id="prod-bDeNjo3k">
<emu-nt id="_ref_21414"><a href="ecmascript-language-statements-and-declarations.html#prod-DebuggerStatement">DebuggerStatement</a></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="Declaration" params="Yield, Await" id="prod-Declaration">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-Declaration">Declaration</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="i6hr6ytb">
<emu-nt params="?Yield, ?Await, ~Default" id="_ref_21415"><a href="ecmascript-language-statements-and-declarations.html#prod-HoistableDeclaration">HoistableDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ~Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="jfshu5d-" id="prod-o4HYrPz3">
<emu-nt params="?Yield, ?Await, ~Default" id="_ref_21416"><a href="ecmascript-language-functions-and-classes.html#prod-ClassDeclaration">ClassDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ~Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="dl5lsw3w" id="prod-9H9FGeT7">
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21417"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="HoistableDeclaration" params="Yield, Await, Default" id="prod-HoistableDeclaration">
<emu-nt params="Yield, Await, Default"><a href="ecmascript-language-statements-and-declarations.html#prod-HoistableDeclaration">HoistableDeclaration</a><emu-mods><emu-params>[Yield, Await, Default]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="pm1iqgpt" id="prod-xo77HsL9">
<emu-nt params="?Yield, ?Await, ?Default" id="_ref_21418"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ?Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="rhqaxmir" id="prod-dpslEYBS">
<emu-nt params="?Yield, ?Await, ?Default" id="_ref_21419"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorDeclaration">GeneratorDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ?Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="3nfjki-g" id="prod-InkDjQLb">
<emu-nt params="?Yield, ?Await, ?Default" id="_ref_21420"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionDeclaration">AsyncFunctionDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ?Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="e-_qp6dd" id="prod-OBGQy9cZ">
<emu-nt params="?Yield, ?Await, ?Default" id="_ref_21421"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorDeclaration">AsyncGeneratorDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ?Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BreakableStatement" params="Yield, Await, Return" id="prod-BreakableStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="olmcy7ih" id="prod-IZrgrSFg">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21422"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="uzjzv-di" id="prod-r35GfF0W">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21423"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-statement-semantics">
<h1><span class="secnum">14.1</span> Statement Semantics</h1>
<emu-clause id="sec-statement-semantics-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.1.1</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="HoistableDeclaration">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-HoistableDeclaration">HoistableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="r3zmbc2x" id="prod-F2xRdnbO">
<emu-nt id="_ref_21424"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorDeclaration">GeneratorDeclaration</a></emu-nt>
</emu-rhs>
<emu-rhs a="xi-jap6o" id="prod-19_kIcSj">
<emu-nt id="_ref_21425"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionDeclaration">AsyncFunctionDeclaration</a></emu-nt>
</emu-rhs>
<emu-rhs a="n353p_mm" id="prod-AdaKcE7P">
<emu-nt id="_ref_21426"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorDeclaration">AsyncGeneratorDeclaration</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="HoistableDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-HoistableDeclaration">HoistableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="-nqupnlb" id="prod-80Y3L4PZ"><emu-nt id="_ref_21427"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6931"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21428"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>.</li></ol></emu-alg>
<emu-grammar><emu-production name="BreakableStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="kmxl4yum" id="prod-FFjrmEWz">
<emu-nt id="_ref_21429"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="nuio-xfp" id="prod-cXJGjZtb">
<emu-nt id="_ref_21430"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>newLabelSet</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_6932"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Return ?&nbsp;<emu-xref aoid="LabelledEvaluation" id="_ref_6933"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-labelledevaluation" class="e-user-code">LabelledEvaluation</a></emu-xref> of this <emu-nt id="_ref_21431"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a></emu-nt> with argument <var>newLabelSet</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-block">
<h1><span class="secnum">14.2</span> Block</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="BlockStatement" params="Yield, Await, Return" id="prod-BlockStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-BlockStatement">BlockStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="zwpfwt4j">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21432"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="Block" params="Yield, Await, Return" id="prod-Block">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uij9rcu7" id="prod-30nvN6ck">
<emu-t>{</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" optional="" id="_ref_21433"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="StatementList" params="Yield, Await, Return" id="prod-StatementList">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="owubwn_s">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21434"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementListItem">StatementListItem</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="21clqs0p" id="prod--OFVjnjw">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21435"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21436"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementListItem">StatementListItem</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="StatementListItem" params="Yield, Await, Return" id="prod-StatementListItem">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementListItem">StatementListItem</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="septp5sa" id="prod-GHY4Vd3_">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21437"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="mtktetk8" id="prod-yYByJL6Z">
<emu-nt params="?Yield, ?Await" id="_ref_21438"><a href="ecmascript-language-statements-and-declarations.html#prod-Declaration">Declaration</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-block-static-semantics-early-errors" oldids="sec-block-duplicates-allowed-static-semantics"><span id="sec-block-duplicates-allowed-static-semantics"></span>
<h1><span class="secnum">14.2.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="Block" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="z4ljp0ar">
<emu-t>{</emu-t>
<emu-nt id="_ref_21439"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
<p>It is a Syntax Error if the <emu-xref aoid="LexicallyDeclaredNames" id="_ref_6934"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallydeclarednames">LexicallyDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21440"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> contains any duplicate entries<span normative-optional="">, unless the <emu-xref href="#host" id="_ref_6935"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title="" id="_ref_440"><a href="additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics">Block-Level Function Declarations Web Legacy Compatibility Semantics</a></emu-xref>, and both of the following conditions are true:</span></p>
<ul normative-optional="">
<li><emu-xref aoid="IsStrict" id="_ref_6936"><a href="ecmascript-language-source-code.html#sec-isstrict">IsStrict</a></emu-xref>(this production) is <emu-val>false</emu-val>.</li>
<li>The duplicate entries are only bound by FunctionDeclarations.</li>
</ul>
</li>
<li>
It is a Syntax Error if any element of the <emu-xref aoid="LexicallyDeclaredNames" id="_ref_6937"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallydeclarednames">LexicallyDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21441"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> also occurs in the <emu-xref aoid="VarDeclaredNames" id="_ref_6938"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21442"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-block-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.2.2</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="Block" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gbpaspne" id="prod-GN03td2O">
<emu-t>{</emu-t>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="Block" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="z4ljp0ar" id="prod-CUMWT9xI">
<emu-t>{</emu-t>
<emu-nt id="_ref_21443"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_6939"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>blockEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_6940"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>oldEnv</var>).</li><li>Perform <emu-xref aoid="BlockDeclarationInstantiation" id="_ref_6941"><a href="ecmascript-language-statements-and-declarations.html#sec-blockdeclarationinstantiation">BlockDeclarationInstantiation</a></emu-xref>(<emu-nt id="_ref_21444"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>, <var>blockEnv</var>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_6942"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>blockEnv</var>.</li><li>Let <var>blockValue</var> be <emu-xref aoid="Completion" id="_ref_6943"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_6944"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21445"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_6945"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return ?&nbsp;<var>blockValue</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>No matter how control leaves the <emu-nt id="_ref_21446"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> the LexicalEnvironment is always restored to its former state.</p>
</div></emu-note>
<emu-grammar><emu-production name="StatementList" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="dbrzeh7l" id="prod-qY9k7-Mq">
<emu-nt id="_ref_21447"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
<emu-nt id="_ref_21448"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementListItem">StatementListItem</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>sl</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6946"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21449"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>.</li><li>Let <var>s</var> be <emu-xref aoid="Completion" id="_ref_6947"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_6948"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21450"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementListItem">StatementListItem</a></emu-nt>).</li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_6949"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>s</var>, <var>sl</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The value of a <emu-nt id="_ref_21451"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> is the value of the last value-producing item in the <emu-nt id="_ref_21452"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>. For example, the following calls to the <code>eval</code> function all return the value 1:</p>
<pre><code class="javascript hljs"><span class="hljs-built_in">eval</span>(<span class="hljs-string">"1;;;;;"</span>)
<span class="hljs-built_in">eval</span>(<span class="hljs-string">"1;{}"</span>)
<span class="hljs-built_in">eval</span>(<span class="hljs-string">"1;var a;"</span>)</code></pre>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-blockdeclarationinstantiation" type="abstract operation" oldids="sec-web-compat-blockdeclarationinstantiation" aoid="BlockDeclarationInstantiation"><span id="sec-web-compat-blockdeclarationinstantiation"></span>
<h1><span class="secnum">14.2.3</span> BlockDeclarationInstantiation ( <var>code</var>, <var>env</var> )</h1>
<p>The abstract operation BlockDeclarationInstantiation takes arguments <var>code</var> (a <emu-xref href="#sec-syntactic-grammar" id="_ref_6950"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>) and <var>env</var> (a <emu-xref href="#sec-declarative-environment-records" id="_ref_6951"><a href="executable-code-and-execution-contexts.html#sec-declarative-environment-records">Declarative Environment Record</a></emu-xref>) and returns <emu-const>unused</emu-const>. <var>code</var> is the <emu-xref href="#sec-syntactic-grammar" id="_ref_6952"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> corresponding to the body of the block. <var>env</var> is the <emu-xref href="#sec-environment-records" id="_ref_6953"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> in which bindings are to be created.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>When a <emu-nt id="_ref_21453"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> or <emu-nt id="_ref_21454"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> is evaluated a new <emu-xref href="#sec-declarative-environment-records" id="_ref_6954"><a href="executable-code-and-execution-contexts.html#sec-declarative-environment-records">Declarative Environment Record</a></emu-xref> is created and bindings for each block scoped variable, constant, function, or class declared in the block are instantiated in the <emu-xref href="#sec-environment-records" id="_ref_6955"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref>.</p>
</div></emu-note>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>declarations</var> be the <emu-xref aoid="LexicallyScopedDeclarations" id="_ref_6958"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallyscopeddeclarations">LexicallyScopedDeclarations</a></emu-xref> of <var>code</var>.</li><li>Let <var>privateEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_6959"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s PrivateEnvironment.</li><li>For each element <var>d</var> of <var>declarations</var>, do<ol><li>For each element <var>dn</var> of the <emu-xref aoid="BoundNames" id="_ref_6960"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>d</var>, do<ol><li>If <emu-xref aoid="IsConstantDeclaration" id="_ref_6961"><a href="syntax-directed-operations.html#sec-static-semantics-isconstantdeclaration">IsConstantDeclaration</a></emu-xref> of <var>d</var> is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateImmutableBinding" id="_ref_6962"><a href="executable-code-and-execution-contexts.html#abstract-createimmutablebinding">CreateImmutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li id="step-blockdeclarationinstantiation-createmutablebinding" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_6956"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref></div>If the <emu-xref href="#host" id="_ref_6963"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title="" id="_ref_441"><a href="additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics">Block-Level Function Declarations Web Legacy Compatibility Semantics</a></emu-xref>, then<ol><li>If !&nbsp;<var>env</var>.<emu-xref aoid="HasBinding" id="_ref_6964"><a href="executable-code-and-execution-contexts.html#abstract-hasbinding">HasBinding</a></emu-xref>(<var>dn</var>) is <emu-val>false</emu-val>, then<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_6965"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li><li>Else,<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_6966"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li></ol></li><li>If <var>d</var> is either a <emu-nt id="_ref_21455"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>, a <emu-nt id="_ref_21456"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorDeclaration">GeneratorDeclaration</a></emu-nt>, an <emu-nt id="_ref_21457"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionDeclaration">AsyncFunctionDeclaration</a></emu-nt>, or an <emu-nt id="_ref_21458"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorDeclaration">AsyncGeneratorDeclaration</a></emu-nt>, then<ol><li>Let <var>fn</var> be the sole element of the <emu-xref aoid="BoundNames" id="_ref_6967"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>d</var>.</li><li>Let <var>fo</var> be <emu-xref aoid="InstantiateFunctionObject" id="_ref_6968"><a href="syntax-directed-operations.html#sec-runtime-semantics-instantiatefunctionobject">InstantiateFunctionObject</a></emu-xref> of <var>d</var> with arguments <var>env</var> and <var>privateEnv</var>.</li><li id="step-blockdeclarationinstantiation-initializebinding" normative-optional=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_6957"><a href="conformance.html#sec-conformance">Normative Optional</a></emu-xref></div>If the <emu-xref href="#host" id="_ref_6969"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title="" id="_ref_442"><a href="additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics">Block-Level Function Declarations Web Legacy Compatibility Semantics</a></emu-xref>, then<ol><li>If the binding for <var>fn</var> in <var>env</var> is an uninitialized binding, then<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="InitializeBinding" id="_ref_6970"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>fn</var>, <var>fo</var>).</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_6971"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>d</var> is a <emu-nt id="_ref_21459"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>.</li><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="SetMutableBinding" id="_ref_6972"><a href="executable-code-and-execution-contexts.html#abstract-setmutablebinding">SetMutableBinding</a></emu-xref>(<var>fn</var>, <var>fo</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li><li>Else,<ol><li>Perform !&nbsp;<var>env</var>.<emu-xref aoid="InitializeBinding" id="_ref_6973"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>fn</var>, <var>fo</var>).</li></ol></li></ol></li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-declarations-and-the-variable-statement">
<h1><span class="secnum">14.3</span> Declarations and the Variable Statement</h1>
<emu-clause id="sec-let-and-const-declarations">
<h1><span class="secnum">14.3.1</span> Let and Const Declarations</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><code>let</code> and <code>const</code> declarations define variables that are scoped to the <emu-xref href="#running-execution-context" id="_ref_6974"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment. The variables are created when their containing <emu-xref href="#sec-environment-records" id="_ref_6975"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is instantiated but may not be accessed in any way until the variable's <emu-nt id="_ref_21460"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> is evaluated. A variable defined by a <emu-nt id="_ref_21461"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> with an <emu-nt id="_ref_21462"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> is assigned the value of its <emu-nt id="_ref_21463"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>'s <emu-nt id="_ref_21464"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt> when the <emu-nt id="_ref_21465"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> is evaluated, not when the variable is created. If a <emu-nt id="_ref_21466"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> in a <code>let</code> declaration does not have an <emu-nt id="_ref_21467"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> the variable is assigned the value <emu-val>undefined</emu-val> when the <emu-nt id="_ref_21468"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> is evaluated.</p>
</div></emu-note>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="LexicalDeclaration" params="In, Yield, Await" id="prod-LexicalDeclaration">
<emu-nt params="In, Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a><emu-mods><emu-params>[In, Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jsmbgalx" id="prod-10DUWE8d">
<emu-nt id="_ref_21469"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21470"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="LetOrConst" id="prod-LetOrConst">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="laxrvawy" id="prod-7oqY0VPN">
<emu-t>let</emu-t>
</emu-rhs>
<emu-rhs a="nim_d4hb" id="prod-rTRI6GVQ">
<emu-t>const</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="BindingList" params="In, Yield, Await" id="prod-BindingList">
<emu-nt params="In, Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a><emu-mods><emu-params>[In, Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ned6hkwu">
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21471"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="fdx7nvya" id="prod-FYQ2Ly4e">
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21472"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>,</emu-t>
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21473"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="LexicalBinding" params="In, Yield, Await" id="prod-LexicalBinding">
<emu-nt params="In, Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a><emu-mods><emu-params>[In, Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jut8etgz" id="prod-l3Hg2UJ0">
<emu-nt params="?Yield, ?Await" id="_ref_21474"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="?In, ?Yield, ?Await" optional="" id="_ref_21475"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="sdckvxer" id="prod-FppJpMK8">
<emu-nt params="?Yield, ?Await" id="_ref_21476"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21477"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-let-and-const-declarations-static-semantics-early-errors">
<h1><span class="secnum">14.3.1.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="LexicalDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="deqecbrp">
<emu-nt id="_ref_21478"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt id="_ref_21479"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if the <emu-xref aoid="BoundNames" id="_ref_6976"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21480"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt> contains <emu-val>"let"</emu-val>.
</li>
<li>
It is a Syntax Error if the <emu-xref aoid="BoundNames" id="_ref_6977"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21481"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt> contains any duplicate entries.
</li>
</ul>
<emu-grammar><emu-production name="LexicalBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="c5neqctp">
<emu-nt id="_ref_21482"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
<emu-nt optional="" id="_ref_21483"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-nt id="_ref_21484"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> is not present and <emu-xref aoid="IsConstantDeclaration" id="_ref_6978"><a href="syntax-directed-operations.html#sec-static-semantics-isconstantdeclaration">IsConstantDeclaration</a></emu-xref> of the <emu-nt id="_ref_21485"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt> containing this <emu-nt id="_ref_21486"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> is <emu-val>true</emu-val>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-let-and-const-declarations-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.3.1.2</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="LexicalDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="deqecbrp" id="prod-dx4AGe8K">
<emu-nt id="_ref_21487"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt id="_ref_21488"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6979"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21489"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt>.</li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="BindingList" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="dt40zeyt" id="prod-EyFo2V-D">
<emu-nt id="_ref_21490"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt>
<emu-t>,</emu-t>
<emu-nt id="_ref_21491"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6980"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21492"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingList">BindingList</a></emu-nt>.</li><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6981"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21493"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt>.</li></ol></emu-alg>
<emu-grammar><emu-production name="LexicalBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uolyom43" id="prod-mW_TWZBz"><emu-nt id="_ref_21494"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>lhs</var> be !&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_6982"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding">ResolveBinding</a></emu-xref>(<emu-xref aoid="StringValue" id="_ref_6983"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21495"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>).</li><li>Perform !&nbsp;<emu-xref aoid="InitializeReferencedBinding" id="_ref_6984"><a href="ecmascript-data-types-and-values.html#sec-initializereferencedbinding">InitializeReferencedBinding</a></emu-xref>(<var>lhs</var>, <emu-val>undefined</emu-val>).</li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>A <emu-xref href="#sec-static-semantic-rules" id="_ref_6985"><a href="notational-conventions.html#sec-static-semantic-rules">static semantics</a></emu-xref> rule ensures that this form of <emu-nt id="_ref_21496"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> never occurs in a <code>const</code> declaration.</p>
</div></emu-note>
<emu-grammar><emu-production name="LexicalBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ib7lg1vi" id="prod-gOqjOKq_">
<emu-nt id="_ref_21497"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
<emu-nt id="_ref_21498"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>bindingId</var> be the <emu-xref aoid="StringValue" id="_ref_6986"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21499"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>.</li><li>Let <var>lhs</var> be !&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_6987"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding">ResolveBinding</a></emu-xref>(<var>bindingId</var>).</li><li>If <emu-xref aoid="IsAnonymousFunctionDefinition" id="_ref_6988"><a href="syntax-directed-operations.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a></emu-xref>(<emu-nt id="_ref_21500"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>) is <emu-val>true</emu-val>, then<ol><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="NamedEvaluation" id="_ref_6989"><a href="syntax-directed-operations.html#sec-runtime-semantics-namedevaluation" class="e-user-code">NamedEvaluation</a></emu-xref> of <emu-nt id="_ref_21501"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> with argument <var>bindingId</var>.</li></ol></li><li>Else,<ol><li>Let <var>rhs</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6990"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21502"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>.</li><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_6991"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>rhs</var>).</li></ol></li><li>Perform !&nbsp;<emu-xref aoid="InitializeReferencedBinding" id="_ref_6992"><a href="ecmascript-data-types-and-values.html#sec-initializereferencedbinding">InitializeReferencedBinding</a></emu-xref>(<var>lhs</var>, <var>value</var>).</li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="LexicalBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="dd1t5ekf" id="prod-HJPtX-Q7">
<emu-nt id="_ref_21503"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt>
<emu-nt id="_ref_21504"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>rhs</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6993"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21505"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>.</li><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_6994"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>rhs</var>).</li><li>Let <var>env</var> be the <emu-xref href="#running-execution-context" id="_ref_6995"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Return ?&nbsp;<emu-xref aoid="BindingInitialization" id="_ref_6996"><a href="syntax-directed-operations.html#sec-runtime-semantics-bindinginitialization" class="e-user-code">BindingInitialization</a></emu-xref> of <emu-nt id="_ref_21506"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt> with arguments <var>value</var> and <var>env</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-variable-statement">
<h1><span class="secnum">14.3.2</span> Variable Statement</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>A <code>var</code> statement declares variables that are scoped to the <emu-xref href="#running-execution-context" id="_ref_6997"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s VariableEnvironment. Var variables are created when their containing <emu-xref href="#sec-environment-records" id="_ref_6998"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> is instantiated and are initialized to <emu-val>undefined</emu-val> when created. Within the scope of any VariableEnvironment a common <emu-nt id="_ref_21507"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt> may appear in more than one <emu-nt id="_ref_21508"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> but those declarations collectively define only one variable. A variable defined by a <emu-nt id="_ref_21509"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> with an <emu-nt id="_ref_21510"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> is assigned the value of its <emu-nt id="_ref_21511"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>'s <emu-nt id="_ref_21512"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt> when the <emu-nt id="_ref_21513"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> is executed, not when the variable is created.</p>
</div></emu-note>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="VariableStatement" params="Yield, Await" id="prod-VariableStatement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableStatement">VariableStatement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="tbwjaldb" id="prod-03w8p9mr">
<emu-t>var</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21514"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="VariableDeclarationList" params="In, Yield, Await" id="prod-VariableDeclarationList">
<emu-nt params="In, Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a><emu-mods><emu-params>[In, Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ps4sw3ys" id="prod-bXRN6REu">
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21515"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="xsh3skws" id="prod-kqbqpKlK">
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21516"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>,</emu-t>
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21517"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="VariableDeclaration" params="In, Yield, Await" id="prod-VariableDeclaration">
<emu-nt params="In, Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a><emu-mods><emu-params>[In, Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jut8etgz" id="prod-IeHby7A3">
<emu-nt params="?Yield, ?Await" id="_ref_21518"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="?In, ?Yield, ?Await" optional="" id="_ref_21519"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="sdckvxer" id="prod-MhsdViui">
<emu-nt params="?Yield, ?Await" id="_ref_21520"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="?In, ?Yield, ?Await" id="_ref_21521"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[?In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-variable-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.3.2.1</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="VariableStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-VariableStatement">VariableStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="m0ehvb8m" id="prod-3b9-3HdT">
<emu-t>var</emu-t>
<emu-nt id="_ref_21522"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_6999"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21523"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>.</li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="VariableDeclarationList" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="oavweevb" id="prod-mRNvbUb_">
<emu-nt id="_ref_21524"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>
<emu-t>,</emu-t>
<emu-nt id="_ref_21525"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7000"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21526"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>.</li><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7001"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21527"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt>.</li></ol></emu-alg>
<emu-grammar><emu-production name="VariableDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uolyom43" id="prod-DloKhDSp"><emu-nt id="_ref_21528"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="VariableDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ib7lg1vi" id="prod-luUzRvcA">
<emu-nt id="_ref_21529"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
<emu-nt id="_ref_21530"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>bindingId</var> be the <emu-xref aoid="StringValue" id="_ref_7002"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21531"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>.</li><li>Let <var>lhs</var> be ?&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_7003"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding" class="e-user-code">ResolveBinding</a></emu-xref>(<var>bindingId</var>).</li><li>If <emu-xref aoid="IsAnonymousFunctionDefinition" id="_ref_7004"><a href="syntax-directed-operations.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a></emu-xref>(<emu-nt id="_ref_21532"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>) is <emu-val>true</emu-val>, then<ol><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="NamedEvaluation" id="_ref_7005"><a href="syntax-directed-operations.html#sec-runtime-semantics-namedevaluation" class="e-user-code">NamedEvaluation</a></emu-xref> of <emu-nt id="_ref_21533"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> with argument <var>bindingId</var>.</li></ol></li><li>Else,<ol><li>Let <var>rhs</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7006"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21534"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>.</li><li>Let <var>value</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7007"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>rhs</var>).</li></ol></li><li id="step-vardecllist-evaluation-putvalue">Perform ?&nbsp;<emu-xref aoid="PutValue" id="_ref_7008"><a href="ecmascript-data-types-and-values.html#sec-putvalue" class="e-user-code">PutValue</a></emu-xref>(<var>lhs</var>, <var>value</var>).</li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If a <emu-nt id="_ref_21535"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> is nested within a with statement and the <emu-nt id="_ref_21536"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt> in the <emu-nt id="_ref_21537"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> is the same as a <emu-xref href="#property-name" id="_ref_7009"><a href="ecmascript-data-types-and-values.html#property-name">property name</a></emu-xref> of the binding object of the with statement's <emu-xref href="#sec-object-environment-records" id="_ref_7010"><a href="executable-code-and-execution-contexts.html#sec-object-environment-records">Object Environment Record</a></emu-xref>, then step <emu-xref href="#step-vardecllist-evaluation-putvalue" id="_ref_443"><a href="ecmascript-language-statements-and-declarations.html#step-vardecllist-evaluation-putvalue">5</a></emu-xref> will assign <var>value</var> to the property instead of assigning to the VariableEnvironment binding of the <emu-nt id="_ref_21538"><a href="ecmascript-language-expressions.html#prod-Identifier">Identifier</a></emu-nt>.</p>
</div></emu-note>
<emu-grammar><emu-production name="VariableDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclaration">VariableDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="dd1t5ekf" id="prod-615TDHeB">
<emu-nt id="_ref_21539"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt>
<emu-nt id="_ref_21540"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>rhs</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7011"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21541"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>.</li><li>Let <var>rVal</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7012"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>rhs</var>).</li><li>Return ?&nbsp;<emu-xref aoid="BindingInitialization" id="_ref_7013"><a href="syntax-directed-operations.html#sec-runtime-semantics-bindinginitialization" class="e-user-code">BindingInitialization</a></emu-xref> of <emu-nt id="_ref_21542"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt> with arguments <var>rVal</var> and <emu-val>undefined</emu-val>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-destructuring-binding-patterns">
<h1><span class="secnum">14.3.3</span> Destructuring Binding Patterns</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="BindingPattern" params="Yield, Await" id="prod-BindingPattern">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="fwd2jmee" id="prod-5GwwFymY">
<emu-nt params="?Yield, ?Await" id="_ref_21543"><a href="ecmascript-language-statements-and-declarations.html#prod-ObjectBindingPattern">ObjectBindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="hpyn1kot" id="prod-nQ2ZFnUa">
<emu-nt params="?Yield, ?Await" id="_ref_21544"><a href="ecmascript-language-statements-and-declarations.html#prod-ArrayBindingPattern">ArrayBindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="ObjectBindingPattern" params="Yield, Await" id="prod-ObjectBindingPattern">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ObjectBindingPattern">ObjectBindingPattern</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gbpaspne" id="prod-Zq1KBCx2">
<emu-t>{</emu-t>
<emu-t>}</emu-t>
</emu-rhs>
<emu-rhs a="u51ece_j" id="prod-5lmgiaFr">
<emu-t>{</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21545"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestProperty">BindingRestProperty</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
<emu-rhs a="sd_sxlxl" id="prod-xrMoI6uo">
<emu-t>{</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21546"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
<emu-rhs a="98sthfnw" id="prod-ZImPf3XQ">
<emu-t>{</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21547"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>,</emu-t>
<emu-nt params="?Yield, ?Await" optional="" id="_ref_21548"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestProperty">BindingRestProperty</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="ArrayBindingPattern" params="Yield, Await" id="prod-ArrayBindingPattern">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ArrayBindingPattern">ArrayBindingPattern</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="82yazf9m" id="prod-GTLtfjt0">
<emu-t>[</emu-t>
<emu-nt optional="" id="_ref_21549"><a href="ecmascript-language-expressions.html#prod-Elision">Elision</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await" optional="" id="_ref_21550"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestElement">BindingRestElement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>]</emu-t>
</emu-rhs>
<emu-rhs a="tz2jlcig">
<emu-t>[</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21551"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElementList">BindingElementList</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>]</emu-t>
</emu-rhs>
<emu-rhs a="ezfh7oge" id="prod-ZEEMEcAo">
<emu-t>[</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21552"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElementList">BindingElementList</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>,</emu-t>
<emu-nt optional="" id="_ref_21553"><a href="ecmascript-language-expressions.html#prod-Elision">Elision</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await" optional="" id="_ref_21554"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestElement">BindingRestElement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>]</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="BindingRestProperty" params="Yield, Await" id="prod-BindingRestProperty">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestProperty">BindingRestProperty</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="nldxez3v" id="prod-ltwW708a">
<emu-t>...</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21555"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BindingPropertyList" params="Yield, Await" id="prod-BindingPropertyList">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="8baidhkc">
<emu-nt params="?Yield, ?Await" id="_ref_21556"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="ewlfehxq" id="prod-TkJ_upuv">
<emu-nt params="?Yield, ?Await" id="_ref_21557"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>,</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21558"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BindingElementList" params="Yield, Await" id="prod-BindingElementList">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElementList">BindingElementList</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="lpaw4nny">
<emu-nt params="?Yield, ?Await" id="_ref_21559"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElisionElement">BindingElisionElement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="5z8zw101" id="prod-QAGJVJ9v">
<emu-nt params="?Yield, ?Await" id="_ref_21560"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElementList">BindingElementList</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>,</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21561"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElisionElement">BindingElisionElement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BindingElisionElement" params="Yield, Await" id="prod-BindingElisionElement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElisionElement">BindingElisionElement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="5jbcqvdg" id="prod-eAKFkNTn">
<emu-nt optional="" id="_ref_21562"><a href="ecmascript-language-expressions.html#prod-Elision">Elision</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await" id="_ref_21563"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElement">BindingElement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BindingProperty" params="Yield, Await" id="prod-BindingProperty">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="01jnavb_" id="prod-P9s8hLuP">
<emu-nt params="?Yield, ?Await" id="_ref_21564"><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="xcksc8qh" id="prod-VmvTFDAY">
<emu-nt params="?Yield, ?Await" id="_ref_21565"><a href="ecmascript-language-expressions.html#prod-PropertyName">PropertyName</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>:</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21566"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElement">BindingElement</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BindingElement" params="Yield, Await" id="prod-BindingElement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElement">BindingElement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="01jnavb_">
<emu-nt params="?Yield, ?Await" id="_ref_21567"><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="eyv5t9mz" id="prod-qY39_uPQ">
<emu-nt params="?Yield, ?Await" id="_ref_21568"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21569"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="SingleNameBinding" params="Yield, Await" id="prod-SingleNameBinding">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="mg7mmvow" id="prod-8lbkfoVZ">
<emu-nt params="?Yield, ?Await" id="_ref_21570"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21571"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="BindingRestElement" params="Yield, Await" id="prod-BindingRestElement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestElement">BindingRestElement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="nldxez3v" id="prod-0fOwNHr-">
<emu-t>...</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21572"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="lb7grnzq" id="prod-iBHkClE5">
<emu-t>...</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21573"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-destructuring-binding-patterns-runtime-semantics-propertybindinginitialization" type="sdo" aoid="PropertyBindingInitialization">
<h1><span class="secnum">14.3.3.1</span> Runtime Semantics: PropertyBindingInitialization</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7014"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> PropertyBindingInitialization takes arguments <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7015"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>environment</var> (an <emu-xref href="#sec-environment-records" id="_ref_7016"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> or <emu-val>undefined</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7017"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7018"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_7019"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7020"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It collects a list of all bound <emu-xref href="#property-name" id="_ref_7021"><a href="ecmascript-data-types-and-values.html#property-name">property names</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="BindingPropertyList" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="bzdeo9zt" id="prod-jhtKd-Y5">
<emu-nt id="_ref_21574"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a></emu-nt>
<emu-t>,</emu-t>
<emu-nt id="_ref_21575"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>boundNames</var> be ?&nbsp;<emu-xref aoid="PropertyBindingInitialization" id="_ref_7022"><a href="ecmascript-language-statements-and-declarations.html#sec-destructuring-binding-patterns-runtime-semantics-propertybindinginitialization" class="e-user-code">PropertyBindingInitialization</a></emu-xref> of <emu-nt id="_ref_21576"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPropertyList">BindingPropertyList</a></emu-nt> with arguments <var>value</var> and <var>environment</var>.</li><li>Let <var>nextNames</var> be ?&nbsp;<emu-xref aoid="PropertyBindingInitialization" id="_ref_7023"><a href="ecmascript-language-statements-and-declarations.html#sec-destructuring-binding-patterns-runtime-semantics-propertybindinginitialization" class="e-user-code">PropertyBindingInitialization</a></emu-xref> of <emu-nt id="_ref_21577"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a></emu-nt> with arguments <var>value</var> and <var>environment</var>.</li><li>Return the <emu-xref href="#list-concatenation" id="_ref_7024"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>boundNames</var> and <var>nextNames</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="BindingProperty" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="lof8ala-" id="prod--5EhKk0m"><emu-nt id="_ref_21578"><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>name</var> be the sole element of the <emu-xref aoid="BoundNames" id="_ref_7025"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21579"><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a></emu-nt>.</li><li>Perform ?&nbsp;<emu-xref aoid="KeyedBindingInitialization" id="_ref_7026"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-keyedbindinginitialization" class="e-user-code">KeyedBindingInitialization</a></emu-xref> of <emu-nt id="_ref_21580"><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a></emu-nt> with arguments <var>value</var>, <var>environment</var>, and <var>name</var>.</li><li>Return « <var>name</var>&nbsp;».</li></ol></emu-alg>
<emu-grammar><emu-production name="BindingProperty" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BindingProperty">BindingProperty</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="mhvrwluk" id="prod-1euONYQ-">
<emu-nt id="_ref_21581"><a href="ecmascript-language-expressions.html#prod-PropertyName">PropertyName</a></emu-nt>
<emu-t>:</emu-t>
<emu-nt id="_ref_21582"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElement">BindingElement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>P</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7027"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21583"><a href="ecmascript-language-expressions.html#prod-PropertyName">PropertyName</a></emu-nt>.</li><li>Perform ?&nbsp;<emu-xref aoid="KeyedBindingInitialization" id="_ref_7028"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-keyedbindinginitialization" class="e-user-code">KeyedBindingInitialization</a></emu-xref> of <emu-nt id="_ref_21584"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElement">BindingElement</a></emu-nt> with arguments <var>value</var>, <var>environment</var>, and <var>P</var>.</li><li>Return « <var>P</var>&nbsp;».</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-destructuring-binding-patterns-runtime-semantics-restbindinginitialization" type="sdo" aoid="RestBindingInitialization">
<h1><span class="secnum">14.3.3.2</span> Runtime Semantics: RestBindingInitialization</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7029"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> RestBindingInitialization takes arguments <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7030"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), <var>environment</var> (an <emu-xref href="#sec-environment-records" id="_ref_7031"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> or <emu-val>undefined</emu-val>), and <var>excludedNames</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7032"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#property-key" id="_ref_7033"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7034"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-const>unused</emu-const> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7035"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="BindingRestProperty" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BindingRestProperty">BindingRestProperty</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ffhe3nqa" id="prod-jjw6mbi6">
<emu-t>...</emu-t>
<emu-nt id="_ref_21585"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>lhs</var> be ?&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_7036"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding" class="e-user-code">ResolveBinding</a></emu-xref>(<emu-xref aoid="StringValue" id="_ref_7037"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21586"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>, <var>environment</var>).</li><li>Let <var>restObj</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_7038"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_7039"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>).</li><li>Perform ?&nbsp;<emu-xref aoid="CopyDataProperties" id="_ref_7040"><a href="abstract-operations.html#sec-copydataproperties" class="e-user-code">CopyDataProperties</a></emu-xref>(<var>restObj</var>, <var>value</var>, <var>excludedNames</var>).</li><li>If <var>environment</var> is <emu-val>undefined</emu-val>, return ?&nbsp;<emu-xref aoid="PutValue" id="_ref_7041"><a href="ecmascript-data-types-and-values.html#sec-putvalue" class="e-user-code">PutValue</a></emu-xref>(<var>lhs</var>, <var>restObj</var>).</li><li>Return ?&nbsp;<emu-xref aoid="InitializeReferencedBinding" id="_ref_7042"><a href="ecmascript-data-types-and-values.html#sec-initializereferencedbinding">InitializeReferencedBinding</a></emu-xref>(<var>lhs</var>, <var>restObj</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-keyedbindinginitialization" type="sdo" aoid="KeyedBindingInitialization">
<h1><span class="secnum">14.3.3.3</span> Runtime Semantics: KeyedBindingInitialization</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7043"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> KeyedBindingInitialization takes arguments <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7044"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), <var>environment</var> (an <emu-xref href="#sec-environment-records" id="_ref_7045"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> or <emu-val>undefined</emu-val>), and <var>propertyName</var> (a <emu-xref href="#property-key" id="_ref_7046"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7047"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-const>unused</emu-const> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7048"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>When <emu-val>undefined</emu-val> is passed for <var>environment</var> it indicates that a <emu-xref aoid="PutValue" id="_ref_7049"><a href="ecmascript-data-types-and-values.html#sec-putvalue">PutValue</a></emu-xref> operation should be used to assign the initialization value. This is the case for formal parameter lists of <emu-xref href="#non-strict-function" id="_ref_7050"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref>. 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></emu-note>
<p>It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="BindingElement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BindingElement">BindingElement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ahx6lm0w" id="prod-kKvAd4Kx">
<emu-nt id="_ref_21587"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt>
<emu-nt optional="" id="_ref_21588"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>v</var> be ?&nbsp;<emu-xref aoid="GetV" id="_ref_7051"><a href="abstract-operations.html#sec-getv" class="e-user-code">GetV</a></emu-xref>(<var>value</var>, <var>propertyName</var>).</li><li>If <emu-nt id="_ref_21589"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> is present and <var>v</var> is <emu-val>undefined</emu-val>, then<ol><li>Let <var>defaultValue</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7052"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21590"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>.</li><li>Set <var>v</var> to ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7053"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>defaultValue</var>).</li></ol></li><li>Return ?&nbsp;<emu-xref aoid="BindingInitialization" id="_ref_7054"><a href="syntax-directed-operations.html#sec-runtime-semantics-bindinginitialization" class="e-user-code">BindingInitialization</a></emu-xref> of <emu-nt id="_ref_21591"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt> with arguments <var>v</var> and <var>environment</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="SingleNameBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-SingleNameBinding">SingleNameBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="c5neqctp" id="prod-v4J727kL">
<emu-nt id="_ref_21592"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>
<emu-nt optional="" id="_ref_21593"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>bindingId</var> be the <emu-xref aoid="StringValue" id="_ref_7055"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21594"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>.</li><li>Let <var>lhs</var> be ?&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_7056"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding" class="e-user-code">ResolveBinding</a></emu-xref>(<var>bindingId</var>, <var>environment</var>).</li><li>Let <var>v</var> be ?&nbsp;<emu-xref aoid="GetV" id="_ref_7057"><a href="abstract-operations.html#sec-getv" class="e-user-code">GetV</a></emu-xref>(<var>value</var>, <var>propertyName</var>).</li><li>If <emu-nt id="_ref_21595"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> is present and <var>v</var> is <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="IsAnonymousFunctionDefinition" id="_ref_7058"><a href="syntax-directed-operations.html#sec-isanonymousfunctiondefinition">IsAnonymousFunctionDefinition</a></emu-xref>(<emu-nt id="_ref_21596"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>) is <emu-val>true</emu-val>, then<ol><li>Set <var>v</var> to ?&nbsp;<emu-xref aoid="NamedEvaluation" id="_ref_7059"><a href="syntax-directed-operations.html#sec-runtime-semantics-namedevaluation" class="e-user-code">NamedEvaluation</a></emu-xref> of <emu-nt id="_ref_21597"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt> with argument <var>bindingId</var>.</li></ol></li><li>Else,<ol><li>Let <var>defaultValue</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7060"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21598"><a href="ecmascript-language-expressions.html#prod-Initializer">Initializer</a></emu-nt>.</li><li>Set <var>v</var> to ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7061"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>defaultValue</var>).</li></ol></li></ol></li><li>If <var>environment</var> is <emu-val>undefined</emu-val>, return ?&nbsp;<emu-xref aoid="PutValue" id="_ref_7062"><a href="ecmascript-data-types-and-values.html#sec-putvalue" class="e-user-code">PutValue</a></emu-xref>(<var>lhs</var>, <var>v</var>).</li><li>Return ?&nbsp;<emu-xref aoid="InitializeReferencedBinding" id="_ref_7063"><a href="ecmascript-data-types-and-values.html#sec-initializereferencedbinding">InitializeReferencedBinding</a></emu-xref>(<var>lhs</var>, <var>v</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-empty-statement">
<h1><span class="secnum">14.4</span> Empty Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="EmptyStatement" id="prod-EmptyStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-EmptyStatement">EmptyStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="sg2sawim" id="prod-hl28S5p6">
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-empty-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.4.1</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="EmptyStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-EmptyStatement">EmptyStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="sg2sawim" id="prod-il1Ue5QP"><emu-t>;</emu-t></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-expression-statement">
<h1><span class="secnum">14.5</span> Expression Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="ExpressionStatement" params="Yield, Await" id="prod-ExpressionStatement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="nmo0iroq" id="prod-XGPiPhtM">
<emu-gann>[lookahead ∉ { <emu-t>{</emu-t>, <emu-t>function</emu-t>, <emu-t>async</emu-t>
<emu-gann>[no <emu-nt id="_ref_21599"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</emu-gann>
<emu-t>function</emu-t>, <emu-t>class</emu-t>, <emu-t>let</emu-t>
<emu-t>[</emu-t> }]</emu-gann>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21600"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>An <emu-nt id="_ref_21601"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt> cannot start with a U+007B (LEFT CURLY BRACKET) because that might make it ambiguous with a <emu-nt id="_ref_21602"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>. An <emu-nt id="_ref_21603"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt> cannot start with the <code>function</code> or <code>class</code> <emu-xref href="#sec-keywords-and-reserved-words" id="_ref_7064"><a href="ecmascript-language-lexical-grammar.html#sec-keywords-and-reserved-words">keywords</a></emu-xref> because that would make it ambiguous with a <emu-nt id="_ref_21604"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>, a <emu-nt id="_ref_21605"><a href="ecmascript-language-functions-and-classes.html#prod-GeneratorDeclaration">GeneratorDeclaration</a></emu-nt>, or a <emu-nt id="_ref_21606"><a href="ecmascript-language-functions-and-classes.html#prod-ClassDeclaration">ClassDeclaration</a></emu-nt>. An <emu-nt id="_ref_21607"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt> cannot start with <code>async function</code> because that would make it ambiguous with an <emu-nt id="_ref_21608"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncFunctionDeclaration">AsyncFunctionDeclaration</a></emu-nt> or a <emu-nt id="_ref_21609"><a href="ecmascript-language-functions-and-classes.html#prod-AsyncGeneratorDeclaration">AsyncGeneratorDeclaration</a></emu-nt>. An <emu-nt id="_ref_21610"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt> cannot start with the two token sequence <code>let [</code> because that would make it ambiguous with a <code>let</code> <emu-nt id="_ref_21611"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt> whose first <emu-nt id="_ref_21612"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalBinding">LexicalBinding</a></emu-nt> was an <emu-nt id="_ref_21613"><a href="ecmascript-language-statements-and-declarations.html#prod-ArrayBindingPattern">ArrayBindingPattern</a></emu-nt>.</p>
</div></emu-note>
<emu-clause id="sec-expression-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.5.1</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="ExpressionStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="4ttdnuln" id="prod-zmcsioZW">
<emu-nt id="_ref_21614"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7065"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21615"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Return ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7066"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-if-statement">
<h1><span class="secnum">14.6</span> The <code>if</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="IfStatement" params="Yield, Await, Return" id="prod-IfStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gvkksvw-" id="prod-_lf1EvXT">
<emu-t>if</emu-t>
<emu-t>(</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21616"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21617"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-t>else</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21618"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="x9p_cd-n" id="prod--e2u-nCd">
<emu-t>if</emu-t>
<emu-t>(</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21619"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21620"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-gann>[lookahead ≠ <emu-t>else</emu-t>]</emu-gann>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note</span><div class="note-contents">The lookahead-restriction [lookahead ≠ <code>else</code>] resolves the classic "dangling else" problem in the usual way. That is, when the choice of associated <code>if</code> is otherwise ambiguous, the <code>else</code> is associated with the nearest (innermost) of the candidate <code>if</code>s</div></emu-note>
<emu-clause id="sec-if-statement-static-semantics-early-errors">
<h1><span class="secnum">14.6.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="IfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="fuhqe2xq">
<emu-t>if</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21621"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21622"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
<emu-t>else</emu-t>
<emu-nt id="_ref_21623"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7067"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(the first <emu-nt id="_ref_21624"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7068"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(the second <emu-nt id="_ref_21625"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-grammar><emu-production name="IfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="9ogvciaf">
<emu-t>if</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21626"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21627"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7069"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<emu-nt id="_ref_21628"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is only necessary to apply this rule if the extension specified in <emu-xref href="#sec-labelled-function-declarations" id="_ref_444"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">B.3.1</a></emu-xref> is implemented.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-if-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.6.2</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="IfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="fuhqe2xq" id="prod-V-mFBCSX">
<emu-t>if</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21629"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21630"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
<emu-t>else</emu-t>
<emu-nt id="_ref_21631"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7070"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21632"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>exprValue</var> be <emu-xref aoid="ToBoolean" id="_ref_7071"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="GetValue" id="_ref_7072"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>)).</li><li>If <var>exprValue</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>stmtCompletion</var> be <emu-xref aoid="Completion" id="_ref_7073"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7074"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of the first <emu-nt id="_ref_21633"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>).</li></ol></li><li>Else,<ol><li>Let <var>stmtCompletion</var> be <emu-xref aoid="Completion" id="_ref_7075"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7076"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of the second <emu-nt id="_ref_21634"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>).</li></ol></li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7077"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>stmtCompletion</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
<emu-grammar><emu-production name="IfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="9ogvciaf" id="prod-31mgDA5h">
<emu-t>if</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21635"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21636"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7078"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21637"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>exprValue</var> be <emu-xref aoid="ToBoolean" id="_ref_7079"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="GetValue" id="_ref_7080"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>)).</li><li>If <var>exprValue</var> is <emu-val>false</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Let <var>stmtCompletion</var> be <emu-xref aoid="Completion" id="_ref_7081"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7082"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21638"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>).</li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7083"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>stmtCompletion</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-iteration-statements">
<h1><span class="secnum">14.7</span> Iteration Statements</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="IterationStatement" params="Yield, Await, Return" id="prod-IterationStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="cfhtf2jt" id="prod-nthWw5bM">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21639"><a href="ecmascript-language-statements-and-declarations.html#prod-DoWhileStatement">DoWhileStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="v6obhs7z" id="prod-J0YbLQ2x">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21640"><a href="ecmascript-language-statements-and-declarations.html#prod-WhileStatement">WhileStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="cito49hq" id="prod-r-Sjm4F3">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21641"><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="ysjy7ne3" id="prod-Q0CapowH">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21642"><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-iteration-statements-semantics">
<h1><span class="secnum">14.7.1</span> Semantics</h1>
<emu-clause id="sec-loopcontinues" type="abstract operation" aoid="LoopContinues">
<h1><span class="secnum">14.7.1.1</span> LoopContinues ( <var>completion</var>, <var>labelSet</var> )</h1>
<p>The abstract operation LoopContinues takes arguments <var>completion</var> (a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7084"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>) and <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7085"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>completion</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7086"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref>, return <emu-val>true</emu-val>.</li><li>If <var>completion</var> is not a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7087"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">continue completion</a></emu-xref>, return <emu-val>false</emu-val>.</li><li>If <var>completion</var>.<var class="field">[[Target]]</var> is <emu-const>empty</emu-const>, return <emu-val>true</emu-val>.</li><li>If <var>labelSet</var> contains <var>completion</var>.<var class="field">[[Target]]</var>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Within the <emu-nt id="_ref_21643"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> part of an <emu-nt id="_ref_21644"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> a <emu-nt id="_ref_21645"><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a></emu-nt> may be used to begin a new iteration.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-runtime-semantics-loopevaluation" type="sdo" aoid="LoopEvaluation">
<h1><span class="secnum">14.7.1.2</span> Runtime Semantics: LoopEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7088"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> LoopEvaluation takes argument <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7089"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7090"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7091"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7092"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="IterationStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="wbcc1u-6" id="prod-bY0mbJsd"><emu-nt id="_ref_21646"><a href="ecmascript-language-statements-and-declarations.html#prod-DoWhileStatement">DoWhileStatement</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="DoWhileLoopEvaluation" id="_ref_7093"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-dowhileloopevaluation" class="e-user-code">DoWhileLoopEvaluation</a></emu-xref> of <emu-nt id="_ref_21647"><a href="ecmascript-language-statements-and-declarations.html#prod-DoWhileStatement">DoWhileStatement</a></emu-nt> with argument <var>labelSet</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="IterationStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="_jk9wnip" id="prod-pBcbxGRB"><emu-nt id="_ref_21648"><a href="ecmascript-language-statements-and-declarations.html#prod-WhileStatement">WhileStatement</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="WhileLoopEvaluation" id="_ref_7094"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-whileloopevaluation" class="e-user-code">WhileLoopEvaluation</a></emu-xref> of <emu-nt id="_ref_21649"><a href="ecmascript-language-statements-and-declarations.html#prod-WhileStatement">WhileStatement</a></emu-nt> with argument <var>labelSet</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="IterationStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="brkouqxh" id="prod-FuTGGBHg"><emu-nt id="_ref_21650"><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ForLoopEvaluation" id="_ref_7095"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forloopevaluation" class="e-user-code">ForLoopEvaluation</a></emu-xref> of <emu-nt id="_ref_21651"><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt> with argument <var>labelSet</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="IterationStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="wium6lig" id="prod-RfvZcfJK"><emu-nt id="_ref_21652"><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ForInOfLoopEvaluation" id="_ref_7096"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofloopevaluation" class="e-user-code">ForInOfLoopEvaluation</a></emu-xref> of <emu-nt id="_ref_21653"><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> with argument <var>labelSet</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-do-while-statement">
<h1><span class="secnum">14.7.2</span> The <code>do</code>-<code>while</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="DoWhileStatement" params="Yield, Await, Return" id="prod-DoWhileStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-DoWhileStatement">DoWhileStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="eiknjnpu" id="prod-9vnoeXX4">
<emu-t>do</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21654"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-t>while</emu-t>
<emu-t>(</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21655"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-do-while-statement-static-semantics-early-errors">
<h1><span class="secnum">14.7.2.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="DoWhileStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-DoWhileStatement">DoWhileStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jocmqoht">
<emu-t>do</emu-t>
<emu-nt id="_ref_21656"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
<emu-t>while</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21657"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7097"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<emu-nt id="_ref_21658"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is only necessary to apply this rule if the extension specified in <emu-xref href="#sec-labelled-function-declarations" id="_ref_445"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">B.3.1</a></emu-xref> is implemented.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-runtime-semantics-dowhileloopevaluation" oldids="sec-do-while-statement-runtime-semantics-labelledevaluation" type="sdo" aoid="DoWhileLoopEvaluation"><span id="sec-do-while-statement-runtime-semantics-labelledevaluation"></span>
<h1><span class="secnum">14.7.2.2</span> Runtime Semantics: DoWhileLoopEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7098"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> DoWhileLoopEvaluation takes argument <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7099"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7100"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7101"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7102"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="DoWhileStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-DoWhileStatement">DoWhileStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jocmqoht" id="prod-3uzJdijq">
<emu-t>do</emu-t>
<emu-nt id="_ref_21659"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
<emu-t>while</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21660"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>V</var> be <emu-val>undefined</emu-val>.</li><li>Repeat,<ol><li>Let <var>stmtResult</var> be <emu-xref aoid="Completion" id="_ref_7103"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7104"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21661"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>).</li><li>If <emu-xref aoid="LoopContinues" id="_ref_7105"><a href="ecmascript-language-statements-and-declarations.html#sec-loopcontinues">LoopContinues</a></emu-xref>(<var>stmtResult</var>, <var>labelSet</var>) is <emu-val>false</emu-val>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7106"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>stmtResult</var>, <var>V</var>).</li><li>If <var>stmtResult</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>stmtResult</var>.<var class="field">[[Value]]</var>.</li><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7107"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21662"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>exprValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7108"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li><li>If <emu-xref aoid="ToBoolean" id="_ref_7109"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(<var>exprValue</var>) is <emu-val>false</emu-val>, return <var>V</var>.</li></ol></li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-while-statement">
<h1><span class="secnum">14.7.3</span> The <code>while</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="WhileStatement" params="Yield, Await, Return" id="prod-WhileStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-WhileStatement">WhileStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="awcw0xuh" id="prod-Tx40AFG0">
<emu-t>while</emu-t>
<emu-t>(</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21663"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21664"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-while-statement-static-semantics-early-errors">
<h1><span class="secnum">14.7.3.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="WhileStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-WhileStatement">WhileStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="92j78-b5">
<emu-t>while</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21665"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21666"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7110"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<emu-nt id="_ref_21667"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is only necessary to apply this rule if the extension specified in <emu-xref href="#sec-labelled-function-declarations" id="_ref_446"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">B.3.1</a></emu-xref> is implemented.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-runtime-semantics-whileloopevaluation" oldids="sec-while-statement-runtime-semantics-labelledevaluation" type="sdo" aoid="WhileLoopEvaluation"><span id="sec-while-statement-runtime-semantics-labelledevaluation"></span>
<h1><span class="secnum">14.7.3.2</span> Runtime Semantics: WhileLoopEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7111"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> WhileLoopEvaluation takes argument <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7112"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7113"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7114"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7115"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="WhileStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-WhileStatement">WhileStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="92j78-b5" id="prod-0mdwhc7l">
<emu-t>while</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21668"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21669"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>V</var> be <emu-val>undefined</emu-val>.</li><li>Repeat,<ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7116"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21670"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>exprValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7117"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li><li>If <emu-xref aoid="ToBoolean" id="_ref_7118"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(<var>exprValue</var>) is <emu-val>false</emu-val>, return <var>V</var>.</li><li>Let <var>stmtResult</var> be <emu-xref aoid="Completion" id="_ref_7119"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7120"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21671"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>).</li><li>If <emu-xref aoid="LoopContinues" id="_ref_7121"><a href="ecmascript-language-statements-and-declarations.html#sec-loopcontinues">LoopContinues</a></emu-xref>(<var>stmtResult</var>, <var>labelSet</var>) is <emu-val>false</emu-val>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7122"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>stmtResult</var>, <var>V</var>).</li><li>If <var>stmtResult</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>stmtResult</var>.<var class="field">[[Value]]</var>.</li></ol></li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-for-statement">
<h1><span class="secnum">14.7.4</span> The <code>for</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="ForStatement" params="Yield, Await, Return" id="prod-ForStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="honbm3zg" id="prod-NvPgd2yM">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-gann>[lookahead ≠ <emu-t>let</emu-t>
<emu-t>[</emu-t>]</emu-gann>
<emu-nt params="~In, ?Yield, ?Await" optional="" id="_ref_21672"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[~In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21673"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21674"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21675"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="frhzdc45" id="prod-pYXfSJG_">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt params="~In, ?Yield, ?Await" id="_ref_21676"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a><emu-mods><emu-params>[~In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21677"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21678"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21679"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="ibe-o3pw" id="prod-0Y0bZAvD">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt params="~In, ?Yield, ?Await" id="_ref_21680"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a><emu-mods><emu-params>[~In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21681"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt params="+In, ?Yield, ?Await" optional="" id="_ref_21682"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21683"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-for-statement-static-semantics-early-errors">
<h1><span class="secnum">14.7.4.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="ForStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="_do88got">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt optional="" id="_ref_21684"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21685"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21686"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21687"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="sodmtko8">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21688"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21689"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21690"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21691"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="k8b-ryxj">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21692"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
<emu-nt optional="" id="_ref_21693"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21694"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21695"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7123"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<emu-nt id="_ref_21696"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is only necessary to apply this rule if the extension specified in <emu-xref href="#sec-labelled-function-declarations" id="_ref_447"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">B.3.1</a></emu-xref> is implemented.</p>
</div></emu-note>
<emu-grammar><emu-production name="ForStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="k8b-ryxj">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21697"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
<emu-nt optional="" id="_ref_21698"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21699"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21700"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if any element of the <emu-xref aoid="BoundNames" id="_ref_7124"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21701"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt> also occurs in the <emu-xref aoid="VarDeclaredNames" id="_ref_7125"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21702"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-runtime-semantics-forloopevaluation" oldids="sec-for-statement-runtime-semantics-labelledevaluation" type="sdo" aoid="ForLoopEvaluation"><span id="sec-for-statement-runtime-semantics-labelledevaluation"></span>
<h1><span class="secnum">14.7.4.2</span> Runtime Semantics: ForLoopEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7126"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> ForLoopEvaluation takes argument <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7127"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7128"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7129"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7130"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="ForStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="_do88got" id="prod-qUCVnDNm">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt optional="" id="_ref_21703"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21704"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21705"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21706"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>If the first <emu-nt id="_ref_21707"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, then<ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7131"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of the first <emu-nt id="_ref_21708"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Perform ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7132"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li></ol></li><li>If the second <emu-nt id="_ref_21709"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, let <var>test</var> be the second <emu-nt id="_ref_21710"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>; else let <var>test</var> be <emu-const>empty</emu-const>.</li><li>If the third <emu-nt id="_ref_21711"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, let <var>increment</var> be the third <emu-nt id="_ref_21712"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>; else let <var>increment</var> be <emu-const>empty</emu-const>.</li><li>Return ?&nbsp;<emu-xref aoid="ForBodyEvaluation" id="_ref_7133"><a href="ecmascript-language-statements-and-declarations.html#sec-forbodyevaluation" class="e-user-code">ForBodyEvaluation</a></emu-xref>(<var>test</var>, <var>increment</var>, <emu-nt id="_ref_21713"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, «&nbsp;», <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="sodmtko8" id="prod-HwfL-Win">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21714"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21715"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21716"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21717"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7134"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21718"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableDeclarationList">VariableDeclarationList</a></emu-nt>.</li><li>If the first <emu-nt id="_ref_21719"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, let <var>test</var> be the first <emu-nt id="_ref_21720"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>; else let <var>test</var> be <emu-const>empty</emu-const>.</li><li>If the second <emu-nt id="_ref_21721"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, let <var>increment</var> be the second <emu-nt id="_ref_21722"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>; else let <var>increment</var> be <emu-const>empty</emu-const>.</li><li>Return ?&nbsp;<emu-xref aoid="ForBodyEvaluation" id="_ref_7135"><a href="ecmascript-language-statements-and-declarations.html#sec-forbodyevaluation" class="e-user-code">ForBodyEvaluation</a></emu-xref>(<var>test</var>, <var>increment</var>, <emu-nt id="_ref_21723"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, «&nbsp;», <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForStatement">ForStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="k8b-ryxj" id="prod-PMtIFugG">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21724"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>
<emu-nt optional="" id="_ref_21725"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>;</emu-t>
<emu-nt optional="" id="_ref_21726"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21727"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7136"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>loopEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_7137"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>oldEnv</var>).</li><li>Let <var>isConst</var> be <emu-xref aoid="IsConstantDeclaration" id="_ref_7138"><a href="syntax-directed-operations.html#sec-static-semantics-isconstantdeclaration">IsConstantDeclaration</a></emu-xref> of <emu-nt id="_ref_21728"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>.</li><li>Let <var>boundNames</var> be the <emu-xref aoid="BoundNames" id="_ref_7139"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21729"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>.</li><li>For each element <var>dn</var> of <var>boundNames</var>, do<ol><li>If <var>isConst</var> is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>loopEnv</var>.<emu-xref aoid="CreateImmutableBinding" id="_ref_7140"><a href="executable-code-and-execution-contexts.html#abstract-createimmutablebinding">CreateImmutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li>Perform !&nbsp;<var>loopEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_7141"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>dn</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7142"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>loopEnv</var>.</li><li>Let <var>forDcl</var> be <emu-xref aoid="Completion" id="_ref_7143"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7144"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21730"><a href="ecmascript-language-statements-and-declarations.html#prod-LexicalDeclaration">LexicalDeclaration</a></emu-nt>).</li><li>If <var>forDcl</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7145"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Set the <emu-xref href="#running-execution-context" id="_ref_7146"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return ?&nbsp;<var>forDcl</var>.</li></ol></li><li>If <var>isConst</var> is <emu-val>false</emu-val>, let <var>perIterationLets</var> be <var>boundNames</var>; else let <var>perIterationLets</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7147"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>If the first <emu-nt id="_ref_21731"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, let <var>test</var> be the first <emu-nt id="_ref_21732"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>; else let <var>test</var> be <emu-const>empty</emu-const>.</li><li>If the second <emu-nt id="_ref_21733"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is present, let <var>increment</var> be the second <emu-nt id="_ref_21734"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>; else let <var>increment</var> be <emu-const>empty</emu-const>.</li><li>Let <var>bodyResult</var> be <emu-xref aoid="Completion" id="_ref_7148"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="ForBodyEvaluation" id="_ref_7149"><a href="ecmascript-language-statements-and-declarations.html#sec-forbodyevaluation" class="e-user-code">ForBodyEvaluation</a></emu-xref>(<var>test</var>, <var>increment</var>, <emu-nt id="_ref_21735"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>perIterationLets</var>, <var>labelSet</var>)).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7150"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return ?&nbsp;<var>bodyResult</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-forbodyevaluation" type="abstract operation" aoid="ForBodyEvaluation">
<h1><span class="secnum">14.7.4.3</span> ForBodyEvaluation ( <var>test</var>, <var>increment</var>, <var>stmt</var>, <var>perIterationBindings</var>, <var>labelSet</var> )</h1>
<p>The abstract operation ForBodyEvaluation takes arguments <var>test</var> (an <emu-nt id="_ref_21736"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7151"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> or <emu-const>empty</emu-const>), <var>increment</var> (an <emu-nt id="_ref_21737"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7152"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> or <emu-const>empty</emu-const>), <var>stmt</var> (a <emu-nt id="_ref_21738"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7153"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>perIterationBindings</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7154"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings), and <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7155"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7156"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7157"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7158"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>V</var> be <emu-val>undefined</emu-val>.</li><li>Perform ?&nbsp;<emu-xref aoid="CreatePerIterationEnvironment" id="_ref_7159"><a href="ecmascript-language-statements-and-declarations.html#sec-createperiterationenvironment">CreatePerIterationEnvironment</a></emu-xref>(<var>perIterationBindings</var>).</li><li>Repeat,<ol><li>If <var>test</var> is not <emu-const>empty</emu-const>, then<ol><li>Let <var>testRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7160"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>test</var>.</li><li>Let <var>testValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7161"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>testRef</var>).</li><li>If <emu-xref aoid="ToBoolean" id="_ref_7162"><a href="abstract-operations.html#sec-toboolean">ToBoolean</a></emu-xref>(<var>testValue</var>) is <emu-val>false</emu-val>, return <var>V</var>.</li></ol></li><li>Let <var>result</var> be <emu-xref aoid="Completion" id="_ref_7163"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7164"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>stmt</var>).</li><li>If <emu-xref aoid="LoopContinues" id="_ref_7165"><a href="ecmascript-language-statements-and-declarations.html#sec-loopcontinues">LoopContinues</a></emu-xref>(<var>result</var>, <var>labelSet</var>) is <emu-val>false</emu-val>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7166"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>result</var>, <var>V</var>).</li><li>If <var>result</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>result</var>.<var class="field">[[Value]]</var>.</li><li>Perform ?&nbsp;<emu-xref aoid="CreatePerIterationEnvironment" id="_ref_7167"><a href="ecmascript-language-statements-and-declarations.html#sec-createperiterationenvironment">CreatePerIterationEnvironment</a></emu-xref>(<var>perIterationBindings</var>).</li><li>If <var>increment</var> is not <emu-const>empty</emu-const>, then<ol><li>Let <var>incRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7168"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>increment</var>.</li><li>Perform ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7169"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>incRef</var>).</li></ol></li></ol></li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-createperiterationenvironment" type="abstract operation" aoid="CreatePerIterationEnvironment">
<h1><span class="secnum">14.7.4.4</span> CreatePerIterationEnvironment ( <var>perIterationBindings</var> )</h1>
<p>The abstract operation CreatePerIterationEnvironment takes argument <var>perIterationBindings</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7170"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7171"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-const>unused</emu-const> or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7172"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>perIterationBindings</var> has any elements, then<ol><li>Let <var>lastIterationEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7173"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>outer</var> be <var>lastIterationEnv</var>.<var class="field">[[OuterEnv]]</var>.</li><li><emu-xref href="#assert" id="_ref_7174"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>outer</var> is not <emu-val>null</emu-val>.</li><li>Let <var>thisIterationEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_7175"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>outer</var>).</li><li>For each element <var>bn</var> of <var>perIterationBindings</var>, do<ol><li>Perform !&nbsp;<var>thisIterationEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_7176"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>bn</var>, <emu-val>false</emu-val>).</li><li>Let <var>lastValue</var> be ?&nbsp;<var>lastIterationEnv</var>.<emu-xref aoid="GetBindingValue" id="_ref_7177"><a href="executable-code-and-execution-contexts.html#abstract-getbindingvalue">GetBindingValue</a></emu-xref>(<var>bn</var>, <emu-val>true</emu-val>).</li><li>Perform !&nbsp;<var>thisIterationEnv</var>.<emu-xref aoid="InitializeBinding" id="_ref_7178"><a href="executable-code-and-execution-contexts.html#abstract-initializebinding">InitializeBinding</a></emu-xref>(<var>bn</var>, <var>lastValue</var>).</li></ol></li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7179"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>thisIterationEnv</var>.</li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-for-in-and-for-of-statements">
<h1><span class="secnum">14.7.5</span> The <code>for</code>-<code>in</code>, <code>for</code>-<code>of</code>, and <code>for</code>-<code>await</code>-<code>of</code> Statements</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="ForInOfStatement" params="Yield, Await, Return" id="prod-ForInOfStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="w0xbna_a" id="prod-Za8VIr4f">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-gann>[lookahead ≠ <emu-t>let</emu-t>
<emu-t>[</emu-t>]</emu-gann>
<emu-nt params="?Yield, ?Await" id="_ref_21739"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>in</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21740"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21741"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="7ml0tbdi" id="prod-_N8Q-kim">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21742"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>in</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21743"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21744"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="zchtsyje" id="prod-xutvwaXc">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21745"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>in</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21746"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21747"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="e8xfsfow" id="prod-nLtPS4oB">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-gann>[lookahead ∉ { <emu-t>let</emu-t>, <emu-t>async</emu-t>
<emu-t>of</emu-t> }]</emu-gann>
<emu-nt params="?Yield, ?Await" id="_ref_21748"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>of</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21749"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21750"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="58n_2ihn" id="prod-M1zjKbr6">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21751"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>of</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21752"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21753"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="pfvjbka1" id="prod-EoyoF5LI">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21754"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>of</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21755"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21756"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="oprokwwm" constraints="+Await" id="prod-ReDwT2-b"><emu-constraints>[+Await]</emu-constraints>
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-gann>[lookahead ≠ <emu-t>let</emu-t>]</emu-gann>
<emu-nt params="?Yield, ?Await" id="_ref_21757"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>of</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21758"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21759"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="9bsmrb_a" constraints="+Await" id="prod-ut_uoPzp"><emu-constraints>[+Await]</emu-constraints>
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21760"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>of</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21761"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21762"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="fxca1-1x" constraints="+Await" id="prod-jY1gwM9V"><emu-constraints>[+Await]</emu-constraints>
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_21763"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>of</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21764"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21765"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="ForDeclaration" params="Yield, Await" id="prod-ForDeclaration">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="k6i8qvu4" id="prod-ygJ0cdk1">
<emu-nt id="_ref_21766"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt params="?Yield, ?Await" id="_ref_21767"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="ForBinding" params="Yield, Await" id="prod-ForBinding">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ir-rfjfi" id="prod-gwk9Iaq2">
<emu-nt params="?Yield, ?Await" id="_ref_21768"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="nridwfya" id="prod-rDLkyb_q">
<emu-nt params="?Yield, ?Await" id="_ref_21769"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This section is extended by Annex <emu-xref href="#sec-initializers-in-forin-statement-heads" id="_ref_448"><a href="additional-ecmascript-features-for-web-browsers.html#sec-initializers-in-forin-statement-heads">B.3.5</a></emu-xref>.</p>
</div></emu-note>
<emu-clause id="sec-for-in-and-for-of-statements-static-semantics-early-errors">
<h1><span class="secnum">14.7.5.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="ForInOfStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="v1ibcd1w">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21770"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21771"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21772"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="7pgjrcn-">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21773"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21774"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21775"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="jzctgxkp">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21776"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21777"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21778"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="jqzgi_en">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21779"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21780"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21781"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="7m-adytu">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21782"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21783"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21784"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="b3wzboyu">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21785"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21786"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21787"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="mhrux1r7">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21788"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21789"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21790"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="cyt_lv_1">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21791"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21792"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21793"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="uatmda3j">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21794"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21795"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21796"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7180"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<emu-nt id="_ref_21797"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is only necessary to apply this rule if the extension specified in <emu-xref href="#sec-labelled-function-declarations" id="_ref_449"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">B.3.1</a></emu-xref> is implemented.</p>
</div></emu-note>
<emu-grammar><emu-production name="ForInOfStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="v1ibcd1w">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21798"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21799"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21800"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="jqzgi_en">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21801"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21802"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21803"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="mhrux1r7">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21804"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21805"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21806"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
If <emu-nt id="_ref_21807"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt> is either an <emu-nt id="_ref_21808"><a href="ecmascript-language-expressions.html#prod-ObjectLiteral">ObjectLiteral</a></emu-nt> or an <emu-nt id="_ref_21809"><a href="ecmascript-language-expressions.html#prod-ArrayLiteral">ArrayLiteral</a></emu-nt>, <emu-nt id="_ref_21810"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt> <emu-xref href="#must-cover" id="_ref_7181"><a href="notational-conventions.html#must-cover">must cover</a></emu-xref> an <emu-nt id="_ref_21811"><a href="ecmascript-language-expressions.html#prod-AssignmentPattern">AssignmentPattern</a></emu-nt>.
</li>
<li>
If <emu-nt id="_ref_21812"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt> is neither an <emu-nt id="_ref_21813"><a href="ecmascript-language-expressions.html#prod-ObjectLiteral">ObjectLiteral</a></emu-nt> nor an <emu-nt id="_ref_21814"><a href="ecmascript-language-expressions.html#prod-ArrayLiteral">ArrayLiteral</a></emu-nt>, it is a Syntax Error if the <emu-xref aoid="AssignmentTargetType" id="_ref_7182"><a href="syntax-directed-operations.html#sec-static-semantics-assignmenttargettype">AssignmentTargetType</a></emu-xref> of <emu-nt id="_ref_21815"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt> is <emu-const>invalid</emu-const>.
</li>
</ul>
<emu-grammar><emu-production name="ForInOfStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jzctgxkp">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21816"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21817"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21818"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="b3wzboyu">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21819"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21820"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21821"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
<emu-rhs a="uatmda3j">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21822"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21823"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21824"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if the <emu-xref aoid="BoundNames" id="_ref_7183"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21825"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt> contains <emu-val>"let"</emu-val>.
</li>
<li>
It is a Syntax Error if any element of the <emu-xref aoid="BoundNames" id="_ref_7184"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21826"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt> also occurs in the <emu-xref aoid="VarDeclaredNames" id="_ref_7185"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21827"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>.
</li>
<li>
It is a Syntax Error if the <emu-xref aoid="BoundNames" id="_ref_7186"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21828"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt> contains any duplicate entries.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-static-semantics-isdestructuring" oldids="sec-static-semantics-static-semantics-isdestructuring,sec-for-in-and-for-of-statements-static-semantics-isdestructuring" type="sdo" aoid="IsDestructuring"><span id="sec-for-in-and-for-of-statements-static-semantics-isdestructuring"></span><span id="sec-static-semantics-static-semantics-isdestructuring"></span>
<h1><span class="secnum">14.7.5.2</span> Static Semantics: IsDestructuring</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7187"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> IsDestructuring takes no arguments and returns a Boolean. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="MemberExpression" collapsed="">
<emu-nt><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jvcvemtw" id="prod-HvnSrzbi"><emu-nt id="_ref_21829"><a href="ecmascript-language-expressions.html#prod-PrimaryExpression">PrimaryExpression</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>If <emu-nt id="_ref_21830"><a href="ecmascript-language-expressions.html#prod-PrimaryExpression">PrimaryExpression</a></emu-nt> is either an <emu-nt id="_ref_21831"><a href="ecmascript-language-expressions.html#prod-ObjectLiteral">ObjectLiteral</a></emu-nt> or an <emu-nt id="_ref_21832"><a href="ecmascript-language-expressions.html#prod-ArrayLiteral">ArrayLiteral</a></emu-nt>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
<emu-grammar><emu-production name="MemberExpression">
<emu-nt><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="a74xd7de" id="prod-nfrnC2qv">
<emu-nt id="_ref_21833"><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt>
<emu-t>[</emu-t>
<emu-nt id="_ref_21834"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>]</emu-t>
</emu-rhs>
<emu-rhs a="frbj984t" id="prod-pVCOt4bB">
<emu-nt id="_ref_21835"><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt>
<emu-t>.</emu-t>
<emu-nt id="_ref_21836"><a href="ecmascript-language-lexical-grammar.html#prod-IdentifierName">IdentifierName</a></emu-nt>
</emu-rhs>
<emu-rhs a="fj52gjle" id="prod-IOJOqU1K">
<emu-nt id="_ref_21837"><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt>
<emu-nt id="_ref_21838"><a href="ecmascript-language-expressions.html#prod-TemplateLiteral">TemplateLiteral</a></emu-nt>
</emu-rhs>
<emu-rhs a="x4tzletw" id="prod-e3LgGUUv">
<emu-nt id="_ref_21839"><a href="ecmascript-language-expressions.html#prod-SuperProperty">SuperProperty</a></emu-nt>
</emu-rhs>
<emu-rhs a="yb7id2be" id="prod-uCaMN-Ha">
<emu-nt id="_ref_21840"><a href="ecmascript-language-expressions.html#prod-MetaProperty">MetaProperty</a></emu-nt>
</emu-rhs>
<emu-rhs a="cfq-hbbx" id="prod-vPeih5lN">
<emu-t>new</emu-t>
<emu-nt id="_ref_21841"><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt>
<emu-nt id="_ref_21842"><a href="ecmascript-language-expressions.html#prod-Arguments">Arguments</a></emu-nt>
</emu-rhs>
<emu-rhs a="0uk9afbi" id="prod-IWE0dD8s">
<emu-nt id="_ref_21843"><a href="ecmascript-language-expressions.html#prod-MemberExpression">MemberExpression</a></emu-nt>
<emu-t>.</emu-t>
<emu-nt id="_ref_21844"><a href="ecmascript-language-lexical-grammar.html#prod-PrivateIdentifier">PrivateIdentifier</a></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="NewExpression">
<emu-nt><a href="ecmascript-language-expressions.html#prod-NewExpression">NewExpression</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="51p618ta" id="prod-fNvFZX0j">
<emu-t>new</emu-t>
<emu-nt id="_ref_21845"><a href="ecmascript-language-expressions.html#prod-NewExpression">NewExpression</a></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="LeftHandSideExpression">
<emu-nt><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="i8det4ck" id="prod-9Ion7RwA">
<emu-nt id="_ref_21846"><a href="ecmascript-language-expressions.html#prod-CallExpression">CallExpression</a></emu-nt>
</emu-rhs>
<emu-rhs a="jbet6xpw" id="prod-Q5WdRWI1">
<emu-nt id="_ref_21847"><a href="ecmascript-language-expressions.html#prod-OptionalExpression">OptionalExpression</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
<emu-grammar><emu-production name="ForDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="0y1vvm1x" id="prod-gowHZDoa">
<emu-nt id="_ref_21848"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt id="_ref_21849"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-xref aoid="IsDestructuring" id="_ref_7188"><a href="ecmascript-language-statements-and-declarations.html#sec-static-semantics-isdestructuring">IsDestructuring</a></emu-xref> of <emu-nt id="_ref_21850"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>.</li></ol></emu-alg>
<emu-grammar><emu-production name="ForBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uolyom43" id="prod-AsYWUqR1"><emu-nt id="_ref_21851"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
<emu-grammar><emu-production name="ForBinding" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="mdrfyhm6" id="prod-n6CWa3rF"><emu-nt id="_ref_21852"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This section is extended by Annex <emu-xref href="#sec-initializers-in-forin-statement-heads" id="_ref_450"><a href="additional-ecmascript-features-for-web-browsers.html#sec-initializers-in-forin-statement-heads">B.3.5</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-runtime-semantics-fordeclarationbindinginitialization" oldids="sec-for-in-and-for-of-statements-runtime-semantics-bindinginitialization" type="sdo" aoid="ForDeclarationBindingInitialization"><span id="sec-for-in-and-for-of-statements-runtime-semantics-bindinginitialization"></span>
<h1><span class="secnum">14.7.5.3</span> Runtime Semantics: ForDeclarationBindingInitialization</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7189"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> ForDeclarationBindingInitialization takes arguments <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7190"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and <var>environment</var> (an <emu-xref href="#sec-environment-records" id="_ref_7191"><a href="executable-code-and-execution-contexts.html#sec-environment-records">Environment Record</a></emu-xref> or <emu-val>undefined</emu-val>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7192"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> <emu-const>unused</emu-const> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7193"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><emu-val>undefined</emu-val> is passed for <var>environment</var> to indicate that a <emu-xref aoid="PutValue" id="_ref_7194"><a href="ecmascript-data-types-and-values.html#sec-putvalue">PutValue</a></emu-xref> operation should be used to assign the initialization value. This is the case for <code>var</code> statements and the formal parameter lists of some <emu-xref href="#non-strict-function" id="_ref_7195"><a href="ordinary-and-exotic-objects-behaviours.html#non-strict-function">non-strict functions</a></emu-xref> (see <emu-xref href="#sec-functiondeclarationinstantiation" id="_ref_451"><a href="ordinary-and-exotic-objects-behaviours.html#sec-functiondeclarationinstantiation">10.2.11</a></emu-xref>). In those cases a lexical binding is hoisted and preinitialized prior to evaluation of its initializer.</p>
</div></emu-note>
<p>It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="ForDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="0y1vvm1x" id="prod-S5lZ05os">
<emu-nt id="_ref_21853"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt id="_ref_21854"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="BindingInitialization" id="_ref_7196"><a href="syntax-directed-operations.html#sec-runtime-semantics-bindinginitialization" class="e-user-code">BindingInitialization</a></emu-xref> of <emu-nt id="_ref_21855"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt> with arguments <var>value</var> and <var>environment</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-fordeclarationbindinginstantiation" oldids="sec-runtime-semantics-bindinginstantiation" type="sdo" aoid="ForDeclarationBindingInstantiation"><span id="sec-runtime-semantics-bindinginstantiation"></span>
<h1><span class="secnum">14.7.5.4</span> Runtime Semantics: ForDeclarationBindingInstantiation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7197"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> ForDeclarationBindingInstantiation takes argument <var>environment</var> (a <emu-xref href="#sec-declarative-environment-records" id="_ref_7198"><a href="executable-code-and-execution-contexts.html#sec-declarative-environment-records">Declarative Environment Record</a></emu-xref>) and returns <emu-const>unused</emu-const>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="ForDeclaration" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="0y1vvm1x" id="prod-bTiDTykL">
<emu-nt id="_ref_21856"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt>
<emu-nt id="_ref_21857"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>For each element <var>name</var> of the <emu-xref aoid="BoundNames" id="_ref_7199"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21858"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>, do<ol><li>If <emu-xref aoid="IsConstantDeclaration" id="_ref_7200"><a href="syntax-directed-operations.html#sec-static-semantics-isconstantdeclaration">IsConstantDeclaration</a></emu-xref> of <emu-nt id="_ref_21859"><a href="ecmascript-language-statements-and-declarations.html#prod-LetOrConst">LetOrConst</a></emu-nt> is <emu-val>true</emu-val>, then<ol><li>Perform !&nbsp;<var>environment</var>.<emu-xref aoid="CreateImmutableBinding" id="_ref_7201"><a href="executable-code-and-execution-contexts.html#abstract-createimmutablebinding">CreateImmutableBinding</a></emu-xref>(<var>name</var>, <emu-val>true</emu-val>).</li></ol></li><li>Else,<ol><li>Perform !&nbsp;<var>environment</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_7202"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>name</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-forinofloopevaluation" oldids="sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation" type="sdo" aoid="ForInOfLoopEvaluation"><span id="sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation"></span>
<h1><span class="secnum">14.7.5.5</span> Runtime Semantics: ForInOfLoopEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7203"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> ForInOfLoopEvaluation takes argument <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7204"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7205"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7206"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7207"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="v1ibcd1w" id="prod-dhS3iRZF">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21860"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21861"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21862"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7208"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>&nbsp;», <emu-nt id="_ref_21863"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>, <emu-const>enumerate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7209"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21864"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>, <emu-nt id="_ref_21865"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>enumerate</emu-const>, <emu-const>assignment</emu-const>, <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="7pgjrcn-" id="prod-A6rVBZNm">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21866"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21867"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21868"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7210"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>&nbsp;», <emu-nt id="_ref_21869"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>, <emu-const>enumerate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7211"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21870"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>, <emu-nt id="_ref_21871"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>enumerate</emu-const>, <emu-const>var-binding</emu-const>, <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jzctgxkp" id="prod-zcGoySgU">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21872"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>in</emu-t>
<emu-nt id="_ref_21873"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21874"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7212"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>(<emu-xref aoid="BoundNames" id="_ref_7213"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21875"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>, <emu-nt id="_ref_21876"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>, <emu-const>enumerate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7214"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21877"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>, <emu-nt id="_ref_21878"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>enumerate</emu-const>, <emu-const>lexical-binding</emu-const>, <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="jqzgi_en" id="prod-xXfkt6k0">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21879"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21880"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21881"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7215"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>&nbsp;», <emu-nt id="_ref_21882"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>, <emu-const>iterate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7216"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21883"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>, <emu-nt id="_ref_21884"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>iterate</emu-const>, <emu-const>assignment</emu-const>, <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="7m-adytu" id="prod-pPrWP7Ph">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21885"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21886"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21887"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7217"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>&nbsp;», <emu-nt id="_ref_21888"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>, <emu-const>iterate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7218"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21889"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>, <emu-nt id="_ref_21890"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>iterate</emu-const>, <emu-const>var-binding</emu-const>, <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="b3wzboyu" id="prod-OIo-GNlm">
<emu-t>for</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21891"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21892"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21893"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7219"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>(<emu-xref aoid="BoundNames" id="_ref_7220"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21894"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>, <emu-nt id="_ref_21895"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>, <emu-const>iterate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7221"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21896"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>, <emu-nt id="_ref_21897"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>iterate</emu-const>, <emu-const>lexical-binding</emu-const>, <var>labelSet</var>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="mhrux1r7" id="prod-Z4scLosS">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21898"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21899"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21900"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7222"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>&nbsp;», <emu-nt id="_ref_21901"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>, <emu-const>async-iterate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7223"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21902"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>, <emu-nt id="_ref_21903"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>iterate</emu-const>, <emu-const>assignment</emu-const>, <var>labelSet</var>, <emu-const>async</emu-const>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="cyt_lv_1" id="prod-5PDN6AV3">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-t>var</emu-t>
<emu-nt id="_ref_21904"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21905"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21906"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7224"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>&nbsp;», <emu-nt id="_ref_21907"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>, <emu-const>async-iterate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7225"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21908"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>, <emu-nt id="_ref_21909"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>iterate</emu-const>, <emu-const>var-binding</emu-const>, <var>labelSet</var>, <emu-const>async</emu-const>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ForInOfStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ForInOfStatement">ForInOfStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uatmda3j" id="prod-KdWnMB6i">
<emu-t>for</emu-t>
<emu-t>await</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21910"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>
<emu-t>of</emu-t>
<emu-nt id="_ref_21911"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21912"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>keyResult</var> be ?&nbsp;<emu-xref aoid="ForIn/OfHeadEvaluation" id="_ref_7226"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forinofheadevaluation" class="e-user-code">ForIn/OfHeadEvaluation</a></emu-xref>(<emu-xref aoid="BoundNames" id="_ref_7227"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_21913"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>, <emu-nt id="_ref_21914"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt>, <emu-const>async-iterate</emu-const>).</li><li>Return ?&nbsp;<emu-xref aoid="ForIn/OfBodyEvaluation" id="_ref_7228"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" class="e-user-code">ForIn/OfBodyEvaluation</a></emu-xref>(<emu-nt id="_ref_21915"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>, <emu-nt id="_ref_21916"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, <var>keyResult</var>, <emu-const>iterate</emu-const>, <emu-const>lexical-binding</emu-const>, <var>labelSet</var>, <emu-const>async</emu-const>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This section is extended by Annex <emu-xref href="#sec-initializers-in-forin-statement-heads" id="_ref_452"><a href="additional-ecmascript-features-for-web-browsers.html#sec-initializers-in-forin-statement-heads">B.3.5</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-runtime-semantics-forinofheadevaluation" type="abstract operation" oldids="sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind" aoid="ForIn/OfHeadEvaluation"><span id="sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind"></span>
<h1><span class="secnum">14.7.5.6</span> ForIn/OfHeadEvaluation ( <var>uninitializedBoundNames</var>, <var>expr</var>, <var>iterationKind</var> )</h1>
<p>The abstract operation ForIn/OfHeadEvaluation takes arguments <var>uninitializedBoundNames</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7229"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings), <var>expr</var> (an <emu-nt id="_ref_21917"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7230"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> or an <emu-nt id="_ref_21918"><a href="ecmascript-language-expressions.html#prod-AssignmentExpression">AssignmentExpression</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7231"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), and <var>iterationKind</var> (<emu-const>enumerate</emu-const>, <emu-const>iterate</emu-const>, or <emu-const>async-iterate</emu-const>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7232"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-iterator-records" id="_ref_7233"><a href="abstract-operations.html#sec-iterator-records">Iterator Record</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7234"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7235"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>If <var>uninitializedBoundNames</var> is not empty, then<ol><li><emu-xref href="#assert" id="_ref_7236"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>uninitializedBoundNames</var> has no duplicate entries.</li><li>Let <var>newEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_7237"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>oldEnv</var>).</li><li>For each String <var>name</var> of <var>uninitializedBoundNames</var>, do<ol><li>Perform !&nbsp;<var>newEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_7238"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>name</var>, <emu-val>false</emu-val>).</li></ol></li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7239"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>newEnv</var>.</li></ol></li><li>Let <var>exprRef</var> be <emu-xref aoid="Completion" id="_ref_7240"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7241"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>expr</var>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7242"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Let <var>exprValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7243"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(? <var>exprRef</var>).</li><li>If <var>iterationKind</var> is <emu-const>enumerate</emu-const>, then<ol><li>If <var>exprValue</var> is either <emu-val>undefined</emu-val> or <emu-val>null</emu-val>, then<ol><li>Return <emu-xref href="#sec-completion-record-specification-type" id="_ref_7244"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> { <var class="field">[[Type]]</var>: <emu-const>break</emu-const>, <var class="field">[[Value]]</var>: <emu-const>empty</emu-const>, <var class="field">[[Target]]</var>: <emu-const>empty</emu-const>&nbsp;}.</li></ol></li><li>Let <var>obj</var> be !&nbsp;<emu-xref aoid="ToObject" id="_ref_7245"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<var>exprValue</var>).</li><li>Let <var>iterator</var> be <emu-xref aoid="EnumerateObjectProperties" id="_ref_7246"><a href="ecmascript-language-statements-and-declarations.html#sec-enumerate-object-properties">EnumerateObjectProperties</a></emu-xref>(<var>obj</var>).</li><li>Let <var>nextMethod</var> be !&nbsp;<emu-xref aoid="GetV" id="_ref_7247"><a href="abstract-operations.html#sec-getv">GetV</a></emu-xref>(<var>iterator</var>, <emu-val>"next"</emu-val>).</li><li>Return the <emu-xref href="#sec-iterator-records" id="_ref_7248"><a href="abstract-operations.html#sec-iterator-records">Iterator Record</a></emu-xref> { <var class="field">[[Iterator]]</var>: <var>iterator</var>, <var class="field">[[NextMethod]]</var>: <var>nextMethod</var>, <var class="field">[[Done]]</var>: <emu-val>false</emu-val>&nbsp;}.</li></ol></li><li><emu-xref href="#assert" id="_ref_7249"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>iterationKind</var> is either <emu-const>iterate</emu-const> or <emu-const>async-iterate</emu-const>.</li><li>If <var>iterationKind</var> is <emu-const>async-iterate</emu-const>, let <var>iteratorKind</var> be <emu-const>async</emu-const>.</li><li>Else, let <var>iteratorKind</var> be <emu-const>sync</emu-const>.</li><li>Return ?&nbsp;<emu-xref aoid="GetIterator" id="_ref_7250"><a href="abstract-operations.html#sec-getiterator" class="e-user-code">GetIterator</a></emu-xref>(<var>exprValue</var>, <var>iteratorKind</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset" type="abstract operation" aoid="ForIn/OfBodyEvaluation">
<h1><span class="secnum">14.7.5.7</span> ForIn/OfBodyEvaluation ( <var>lhs</var>, <var>stmt</var>, <var>iteratorRecord</var>, <var>iterationKind</var>, <var>lhsKind</var>, <var>labelSet</var> [ , <var>iteratorKind</var> ] )</h1>
<p>The abstract operation ForIn/OfBodyEvaluation takes arguments <var>lhs</var> (a <emu-xref href="#sec-syntactic-grammar" id="_ref_7251"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>stmt</var> (a <emu-nt id="_ref_21919"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7252"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>), <var>iteratorRecord</var> (an <emu-xref href="#sec-iterator-records" id="_ref_7253"><a href="abstract-operations.html#sec-iterator-records">Iterator Record</a></emu-xref>), <var>iterationKind</var> (<emu-const>enumerate</emu-const> or <emu-const>iterate</emu-const>), <var>lhsKind</var> (<emu-const>assignment</emu-const>, <emu-const>var-binding</emu-const>, or <emu-const>lexical-binding</emu-const>), and <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7254"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and optional argument <var>iteratorKind</var> (<emu-const>sync</emu-const> or <emu-const>async</emu-const>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7255"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7256"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7257"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>iteratorKind</var> is not present, set <var>iteratorKind</var> to <emu-const>sync</emu-const>.</li><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7258"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>V</var> be <emu-val>undefined</emu-val>.</li><li>Let <var>destructuring</var> be <emu-xref aoid="IsDestructuring" id="_ref_7259"><a href="ecmascript-language-statements-and-declarations.html#sec-static-semantics-isdestructuring">IsDestructuring</a></emu-xref> of <var>lhs</var>.</li><li>If <var>destructuring</var> is <emu-val>true</emu-val> and <var>lhsKind</var> is <emu-const>assignment</emu-const>, then<ol><li><emu-xref href="#assert" id="_ref_7260"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lhs</var> is a <emu-nt id="_ref_21920"><a href="ecmascript-language-expressions.html#prod-LeftHandSideExpression">LeftHandSideExpression</a></emu-nt>.</li><li>Let <var>assignmentPattern</var> be the <emu-nt id="_ref_21921"><a href="ecmascript-language-expressions.html#prod-AssignmentPattern">AssignmentPattern</a></emu-nt> that is <emu-xref href="#sec-syntactic-grammar" id="_ref_7261"><a href="notational-conventions.html#sec-syntactic-grammar">covered</a></emu-xref> by <var>lhs</var>.</li></ol></li><li>Repeat,<ol><li>Let <var>nextResult</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_7262"><a href="abstract-operations.html#sec-call" class="e-user-code">Call</a></emu-xref>(<var>iteratorRecord</var>.<var class="field">[[NextMethod]]</var>, <var>iteratorRecord</var>.<var class="field">[[Iterator]]</var>).</li><li>If <var>iteratorKind</var> is <emu-const>async</emu-const>, set <var>nextResult</var> to ?&nbsp;<emu-xref aoid="Await" id="_ref_7263"><a href="control-abstraction-objects.html#await" class="e-user-code">Await</a></emu-xref>(<var>nextResult</var>).</li><li>If <var>nextResult</var> <emu-xref href="#sec-object-type" id="_ref_7264"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>done</var> be ?&nbsp;<emu-xref aoid="IteratorComplete" id="_ref_7265"><a href="abstract-operations.html#sec-iteratorcomplete" class="e-user-code">IteratorComplete</a></emu-xref>(<var>nextResult</var>).</li><li>If <var>done</var> is <emu-val>true</emu-val>, return <var>V</var>.</li><li>Let <var>nextValue</var> be ?&nbsp;<emu-xref aoid="IteratorValue" id="_ref_7266"><a href="abstract-operations.html#sec-iteratorvalue" class="e-user-code">IteratorValue</a></emu-xref>(<var>nextResult</var>).</li><li>If <var>lhsKind</var> is either <emu-const>assignment</emu-const> or <emu-const>var-binding</emu-const>, then<ol><li>If <var>destructuring</var> is <emu-val>true</emu-val>, then<ol><li>If <var>lhsKind</var> is <emu-const>assignment</emu-const>, then<ol><li>Let <var>status</var> be <emu-xref aoid="Completion" id="_ref_7267"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="DestructuringAssignmentEvaluation" id="_ref_7268"><a href="ecmascript-language-expressions.html#sec-runtime-semantics-destructuringassignmentevaluation" class="e-user-code">DestructuringAssignmentEvaluation</a></emu-xref> of <var>assignmentPattern</var> with argument <var>nextValue</var>).</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_7269"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lhsKind</var> is <emu-const>var-binding</emu-const>.</li><li><emu-xref href="#assert" id="_ref_7270"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lhs</var> is a <emu-nt id="_ref_21922"><a href="ecmascript-language-statements-and-declarations.html#prod-ForBinding">ForBinding</a></emu-nt>.</li><li>Let <var>status</var> be <emu-xref aoid="Completion" id="_ref_7271"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="BindingInitialization" id="_ref_7272"><a href="syntax-directed-operations.html#sec-runtime-semantics-bindinginitialization" class="e-user-code">BindingInitialization</a></emu-xref> of <var>lhs</var> with arguments <var>nextValue</var> and <emu-val>undefined</emu-val>).</li></ol></li></ol></li><li>Else,<ol><li>Let <var>lhsRef</var> be <emu-xref aoid="Completion" id="_ref_7273"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7274"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>lhs</var>). (It may be evaluated repeatedly.)</li><li>If <var>lhsKind</var> is <emu-const>assignment</emu-const> and the <emu-xref aoid="AssignmentTargetType" id="_ref_7275"><a href="syntax-directed-operations.html#sec-static-semantics-assignmenttargettype">AssignmentTargetType</a></emu-xref> of <var>lhs</var> is <emu-const>web-compat</emu-const>, throw a <emu-val>ReferenceError</emu-val> exception.</li><li>If <var>lhsRef</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7276"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Let <var>status</var> be <var>lhsRef</var>.</li></ol></li><li>Else,<ol><li>Let <var>status</var> be <emu-xref aoid="Completion" id="_ref_7277"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="PutValue" id="_ref_7278"><a href="ecmascript-data-types-and-values.html#sec-putvalue" class="e-user-code">PutValue</a></emu-xref>(<var>lhsRef</var>.<var class="field">[[Value]]</var>, <var>nextValue</var>)).</li></ol></li></ol></li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_7279"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lhsKind</var> is <emu-const>lexical-binding</emu-const>.</li><li><emu-xref href="#assert" id="_ref_7280"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lhs</var> is a <emu-nt id="_ref_21923"><a href="ecmascript-language-statements-and-declarations.html#prod-ForDeclaration">ForDeclaration</a></emu-nt>.</li><li>Let <var>iterationEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_7281"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>oldEnv</var>).</li><li>Perform <emu-xref aoid="ForDeclarationBindingInstantiation" id="_ref_7282"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-fordeclarationbindinginstantiation">ForDeclarationBindingInstantiation</a></emu-xref> of <var>lhs</var> with argument <var>iterationEnv</var>.</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7283"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>iterationEnv</var>.</li><li>If <var>destructuring</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>status</var> be <emu-xref aoid="Completion" id="_ref_7284"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="ForDeclarationBindingInitialization" id="_ref_7285"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-fordeclarationbindinginitialization" class="e-user-code">ForDeclarationBindingInitialization</a></emu-xref> of <var>lhs</var> with arguments <var>nextValue</var> and <var>iterationEnv</var>).</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_7286"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>lhs</var> binds a single name.</li><li>Let <var>lhsName</var> be the sole element of the <emu-xref aoid="BoundNames" id="_ref_7287"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <var>lhs</var>.</li><li>Let <var>lhsRef</var> be !&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_7288"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding">ResolveBinding</a></emu-xref>(<var>lhsName</var>).</li><li>Let <var>status</var> be <emu-xref aoid="Completion" id="_ref_7289"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="InitializeReferencedBinding" id="_ref_7290"><a href="ecmascript-data-types-and-values.html#sec-initializereferencedbinding">InitializeReferencedBinding</a></emu-xref>(<var>lhsRef</var>, <var>nextValue</var>)).</li></ol></li></ol></li><li>If <var>status</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7291"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Set the <emu-xref href="#running-execution-context" id="_ref_7292"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>If <var>iterationKind</var> is <emu-const>enumerate</emu-const>, return ?&nbsp;<var>status</var>.</li><li><emu-xref href="#assert" id="_ref_7293"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>iterationKind</var> is <emu-const>iterate</emu-const>.</li><li>If <var>iteratorKind</var> is <emu-const>async</emu-const>, return ?&nbsp;<emu-xref aoid="AsyncIteratorClose" id="_ref_7294"><a href="abstract-operations.html#sec-asynciteratorclose" class="e-user-code">AsyncIteratorClose</a></emu-xref>(<var>iteratorRecord</var>, <var>status</var>).</li><li>Return ?&nbsp;<emu-xref aoid="IteratorClose" id="_ref_7295"><a href="abstract-operations.html#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iteratorRecord</var>, <var>status</var>).</li></ol></li><li>Let <var>result</var> be <emu-xref aoid="Completion" id="_ref_7296"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7297"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>stmt</var>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7298"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>If <emu-xref aoid="LoopContinues" id="_ref_7299"><a href="ecmascript-language-statements-and-declarations.html#sec-loopcontinues">LoopContinues</a></emu-xref>(<var>result</var>, <var>labelSet</var>) is <emu-val>false</emu-val>, then<ol><li>Set <var>status</var> to <emu-xref aoid="Completion" id="_ref_7300"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="UpdateEmpty" id="_ref_7301"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>result</var>, <var>V</var>)).</li><li>If <var>iterationKind</var> is <emu-const>enumerate</emu-const>, return ?&nbsp;<var>status</var>.</li><li><emu-xref href="#assert" id="_ref_7302"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>iterationKind</var> is <emu-const>iterate</emu-const>.</li><li>If <var>iteratorKind</var> is <emu-const>async</emu-const>, return ?&nbsp;<emu-xref aoid="AsyncIteratorClose" id="_ref_7303"><a href="abstract-operations.html#sec-asynciteratorclose" class="e-user-code">AsyncIteratorClose</a></emu-xref>(<var>iteratorRecord</var>, <var>status</var>).</li><li>Return ?&nbsp;<emu-xref aoid="IteratorClose" id="_ref_7304"><a href="abstract-operations.html#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iteratorRecord</var>, <var>status</var>).</li></ol></li><li>If <var>result</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>result</var>.<var class="field">[[Value]]</var>.</li></ol></li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-for-in-and-for-of-statements-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.7.5.8</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="BindingIdentifier">
<emu-nt><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="bras6mo_" id="prod-_anR-waH">
<emu-nt id="_ref_21924"><a href="ecmascript-language-expressions.html#prod-Identifier">Identifier</a></emu-nt>
</emu-rhs>
<emu-rhs a="0d8zyjn8" id="prod-K8Yvyf4p">
<emu-t>yield</emu-t>
</emu-rhs>
<emu-rhs a="hx1dvlrw" id="prod-KzQjZu5p">
<emu-t>await</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>bindingId</var> be the <emu-xref aoid="StringValue" id="_ref_7305"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21925"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt>.</li><li>Return ?&nbsp;<emu-xref aoid="ResolveBinding" id="_ref_7306"><a href="executable-code-and-execution-contexts.html#sec-resolvebinding" class="e-user-code">ResolveBinding</a></emu-xref>(<var>bindingId</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-enumerate-object-properties" type="abstract operation" aoid="EnumerateObjectProperties">
<h1><span class="secnum">14.7.5.9</span> EnumerateObjectProperties ( <var>O</var> )</h1>
<p>The abstract operation EnumerateObjectProperties takes argument <var>O</var> (an Object) and returns an <emu-xref href="#sec-iterator-interface" id="_ref_7307"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator object</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return an <emu-xref href="#sec-iterator-interface" id="_ref_7308"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator object</a></emu-xref> whose <code>next</code> method iterates over all the String-valued keys of enumerable properties of <var>O</var>. The <emu-xref href="#sec-iterator-interface" id="_ref_7309"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator object</a></emu-xref> is never directly accessible to ECMAScript code. The mechanics and order of enumerating the properties is not specified but must conform to the rules specified below.</li></ol></emu-alg>
<p>The <emu-xref href="#sec-iterator-interface" id="_ref_7310"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref>'s <code>throw</code> and <code>return</code> methods are <emu-val>null</emu-val> and are never invoked. The <emu-xref href="#sec-iterator-interface" id="_ref_7311"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref>'s <code>next</code> method processes object properties to determine whether the <emu-xref href="#property-key" id="_ref_7312"><a href="ecmascript-data-types-and-values.html#property-key">property key</a></emu-xref> should be returned as an <emu-xref href="#sec-iterator-interface" id="_ref_7313"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref> value. Returned <emu-xref href="#property-key" id="_ref_7314"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> do not include keys that are Symbols. Properties of the target object may be deleted during enumeration. A property that is deleted before it is processed by the <emu-xref href="#sec-iterator-interface" id="_ref_7315"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref>'s <code>next</code> method is ignored. If new properties are added to the target object during enumeration, the newly added properties are not guaranteed to be processed in the active enumeration. A <emu-xref href="#property-name" id="_ref_7316"><a href="ecmascript-data-types-and-values.html#property-name">property name</a></emu-xref> will be returned by the <emu-xref href="#sec-iterator-interface" id="_ref_7317"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref>'s <code>next</code> method at most once in any enumeration.</p>
<p>Enumerating the properties of the target 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 processed if it has the same name as a property that has already been processed by the <emu-xref href="#sec-iterator-interface" id="_ref_7318"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref>'s <code>next</code> method. The values of <var class="field">[[Enumerable]]</var> attributes are not considered when determining if a property of a prototype object has already been processed. The enumerable <emu-xref href="#property-name" id="_ref_7319"><a href="ecmascript-data-types-and-values.html#property-name">property names</a></emu-xref> of prototype objects must be obtained by invoking EnumerateObjectProperties passing the prototype object as the argument. EnumerateObjectProperties must obtain the own <emu-xref href="#property-key" id="_ref_7320"><a href="ecmascript-data-types-and-values.html#property-key">property keys</a></emu-xref> of the target object by calling its <var class="field">[[OwnPropertyKeys]]</var> internal method. Property attributes of the target object must be obtained by calling its <var class="field">[[GetOwnProperty]]</var> internal method.</p>
<p>In addition, if neither <var>O</var> nor any object in its prototype chain is a <emu-xref href="#proxy-exotic-object" id="_ref_7321"><a href="ordinary-and-exotic-objects-behaviours.html#proxy-exotic-object">Proxy exotic object</a></emu-xref>, <emu-xref href="#typedarray" id="_ref_7322"><a href="ordinary-and-exotic-objects-behaviours.html#typedarray">TypedArray</a></emu-xref>, <emu-xref href="#module-namespace-exotic-object" id="_ref_7323"><a href="ordinary-and-exotic-objects-behaviours.html#module-namespace-exotic-object">module namespace exotic object</a></emu-xref>, or implementation provided <emu-xref href="#exotic-object" id="_ref_7324"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic object</a></emu-xref>, then the <emu-xref href="#sec-iterator-interface" id="_ref_7325"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref> must behave as would the <emu-xref href="#sec-iterator-interface" id="_ref_7326"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref> given by <emu-xref aoid="CreateForInIterator" id="_ref_7327"><a href="ecmascript-language-statements-and-declarations.html#sec-createforiniterator">CreateForInIterator</a></emu-xref>(<var>O</var>) until one of the following occurs:</p>
<ul>
<li>the value of the <var class="field">[[Prototype]]</var> internal slot of <var>O</var> or an object in its prototype chain changes,</li>
<li>a property is removed from <var>O</var> or an object in its prototype chain,</li>
<li>a property is added to an object in <var>O</var>'s prototype chain, or</li>
<li>the value of the <var class="field">[[Enumerable]]</var> attribute of a property of <var>O</var> or an object in its prototype chain changes.</li>
</ul>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>ECMAScript implementations are not required to implement the algorithm in <emu-xref href="#sec-%foriniteratorprototype%.next" id="_ref_453"><a href="ecmascript-language-statements-and-declarations.html#sec-%foriniteratorprototype%.next">14.7.5.10.2.1</a></emu-xref> directly. They may choose any implementation whose behaviour will not deviate from that algorithm unless one of the constraints in the previous paragraph is violated.</p>
<p>The following is an informative definition of an ECMAScript generator function that conforms to these rules:</p>
<pre><code class="javascript hljs"><span class="hljs-keyword">function</span>* <span class="hljs-title class_">EnumerateObjectProperties</span>(obj) {
<span class="hljs-keyword">const</span> visited = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Set</span>();
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> key <span class="hljs-keyword">of</span> <span class="hljs-title class_">Reflect</span>.<span class="hljs-title function_">ownKeys</span>(obj)) {
<span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> key === <span class="hljs-string">"symbol"</span>) <span class="hljs-keyword">continue</span>;
<span class="hljs-keyword">const</span> desc = <span class="hljs-title class_">Reflect</span>.<span class="hljs-title function_">getOwnPropertyDescriptor</span>(obj, key);
<span class="hljs-keyword">if</span> (desc) {
visited.<span class="hljs-title function_">add</span>(key);
<span class="hljs-keyword">if</span> (desc.<span class="hljs-property">enumerable</span>) <span class="hljs-keyword">yield</span> key;
}
}
<span class="hljs-keyword">const</span> proto = <span class="hljs-title class_">Reflect</span>.<span class="hljs-title function_">getPrototypeOf</span>(obj);
<span class="hljs-keyword">if</span> (proto === <span class="hljs-literal">null</span>) <span class="hljs-keyword">return</span>;
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> protoKey <span class="hljs-keyword">of</span> <span class="hljs-title class_">EnumerateObjectProperties</span>(proto)) {
<span class="hljs-keyword">if</span> (!visited.<span class="hljs-title function_">has</span>(protoKey)) <span class="hljs-keyword">yield</span> protoKey;
}
}</code></pre>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
The list of <emu-xref href="#exotic-object" id="_ref_7328"><a href="ecmascript-data-types-and-values.html#exotic-object">exotic objects</a></emu-xref> for which implementations are not required to match <emu-xref aoid="CreateForInIterator" id="_ref_7329"><a href="ecmascript-language-statements-and-declarations.html#sec-createforiniterator">CreateForInIterator</a></emu-xref> was chosen because implementations historically differed in behaviour for those cases, and agreed in all others.
</div></emu-note>
</emu-clause>
<emu-clause id="sec-for-in-iterator-objects">
<h1><span class="secnum">14.7.5.10</span> For-In Iterator Objects</h1>
<p>A <dfn variants="For-In Iterator object,For-In Iterator objects" tabindex="-1">For-In Iterator</dfn> is an object that represents a specific iteration over some specific object. For-In Iterator objects are never directly accessible to ECMAScript code; they exist solely to illustrate the behaviour of <emu-xref aoid="EnumerateObjectProperties" id="_ref_7330"><a href="ecmascript-language-statements-and-declarations.html#sec-enumerate-object-properties">EnumerateObjectProperties</a></emu-xref>.</p>
<emu-clause id="sec-createforiniterator" type="abstract operation" aoid="CreateForInIterator">
<h1><span class="secnum">14.7.5.10.1</span> CreateForInIterator ( <var>object</var> )</h1>
<p>The abstract operation CreateForInIterator takes argument <var>object</var> (an Object) and returns a <emu-xref href="#sec-for-in-iterator-objects" id="_ref_7331"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator</a></emu-xref>. It is used to create a <emu-xref href="#sec-for-in-iterator-objects" id="_ref_7332"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator object</a></emu-xref> which iterates over the own and inherited enumerable string properties of <var>object</var> in a specific order. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>iterator</var> be <emu-xref aoid="OrdinaryObjectCreate" id="_ref_7333"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-%foriniteratorprototype%-object" id="_ref_7334"><a href="ecmascript-language-statements-and-declarations.html#sec-%foriniteratorprototype%-object">%ForInIteratorPrototype%</a></emu-xref>, « <var class="field">[[Object]]</var>, <var class="field">[[ObjectWasVisited]]</var>, <var class="field">[[VisitedKeys]]</var>, <var class="field">[[RemainingKeys]]</var>&nbsp;»).</li><li>Set <var>iterator</var>.<var class="field">[[Object]]</var> to <var>object</var>.</li><li>Set <var>iterator</var>.<var class="field">[[ObjectWasVisited]]</var> to <emu-val>false</emu-val>.</li><li>Set <var>iterator</var>.<var class="field">[[VisitedKeys]]</var> to a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7335"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Set <var>iterator</var>.<var class="field">[[RemainingKeys]]</var> to a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7336"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Return <var>iterator</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-%foriniteratorprototype%-object">
<h1><span class="secnum">14.7.5.10.2</span> The %ForInIteratorPrototype% Object</h1>
<p>The <dfn tabindex="-1">%ForInIteratorPrototype%</dfn> object:</p>
<ul>
<li>has properties that are inherited by all <emu-xref href="#sec-for-in-iterator-objects" id="_ref_7337"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator objects</a></emu-xref>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_7338"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-%iterator.prototype%-object" id="_ref_7339"><a href="control-abstraction-objects.html#sec-%iterator.prototype%-object">%Iterator.prototype%</a></emu-xref>.</li>
<li>is never directly accessible to ECMAScript code.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-%foriniteratorprototype%.next" type="built-in function">
<h1><span class="secnum">14.7.5.10.2.1</span> %ForInIteratorPrototype%.next ( )</h1>
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li><emu-xref href="#assert" id="_ref_7340"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>O</var> <emu-xref href="#sec-object-type" id="_ref_7341"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref>.</li><li><emu-xref href="#assert" id="_ref_7342"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>O</var> has all of the internal slots of a <emu-xref href="#sec-for-in-iterator-objects" id="_ref_7343"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator</a></emu-xref> instance (<emu-xref href="#sec-properties-of-for-in-iterator-instances" id="_ref_454"><a href="ecmascript-language-statements-and-declarations.html#sec-properties-of-for-in-iterator-instances">14.7.5.10.3</a></emu-xref>).</li><li>Let <var>object</var> be <var>O</var>.<var class="field">[[Object]]</var>.</li><li>Repeat,<ol><li>If <var>O</var>.<var class="field">[[ObjectWasVisited]]</var> is <emu-val>false</emu-val>, then<ol><li>Let <var>keys</var> be ?&nbsp;<span class="e-user-code"><var>object</var>.<var class="field">[[OwnPropertyKeys]]</var>()</span>.</li><li>For each element <var>key</var> of <var>keys</var>, do<ol><li>If <var>key</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_7344"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li>Append <var>key</var> to <var>O</var>.<var class="field">[[RemainingKeys]]</var>.</li></ol></li></ol></li><li>Set <var>O</var>.<var class="field">[[ObjectWasVisited]]</var> to <emu-val>true</emu-val>.</li></ol></li><li>Repeat, while <var>O</var>.<var class="field">[[RemainingKeys]]</var> is not empty,<ol><li>Let <var>r</var> be the first element of <var>O</var>.<var class="field">[[RemainingKeys]]</var>.</li><li>Remove the first element from <var>O</var>.<var class="field">[[RemainingKeys]]</var>.</li><li>If <var>O</var>.<var class="field">[[VisitedKeys]]</var> does not contain <var>r</var>, then<ol><li>Let <var>desc</var> be ?&nbsp;<span class="e-user-code"><var>object</var>.<var class="field">[[GetOwnProperty]]</var>(<var>r</var>)</span>.</li><li>If <var>desc</var> is not <emu-val>undefined</emu-val>, then<ol><li>Append <var>r</var> to <var>O</var>.<var class="field">[[VisitedKeys]]</var>.</li><li>If <var>desc</var>.<var class="field">[[Enumerable]]</var> is <emu-val>true</emu-val>, return <emu-xref aoid="CreateIteratorResultObject" id="_ref_7345"><a href="abstract-operations.html#sec-createiterresultobject">CreateIteratorResultObject</a></emu-xref>(<var>r</var>, <emu-val>false</emu-val>).</li></ol></li></ol></li></ol></li><li>Set <var>object</var> to ?&nbsp;<span class="e-user-code"><var>object</var>.<var class="field">[[GetPrototypeOf]]</var>()</span>.</li><li>Set <var>O</var>.<var class="field">[[Object]]</var> to <var>object</var>.</li><li>Set <var>O</var>.<var class="field">[[ObjectWasVisited]]</var> to <emu-val>false</emu-val>.</li><li>If <var>object</var> is <emu-val>null</emu-val>, return <emu-xref aoid="CreateIteratorResultObject" id="_ref_7346"><a href="abstract-operations.html#sec-createiterresultobject">CreateIteratorResultObject</a></emu-xref>(<emu-val>undefined</emu-val>, <emu-val>true</emu-val>).</li></ol></li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-for-in-iterator-instances">
<h1><span class="secnum">14.7.5.10.3</span> Properties of For-In Iterator Instances</h1>
<p><emu-xref href="#sec-for-in-iterator-objects" id="_ref_7347"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator</a></emu-xref> instances are <emu-xref href="#ordinary-object" id="_ref_7348"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-%foriniteratorprototype%-object" id="_ref_7349"><a href="ecmascript-language-statements-and-declarations.html#sec-%foriniteratorprototype%-object">%ForInIteratorPrototype%</a></emu-xref> intrinsic object. <emu-xref href="#sec-for-in-iterator-objects" id="_ref_7350"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator</a></emu-xref> instances are initially created with the internal slots listed in <emu-xref href="#table-for-in-iterator-instance-slots" id="_ref_455"><a href="ecmascript-language-statements-and-declarations.html#table-for-in-iterator-instance-slots">Table 33</a></emu-xref>.</p>
<emu-table id="table-for-in-iterator-instance-slots" caption="Internal Slots of For-In Iterator Instances"><figure><figcaption>Table 33: Internal Slots of <emu-xref href="#sec-for-in-iterator-objects" id="_ref_7351"><a href="ecmascript-language-statements-and-declarations.html#sec-for-in-iterator-objects">For-In Iterator</a></emu-xref> Instances</figcaption>
<table>
<thead>
<tr>
<th>
Internal Slot
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody><tr>
<td>
<var class="field">[[Object]]</var>
</td>
<td>
an Object
</td>
<td>
The Object value whose properties are being iterated.
</td>
</tr>
<tr>
<td>
<var class="field">[[ObjectWasVisited]]</var>
</td>
<td>
a Boolean
</td>
<td>
<emu-val>true</emu-val> if the <emu-xref href="#sec-iterator-interface" id="_ref_7352"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref> has invoked <var class="field">[[OwnPropertyKeys]]</var> on <var class="field">[[Object]]</var>, <emu-val>false</emu-val> otherwise.
</td>
</tr>
<tr>
<td>
<var class="field">[[VisitedKeys]]</var>
</td>
<td>
a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7353"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings
</td>
<td>
The values that have been emitted by this <emu-xref href="#sec-iterator-interface" id="_ref_7354"><a href="control-abstraction-objects.html#sec-iterator-interface">iterator</a></emu-xref> thus far.
</td>
</tr>
<tr>
<td>
<var class="field">[[RemainingKeys]]</var>
</td>
<td>
a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7355"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings
</td>
<td>
The values remaining to be emitted for the current object, before iterating the properties of its prototype (if its prototype is not <emu-val>null</emu-val>).
</td>
</tr>
</tbody></table>
</figure></emu-table>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-continue-statement">
<h1><span class="secnum">14.8</span> The <code>continue</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="ContinueStatement" params="Yield, Await" id="prod-ContinueStatement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="6qppgxyk" id="prod-rfM2mnQY">
<emu-t>continue</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
<emu-rhs a="fiwlh1nt" id="prod-w6m19zWs">
<emu-t>continue</emu-t>
<emu-gann>[no <emu-nt id="_ref_21926"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</emu-gann>
<emu-nt params="?Yield, ?Await" id="_ref_21927"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-continue-statement-static-semantics-early-errors">
<h1><span class="secnum">14.8.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="ContinueStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="6qppgxyk">
<emu-t>continue</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
<emu-rhs a="wh7qddgu">
<emu-t>continue</emu-t>
<emu-nt id="_ref_21928"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if this <emu-nt id="_ref_21929"><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a></emu-nt> is not nested, directly or indirectly (but not crossing function or <code>static</code> initialization block boundaries), within an <emu-nt id="_ref_21930"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-continue-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.8.2</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="ContinueStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="6qppgxyk" id="prod-MdaDQGie">
<emu-t>continue</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-xref href="#sec-completion-record-specification-type" id="_ref_7356"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> { <var class="field">[[Type]]</var>: <emu-const>continue</emu-const>, <var class="field">[[Value]]</var>: <emu-const>empty</emu-const>, <var class="field">[[Target]]</var>: <emu-const>empty</emu-const>&nbsp;}.</li></ol></emu-alg>
<emu-grammar><emu-production name="ContinueStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="wh7qddgu" id="prod-sLmRG5Rx">
<emu-t>continue</emu-t>
<emu-nt id="_ref_21931"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>label</var> be the <emu-xref aoid="StringValue" id="_ref_7357"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21932"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>.</li><li>Return <emu-xref href="#sec-completion-record-specification-type" id="_ref_7358"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> { <var class="field">[[Type]]</var>: <emu-const>continue</emu-const>, <var class="field">[[Value]]</var>: <emu-const>empty</emu-const>, <var class="field">[[Target]]</var>: <var>label</var>&nbsp;}.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-break-statement">
<h1><span class="secnum">14.9</span> The <code>break</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="BreakStatement" params="Yield, Await" id="prod-BreakStatement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="tlip5zkt" id="prod-Jyx4vreG">
<emu-t>break</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
<emu-rhs a="nio0l2c9" id="prod-_aoH2Ltk">
<emu-t>break</emu-t>
<emu-gann>[no <emu-nt id="_ref_21933"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</emu-gann>
<emu-nt params="?Yield, ?Await" id="_ref_21934"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-break-statement-static-semantics-early-errors">
<h1><span class="secnum">14.9.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="BreakStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="tlip5zkt">
<emu-t>break</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if this <emu-nt id="_ref_21935"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a></emu-nt> is not nested, directly or indirectly (but not crossing function or <code>static</code> initialization block boundaries), within an <emu-nt id="_ref_21936"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> or a <emu-nt id="_ref_21937"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-break-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.9.2</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="BreakStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="tlip5zkt" id="prod-0ioO2qvc">
<emu-t>break</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-xref href="#sec-completion-record-specification-type" id="_ref_7359"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> { <var class="field">[[Type]]</var>: <emu-const>break</emu-const>, <var class="field">[[Value]]</var>: <emu-const>empty</emu-const>, <var class="field">[[Target]]</var>: <emu-const>empty</emu-const>&nbsp;}.</li></ol></emu-alg>
<emu-grammar><emu-production name="BreakStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="kcg-yy3r" id="prod-eokV1qEw">
<emu-t>break</emu-t>
<emu-nt id="_ref_21938"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>label</var> be the <emu-xref aoid="StringValue" id="_ref_7360"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_21939"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>.</li><li>Return <emu-xref href="#sec-completion-record-specification-type" id="_ref_7361"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> { <var class="field">[[Type]]</var>: <emu-const>break</emu-const>, <var class="field">[[Value]]</var>: <emu-const>empty</emu-const>, <var class="field">[[Target]]</var>: <var>label</var>&nbsp;}.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-return-statement">
<h1><span class="secnum">14.10</span> The <code>return</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="ReturnStatement" params="Yield, Await" id="prod-ReturnStatement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="cykzgrgr" id="prod-zZYaGxQ8">
<emu-t>return</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
<emu-rhs a="tybfdyhl" id="prod-TbDZIC37">
<emu-t>return</emu-t>
<emu-gann>[no <emu-nt id="_ref_21940"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</emu-gann>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21941"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>A <code>return</code> statement causes a function to cease execution and, in most cases, returns a value to the caller. If <emu-nt id="_ref_21942"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> is omitted, the return value is <emu-val>undefined</emu-val>. Otherwise, the return value is the value of <emu-nt id="_ref_21943"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>. A <code>return</code> statement may not actually return a value to the caller depending on surrounding context. For example, in a <code>try</code> block, a <code>return</code> statement's <emu-xref href="#sec-completion-record-specification-type" id="_ref_7362"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> may be replaced with another <emu-xref href="#sec-completion-record-specification-type" id="_ref_7363"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> during evaluation of the <code>finally</code> block.</p>
</div></emu-note>
<emu-clause id="sec-return-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.10.1</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="ReturnStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="cykzgrgr" id="prod-G_yzzAkQ">
<emu-t>return</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-xref aoid="ReturnCompletion" id="_ref_7364"><a href="ecmascript-data-types-and-values.html#sec-returncompletion">ReturnCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li></ol></emu-alg>
<emu-grammar><emu-production name="ReturnStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="tpdzx2lh" id="prod-iroo5DiR">
<emu-t>return</emu-t>
<emu-nt id="_ref_21944"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7365"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21945"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>exprValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7366"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li><li>If <emu-xref aoid="GetGeneratorKind" id="_ref_7367"><a href="control-abstraction-objects.html#sec-getgeneratorkind">GetGeneratorKind</a></emu-xref>() is <emu-const>async</emu-const>, set <var>exprValue</var> to ?&nbsp;<emu-xref aoid="Await" id="_ref_7368"><a href="control-abstraction-objects.html#await" class="e-user-code">Await</a></emu-xref>(<var>exprValue</var>).</li><li>Return <emu-xref aoid="ReturnCompletion" id="_ref_7369"><a href="ecmascript-data-types-and-values.html#sec-returncompletion">ReturnCompletion</a></emu-xref>(<var>exprValue</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-with-statement" legacy=""><div class="attributes-tag"><emu-xref href="#sec-conformance" id="_ref_7388"><a href="conformance.html#sec-conformance">Legacy</a></emu-xref></div>
<h1><span class="secnum">14.11</span> The <code>with</code> Statement</h1>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>Use of the <emu-xref href="#sec-conformance" id="_ref_7370"><a href="conformance.html#sec-conformance">Legacy</a></emu-xref> <code>with</code> statement is discouraged in new ECMAScript code. Consider alternatives that are permitted in both <emu-xref href="#sec-strict-mode-code" id="_ref_7371"><a href="ecmascript-language-source-code.html#sec-strict-mode-code">strict mode code</a></emu-xref> and <emu-xref href="#non-strict-code" id="_ref_7372"><a href="ecmascript-language-source-code.html#non-strict-code">non-strict code</a></emu-xref>, such as <emu-xref href="#sec-destructuring-assignment" id="_ref_456"><a href="ecmascript-language-expressions.html#sec-destructuring-assignment">destructuring assignment</a></emu-xref>.</p>
</div></emu-note>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="WithStatement" params="Yield, Await, Return" id="prod-WithStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-WithStatement">WithStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="lo7bccts" id="prod-3HlNX-pI">
<emu-t>with</emu-t>
<emu-t>(</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21946"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21947"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The <code>with</code> statement adds an <emu-xref href="#sec-object-environment-records" id="_ref_7373"><a href="executable-code-and-execution-contexts.html#sec-object-environment-records">Object Environment Record</a></emu-xref> for a computed object to the lexical environment of the <emu-xref href="#running-execution-context" id="_ref_7374"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>. It then executes a statement using this augmented lexical environment. Finally, it restores the original lexical environment.</p>
</div></emu-note>
<emu-clause id="sec-with-statement-static-semantics-early-errors">
<h1><span class="secnum">14.11.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="WithStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-WithStatement">WithStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="i70kview">
<emu-t>with</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21948"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21949"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if <emu-xref aoid="IsStrict" id="_ref_7375"><a href="ecmascript-language-source-code.html#sec-isstrict">IsStrict</a></emu-xref>(this production) is <emu-val>true</emu-val>.
</li>
<li>
It is a Syntax Error if <emu-xref aoid="IsLabelledFunction" id="_ref_7376"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<emu-nt id="_ref_21950"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>) is <emu-val>true</emu-val>.
</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is only necessary to apply the second rule if the extension specified in <emu-xref href="#sec-labelled-function-declarations" id="_ref_457"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">B.3.1</a></emu-xref> is implemented.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-with-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.11.2</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="WithStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-WithStatement">WithStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="i70kview" id="prod-OowrNhmq">
<emu-t>with</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21951"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21952"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>val</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7377"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21953"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>obj</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_7378"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(? <emu-xref aoid="GetValue" id="_ref_7379"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>val</var>)).</li><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7380"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>newEnv</var> be <emu-xref aoid="NewObjectEnvironment" id="_ref_7381"><a href="executable-code-and-execution-contexts.html#sec-newobjectenvironment">NewObjectEnvironment</a></emu-xref>(<var>obj</var>, <emu-val>true</emu-val>, <var>oldEnv</var>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7382"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>newEnv</var>.</li><li>Let <var>C</var> be <emu-xref aoid="Completion" id="_ref_7383"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7384"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21954"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7385"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7386"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>C</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>No matter how control leaves the embedded <emu-nt id="_ref_21955"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>, whether normally or by some form of <emu-xref href="#sec-completion-record-specification-type" id="_ref_7387"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> or exception, the LexicalEnvironment is always restored to its former state.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-switch-statement">
<h1><span class="secnum">14.12</span> The <code>switch</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="SwitchStatement" params="Yield, Await, Return" id="prod-SwitchStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="drlywp4w" id="prod-3xRnqKfC">
<emu-t>switch</emu-t>
<emu-t>(</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21956"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21957"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="CaseBlock" params="Yield, Await, Return" id="prod-CaseBlock">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="v-h2atfk" id="prod-q66ZlOHI">
<emu-t>{</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" optional="" id="_ref_21958"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
<emu-rhs a="00sitdqr" id="prod-JuWwIrcZ">
<emu-t>{</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" optional="" id="_ref_21959"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21960"><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" optional="" id="_ref_21961"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="CaseClauses" params="Yield, Await, Return" id="prod-CaseClauses">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="xpjvtgza">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21962"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="8r6dchoz" id="prod-sjZo1Z65">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21963"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_21964"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="CaseClause" params="Yield, Await, Return" id="prod-CaseClause">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="zpq23qtn" id="prod-A-5Q_6I5">
<emu-t>case</emu-t>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_21965"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>:</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" optional="" id="_ref_21966"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="DefaultClause" params="Yield, Await, Return" id="prod-DefaultClause">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="djnlaxcj" id="prod-HPF3iA_C">
<emu-t>default</emu-t>
<emu-t>:</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" optional="" id="_ref_21967"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-switch-statement-static-semantics-early-errors" oldids="sec-switch-duplicates-allowed-static-semantics"><span id="sec-switch-duplicates-allowed-static-semantics"></span>
<h1><span class="secnum">14.12.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="SwitchStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uvrp_hkw">
<emu-t>switch</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_21968"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_21969"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
<p>It is a Syntax Error if the <emu-xref aoid="LexicallyDeclaredNames" id="_ref_7389"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallydeclarednames">LexicallyDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21970"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> contains any duplicate entries<span normative-optional="">, unless the <emu-xref href="#host" id="_ref_7390"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title="" id="_ref_458"><a href="additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics">Block-Level Function Declarations Web Legacy Compatibility Semantics</a></emu-xref>, and both of the following conditions are true:</span></p>
<ul normative-optional="">
<li><emu-xref aoid="IsStrict" id="_ref_7391"><a href="ecmascript-language-source-code.html#sec-isstrict">IsStrict</a></emu-xref>(this production) is <emu-val>false</emu-val>.</li>
<li>The duplicate entries are only bound by FunctionDeclarations.</li>
</ul>
</li>
<li>
It is a Syntax Error if any element of the <emu-xref aoid="LexicallyDeclaredNames" id="_ref_7392"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallydeclarednames">LexicallyDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21971"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> also occurs in the <emu-xref aoid="VarDeclaredNames" id="_ref_7393"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <emu-nt id="_ref_21972"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-runtime-semantics-caseblockevaluation" type="sdo" aoid="CaseBlockEvaluation">
<h1><span class="secnum">14.12.2</span> Runtime Semantics: CaseBlockEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7394"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> CaseBlockEvaluation takes argument <var>input</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7395"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7396"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7397"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7398"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="CaseBlock" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gbpaspne" id="prod--oXyocga">
<emu-t>{</emu-t>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-val>undefined</emu-val>.</li></ol></emu-alg>
<emu-grammar><emu-production name="CaseBlock" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="eerblgqb" id="prod-n6COrqbY">
<emu-t>{</emu-t>
<emu-nt id="_ref_21973"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>V</var> be <emu-val>undefined</emu-val>.</li><li>Let <var>A</var> be the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7399"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-nt id="_ref_21974"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> items in <emu-nt id="_ref_21975"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt>, in source text order.</li><li>Let <var>found</var> be <emu-val>false</emu-val>.</li><li>For each <emu-nt id="_ref_21976"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <var>C</var> of <var>A</var>, do<ol><li>If <var>found</var> is <emu-val>false</emu-val>, then<ol><li>Set <var>found</var> to ?&nbsp;<emu-xref aoid="CaseClauseIsSelected" id="_ref_7400"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-caseclauseisselected" class="e-user-code">CaseClauseIsSelected</a></emu-xref>(<var>C</var>, <var>input</var>).</li></ol></li><li>If <var>found</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>R</var> be <emu-xref aoid="Completion" id="_ref_7401"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7402"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>C</var>).</li><li>If <var>R</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>R</var>.<var class="field">[[Value]]</var>.</li><li>If <var>R</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7403"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7404"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>R</var>, <var>V</var>).</li></ol></li></ol></li><li>Return <var>V</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="CaseBlock" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ududlhou" id="prod-bc5B_Aaw">
<emu-t>{</emu-t>
<emu-nt optional="" id="_ref_21977"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-nt id="_ref_21978"><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a></emu-nt>
<emu-nt optional="" id="_ref_21979"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
<emu-t>}</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>V</var> be <emu-val>undefined</emu-val>.</li><li>If the first <emu-nt id="_ref_21980"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt> is present, then<ol><li>Let <var>A</var> be the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7405"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-nt id="_ref_21981"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> items in the first <emu-nt id="_ref_21982"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt>, in source text order.</li></ol></li><li>Else,<ol><li>Let <var>A</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7406"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li></ol></li><li>Let <var>found</var> be <emu-val>false</emu-val>.</li><li>For each <emu-nt id="_ref_21983"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <var>C</var> of <var>A</var>, do<ol><li>If <var>found</var> is <emu-val>false</emu-val>, then<ol><li>Set <var>found</var> to ?&nbsp;<emu-xref aoid="CaseClauseIsSelected" id="_ref_7407"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-caseclauseisselected" class="e-user-code">CaseClauseIsSelected</a></emu-xref>(<var>C</var>, <var>input</var>).</li></ol></li><li>If <var>found</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>R</var> be <emu-xref aoid="Completion" id="_ref_7408"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7409"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <var>C</var>).</li><li>If <var>R</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>R</var>.<var class="field">[[Value]]</var>.</li><li>If <var>R</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7410"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7411"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>R</var>, <var>V</var>).</li></ol></li></ol></li><li>Let <var>foundInB</var> be <emu-val>false</emu-val>.</li><li>If the second <emu-nt id="_ref_21984"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt> is present, then<ol><li>Let <var>B</var> be the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7412"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-nt id="_ref_21985"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> items in the second <emu-nt id="_ref_21986"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt>, in source text order.</li></ol></li><li>Else,<ol><li>Let <var>B</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7413"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li></ol></li><li>If <var>found</var> is <emu-val>false</emu-val>, then<ol><li>For each <emu-nt id="_ref_21987"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <var>C</var> of <var>B</var>, do<ol><li>If <var>foundInB</var> is <emu-val>false</emu-val>, then<ol><li>Set <var>foundInB</var> to ?&nbsp;<emu-xref aoid="CaseClauseIsSelected" id="_ref_7414"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-caseclauseisselected" class="e-user-code">CaseClauseIsSelected</a></emu-xref>(<var>C</var>, <var>input</var>).</li></ol></li><li>If <var>foundInB</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>R</var> be <emu-xref aoid="Completion" id="_ref_7415"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7416"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21988"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <var>C</var>).</li><li>If <var>R</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>R</var>.<var class="field">[[Value]]</var>.</li><li>If <var>R</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7417"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7418"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>R</var>, <var>V</var>).</li></ol></li></ol></li></ol></li><li>If <var>foundInB</var> is <emu-val>true</emu-val>, return <var>V</var>.</li><li>Let <var>defaultR</var> be <emu-xref aoid="Completion" id="_ref_7419"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7420"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21989"><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a></emu-nt>).</li><li>If <var>defaultR</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>defaultR</var>.<var class="field">[[Value]]</var>.</li><li>If <var>defaultR</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7421"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7422"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>defaultR</var>, <var>V</var>).</li><li>NOTE: The following is another complete iteration of the second <emu-nt id="_ref_21990"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClauses">CaseClauses</a></emu-nt>.</li><li>For each <emu-nt id="_ref_21991"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <var>C</var> of <var>B</var>, do<ol><li>Let <var>R</var> be <emu-xref aoid="Completion" id="_ref_7423"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7424"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_21992"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <var>C</var>).</li><li>If <var>R</var>.<var class="field">[[Value]]</var> is not <emu-const>empty</emu-const>, set <var>V</var> to <var>R</var>.<var class="field">[[Value]]</var>.</li><li>If <var>R</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7425"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7426"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>R</var>, <var>V</var>).</li></ol></li><li>Return <var>V</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-caseclauseisselected" type="abstract operation" oldids="sec-runtime-semantics-caseselectorevaluation" aoid="CaseClauseIsSelected"><span id="sec-runtime-semantics-caseselectorevaluation"></span>
<h1><span class="secnum">14.12.3</span> CaseClauseIsSelected ( <var>C</var>, <var>input</var> )</h1>
<p>The abstract operation CaseClauseIsSelected takes arguments <var>C</var> (a <emu-nt id="_ref_21993"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7427"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>) and <var>input</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7428"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7429"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Boolean or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7430"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It determines whether <var>C</var> matches <var>input</var>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_7431"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>C</var> is an instance of the production <emu-grammar><emu-production name="CaseClause" collapsed="" class=" inline">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="x20nmjyd">
<emu-t>case</emu-t>
<emu-nt id="_ref_21994"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>:</emu-t>
<emu-nt optional="" id="_ref_21995"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>.</li><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7432"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of the <emu-nt id="_ref_21996"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt> of <var>C</var>.</li><li>Let <var>clauseSelector</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7433"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li><li>Return <emu-xref aoid="IsStrictlyEqual" id="_ref_7434"><a href="abstract-operations.html#sec-isstrictlyequal">IsStrictlyEqual</a></emu-xref>(<var>input</var>, <var>clauseSelector</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This operation does not execute <var>C</var>'s <emu-nt id="_ref_21997"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> (if any). The <emu-nt id="_ref_21998"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> algorithm uses its return value to determine which <emu-nt id="_ref_21999"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt> to start executing.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-switch-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.12.4</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="SwitchStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uvrp_hkw" id="prod-raA0Z_ll">
<emu-t>switch</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_22000"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_22001"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7435"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22002"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>switchValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7436"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7437"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>blockEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_7438"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>oldEnv</var>).</li><li>Perform <emu-xref aoid="BlockDeclarationInstantiation" id="_ref_7439"><a href="ecmascript-language-statements-and-declarations.html#sec-blockdeclarationinstantiation">BlockDeclarationInstantiation</a></emu-xref>(<emu-nt id="_ref_22003"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt>, <var>blockEnv</var>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7440"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>blockEnv</var>.</li><li>Let <var>R</var> be <emu-xref aoid="Completion" id="_ref_7441"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="CaseBlockEvaluation" id="_ref_7442"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-caseblockevaluation" class="e-user-code">CaseBlockEvaluation</a></emu-xref> of <emu-nt id="_ref_22004"><a href="ecmascript-language-statements-and-declarations.html#prod-CaseBlock">CaseBlock</a></emu-nt> with argument <var>switchValue</var>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7443"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return <var>R</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>No matter how control leaves the <emu-nt id="_ref_22005"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt> the LexicalEnvironment is always restored to its former state.</p>
</div></emu-note>
<emu-grammar><emu-production name="CaseClause" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="amgxmkjg" id="prod-pfa8PeiE">
<emu-t>case</emu-t>
<emu-nt id="_ref_22006"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>:</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="CaseClause" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CaseClause">CaseClause</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="eencdyk7" id="prod-SiRXsnRx">
<emu-t>case</emu-t>
<emu-nt id="_ref_22007"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>:</emu-t>
<emu-nt id="_ref_22008"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7444"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22009"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>.</li></ol></emu-alg>
<emu-grammar><emu-production name="DefaultClause" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="t5rjsefq" id="prod-f0Rq5Irs">
<emu-t>default</emu-t>
<emu-t>:</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-grammar><emu-production name="DefaultClause" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-DefaultClause">DefaultClause</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="odaivkwk" id="prod-eOryVE-Y">
<emu-t>default</emu-t>
<emu-t>:</emu-t>
<emu-nt id="_ref_22010"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7445"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22011"><a href="ecmascript-language-statements-and-declarations.html#prod-StatementList">StatementList</a></emu-nt>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-labelled-statements">
<h1><span class="secnum">14.13</span> Labelled Statements</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="LabelledStatement" params="Yield, Await, Return" id="prod-LabelledStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="vhxkapdt" id="prod-0GG8m5VC">
<emu-nt params="?Yield, ?Await" id="_ref_22012"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>:</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22013"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="LabelledItem" params="Yield, Await, Return" id="prod-LabelledItem">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="septp5sa" id="prod-YaWmIZ1c">
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22014"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="d0nwjyav" id="prod-GPTeOVBJ">
<emu-nt params="?Yield, ?Await, ~Default" id="_ref_22015"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a><emu-mods><emu-params>[?Yield, ?Await, ~Default]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>A <emu-nt id="_ref_22016"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> 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 <emu-nt id="_ref_22017"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> can be part of a <emu-nt id="_ref_22018"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt>, which itself can be part of a <emu-nt id="_ref_22019"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt>, and so on. The labels introduced this way are collectively referred to as the “current label set” when describing the semantics of individual statements.</p>
</div></emu-note>
<emu-clause id="sec-labelled-statements-static-semantics-early-errors">
<h1><span class="secnum">14.13.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="LabelledItem" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="-nqupnlb"><emu-nt id="_ref_22020"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if any source text is matched by this production<span normative-optional="">, unless that source text is <emu-xref href="#non-strict-code" id="_ref_7446"><a href="ecmascript-language-source-code.html#non-strict-code">non-strict code</a></emu-xref> and the <emu-xref href="#host" id="_ref_7447"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-labelled-function-declarations" title="" id="_ref_459"><a href="additional-ecmascript-features-for-web-browsers.html#sec-labelled-function-declarations">Labelled Function Declarations</a></emu-xref></span>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-islabelledfunction" type="abstract operation" aoid="IsLabelledFunction">
<h1><span class="secnum">14.13.2</span> Static Semantics: IsLabelledFunction ( <var>stmt</var> )</h1>
<p>The abstract operation IsLabelledFunction takes argument <var>stmt</var> (a <emu-nt id="_ref_22021"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_7448"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>) and returns a Boolean. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>stmt</var> is not a <emu-nt id="_ref_22022"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt>, return <emu-val>false</emu-val>.</li><li>Let <var>item</var> be the <emu-nt id="_ref_22023"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt> of <var>stmt</var>.</li><li>If <var>item</var> is <emu-grammar><emu-production name="LabelledItem" collapsed="" class=" inline">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="-nqupnlb"><emu-nt id="_ref_22024"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>, return <emu-val>true</emu-val>.</li><li>Let <var>subStmt</var> be the <emu-nt id="_ref_22025"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> of <var>item</var>.</li><li>Return <emu-xref aoid="IsLabelledFunction" id="_ref_7449"><a href="ecmascript-language-statements-and-declarations.html#sec-islabelledfunction">IsLabelledFunction</a></emu-xref>(<var>subStmt</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-labelled-statements-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.13.3</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="LabelledStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ubbvtbun" id="prod-z6MMrwO3">
<emu-nt id="_ref_22026"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>
<emu-t>:</emu-t>
<emu-nt id="_ref_22027"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="LabelledEvaluation" id="_ref_7450"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-labelledevaluation" class="e-user-code">LabelledEvaluation</a></emu-xref> of this <emu-nt id="_ref_22028"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt> with argument «&nbsp;».</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-runtime-semantics-labelledevaluation" oldids="sec-statement-semantics-runtime-semantics-labelledevaluation,sec-labelled-statements-runtime-semantics-labelledevaluation" type="sdo" aoid="LabelledEvaluation"><span id="sec-labelled-statements-runtime-semantics-labelledevaluation"></span><span id="sec-statement-semantics-runtime-semantics-labelledevaluation"></span>
<h1><span class="secnum">14.13.4</span> Runtime Semantics: LabelledEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7451"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> LabelledEvaluation takes argument <var>labelSet</var> (a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_7452"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of Strings) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7453"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7454"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or <emu-const>empty</emu-const>, or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7455"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="BreakableStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="kmxl4yum" id="prod-pR7DNQsN"><emu-nt id="_ref_22029"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>stmtResult</var> be <emu-xref aoid="Completion" id="_ref_7456"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="LoopEvaluation" id="_ref_7457"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-loopevaluation" class="e-user-code">LoopEvaluation</a></emu-xref> of <emu-nt id="_ref_22030"><a href="ecmascript-language-statements-and-declarations.html#prod-IterationStatement">IterationStatement</a></emu-nt> with argument <var>labelSet</var>).</li><li>If <var>stmtResult</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7458"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">break completion</a></emu-xref>, then<ol><li>If <var>stmtResult</var>.<var class="field">[[Target]]</var> is <emu-const>empty</emu-const>, then<ol><li>If <var>stmtResult</var>.<var class="field">[[Value]]</var> is <emu-const>empty</emu-const>, set <var>stmtResult</var> to <emu-xref aoid="NormalCompletion" id="_ref_7459"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li><li>Else, set <var>stmtResult</var> to <emu-xref aoid="NormalCompletion" id="_ref_7460"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<var>stmtResult</var>.<var class="field">[[Value]]</var>).</li></ol></li></ol></li><li>Return ?&nbsp;<var>stmtResult</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="BreakableStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="nuio-xfp" id="prod-FSHcHfYw"><emu-nt id="_ref_22031"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>stmtResult</var> be <emu-xref aoid="Completion" id="_ref_7461"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7462"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22032"><a href="ecmascript-language-statements-and-declarations.html#prod-SwitchStatement">SwitchStatement</a></emu-nt>).</li><li>If <var>stmtResult</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7463"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">break completion</a></emu-xref>, then<ol><li>If <var>stmtResult</var>.<var class="field">[[Target]]</var> is <emu-const>empty</emu-const>, then<ol><li>If <var>stmtResult</var>.<var class="field">[[Value]]</var> is <emu-const>empty</emu-const>, set <var>stmtResult</var> to <emu-xref aoid="NormalCompletion" id="_ref_7464"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li><li>Else, set <var>stmtResult</var> to <emu-xref aoid="NormalCompletion" id="_ref_7465"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<var>stmtResult</var>.<var class="field">[[Value]]</var>).</li></ol></li></ol></li><li>Return ?&nbsp;<var>stmtResult</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>A <emu-nt id="_ref_22033"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a></emu-nt> is one that can be exited via an unlabelled <emu-nt id="_ref_22034"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a></emu-nt>.</p>
</div></emu-note>
<emu-grammar><emu-production name="LabelledStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ubbvtbun" id="prod-GnWrgP5w">
<emu-nt id="_ref_22035"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>
<emu-t>:</emu-t>
<emu-nt id="_ref_22036"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>label</var> be the <emu-xref aoid="StringValue" id="_ref_7466"><a href="ecmascript-language-expressions.html#sec-static-semantics-stringvalue">StringValue</a></emu-xref> of <emu-nt id="_ref_22037"><a href="ecmascript-language-expressions.html#prod-LabelIdentifier">LabelIdentifier</a></emu-nt>.</li><li>Let <var>newLabelSet</var> be the <emu-xref href="#list-concatenation" id="_ref_7467"><a href="ecmascript-data-types-and-values.html#list-concatenation">list-concatenation</a></emu-xref> of <var>labelSet</var> and « <var>label</var>&nbsp;».</li><li>Let <var>stmtResult</var> be <emu-xref aoid="Completion" id="_ref_7468"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="LabelledEvaluation" id="_ref_7469"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-labelledevaluation" class="e-user-code">LabelledEvaluation</a></emu-xref> of <emu-nt id="_ref_22038"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt> with argument <var>newLabelSet</var>).</li><li>If <var>stmtResult</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7470"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">break completion</a></emu-xref> and <var>stmtResult</var>.<var class="field">[[Target]]</var> is <var>label</var>, then<ol><li>Set <var>stmtResult</var> to <emu-xref aoid="NormalCompletion" id="_ref_7471"><a href="ecmascript-data-types-and-values.html#sec-normalcompletion">NormalCompletion</a></emu-xref>(<var>stmtResult</var>.<var class="field">[[Value]]</var>).</li></ol></li><li>Return ?&nbsp;<var>stmtResult</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="LabelledItem" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledItem">LabelledItem</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="-nqupnlb" id="prod-3whCJM4e"><emu-nt id="_ref_22039"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7472"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22040"><a href="ecmascript-language-functions-and-classes.html#prod-FunctionDeclaration">FunctionDeclaration</a></emu-nt>.</li></ol></emu-alg>
<emu-grammar><emu-production name="Statement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gre9qn6e" id="prod-yFnpxPRG">
<emu-nt id="_ref_22041"><a href="ecmascript-language-statements-and-declarations.html#prod-BlockStatement">BlockStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="iwwn8atx" id="prod-Ebz5cXwH">
<emu-nt id="_ref_22042"><a href="ecmascript-language-statements-and-declarations.html#prod-VariableStatement">VariableStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="cziqu-45" id="prod-qI_HU3XB">
<emu-nt id="_ref_22043"><a href="ecmascript-language-statements-and-declarations.html#prod-EmptyStatement">EmptyStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="gsqkt2bv" id="prod-aRwgRfmk">
<emu-nt id="_ref_22044"><a href="ecmascript-language-statements-and-declarations.html#prod-ExpressionStatement">ExpressionStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="skawbrez" id="prod-RLprpFgP">
<emu-nt id="_ref_22045"><a href="ecmascript-language-statements-and-declarations.html#prod-IfStatement">IfStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="hx0ynljx" id="prod-4r9ecQgz">
<emu-nt id="_ref_22046"><a href="ecmascript-language-statements-and-declarations.html#prod-ContinueStatement">ContinueStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="q4uv-sm3" id="prod-VyFRxEGQ">
<emu-nt id="_ref_22047"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakStatement">BreakStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="qm95e4wi" id="prod-Hgg1wqRZ">
<emu-nt id="_ref_22048"><a href="ecmascript-language-statements-and-declarations.html#prod-ReturnStatement">ReturnStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="ye6wwgts" id="prod-wFzN_sG0">
<emu-nt id="_ref_22049"><a href="ecmascript-language-statements-and-declarations.html#prod-WithStatement">WithStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="hntake-o" id="prod-q_qjzdry">
<emu-nt id="_ref_22050"><a href="ecmascript-language-statements-and-declarations.html#prod-ThrowStatement">ThrowStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="ex_crokj" id="prod-7PJ339VQ">
<emu-nt id="_ref_22051"><a href="ecmascript-language-statements-and-declarations.html#prod-TryStatement">TryStatement</a></emu-nt>
</emu-rhs>
<emu-rhs a="iseu28qi" id="prod-O3yX8Gg7">
<emu-nt id="_ref_22052"><a href="ecmascript-language-statements-and-declarations.html#prod-DebuggerStatement">DebuggerStatement</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7473"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22053"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt>.</li></ol></emu-alg>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The only two productions of <emu-nt id="_ref_22054"><a href="ecmascript-language-statements-and-declarations.html#prod-Statement">Statement</a></emu-nt> which have special semantics for LabelledEvaluation are <emu-nt id="_ref_22055"><a href="ecmascript-language-statements-and-declarations.html#prod-BreakableStatement">BreakableStatement</a></emu-nt> and <emu-nt id="_ref_22056"><a href="ecmascript-language-statements-and-declarations.html#prod-LabelledStatement">LabelledStatement</a></emu-nt>.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-throw-statement">
<h1><span class="secnum">14.14</span> The <code>throw</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="ThrowStatement" params="Yield, Await" id="prod-ThrowStatement">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-ThrowStatement">ThrowStatement</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="q_cybpdb" id="prod-E5ckYtCh">
<emu-t>throw</emu-t>
<emu-gann>[no <emu-nt id="_ref_22057"><a href="ecmascript-language-lexical-grammar.html#prod-LineTerminator">LineTerminator</a></emu-nt> here]</emu-gann>
<emu-nt params="+In, ?Yield, ?Await" id="_ref_22058"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a><emu-mods><emu-params>[+In, ?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-throw-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.14.1</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="ThrowStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-ThrowStatement">ThrowStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="lauy4mhi" id="prod-fEMuit66">
<emu-t>throw</emu-t>
<emu-nt id="_ref_22059"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>exprRef</var> be ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7474"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22060"><a href="ecmascript-language-expressions.html#prod-Expression">Expression</a></emu-nt>.</li><li>Let <var>exprValue</var> be ?&nbsp;<emu-xref aoid="GetValue" id="_ref_7475"><a href="ecmascript-data-types-and-values.html#sec-getvalue" class="e-user-code">GetValue</a></emu-xref>(<var>exprRef</var>).</li><li>Return <emu-xref aoid="ThrowCompletion" id="_ref_7476"><a href="ecmascript-data-types-and-values.html#sec-throwcompletion">ThrowCompletion</a></emu-xref>(<var>exprValue</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-try-statement">
<h1><span class="secnum">14.15</span> The <code>try</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="TryStatement" params="Yield, Await, Return" id="prod-TryStatement">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-TryStatement">TryStatement</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="eqx7gx8m" id="prod-wD-TPYub">
<emu-t>try</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22061"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22062"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="ayio9dod" id="prod-EYIEedje">
<emu-t>try</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22063"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22064"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="yfzmez3t" id="prod-cfkI0NCS">
<emu-t>try</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22065"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22066"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22067"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="Catch" params="Yield, Await, Return" id="prod-Catch">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gk6mks18" id="prod-IbvHsEaf">
<emu-t>catch</emu-t>
<emu-t>(</emu-t>
<emu-nt params="?Yield, ?Await" id="_ref_22068"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
<emu-t>)</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22069"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="vi_srlx8" id="prod-ybInUotF">
<emu-t>catch</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22070"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="Finally" params="Yield, Await, Return" id="prod-Finally">
<emu-nt params="Yield, Await, Return"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a><emu-mods><emu-params>[Yield, Await, Return]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="e9akqlxo">
<emu-t>finally</emu-t>
<emu-nt params="?Yield, ?Await, ?Return" id="_ref_22071"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a><emu-mods><emu-params>[?Yield, ?Await, ?Return]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="CatchParameter" params="Yield, Await" id="prod-CatchParameter">
<emu-nt params="Yield, Await"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a><emu-mods><emu-params>[Yield, Await]</emu-params></emu-mods></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ir-rfjfi">
<emu-nt params="?Yield, ?Await" id="_ref_22072"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="nridwfya">
<emu-nt params="?Yield, ?Await" id="_ref_22073"><a href="ecmascript-language-statements-and-declarations.html#prod-BindingPattern">BindingPattern</a><emu-mods><emu-params>[?Yield, ?Await]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>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 <emu-nt id="_ref_22074"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> is bound to that exception.</p>
</div></emu-note>
<emu-clause id="sec-try-statement-static-semantics-early-errors">
<h1><span class="secnum">14.15.1</span> Static Semantics: Early Errors</h1>
<emu-grammar><emu-production name="Catch" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="3ce8nhiw">
<emu-t>catch</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_22075"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_22076"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<ul>
<li>
It is a Syntax Error if the <emu-xref aoid="BoundNames" id="_ref_7477"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_22077"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> contains any duplicate elements.
</li>
<li>
It is a Syntax Error if any element of the <emu-xref aoid="BoundNames" id="_ref_7478"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_22078"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> also occurs in the <emu-xref aoid="LexicallyDeclaredNames" id="_ref_7479"><a href="syntax-directed-operations.html#sec-static-semantics-lexicallydeclarednames">LexicallyDeclaredNames</a></emu-xref> of <emu-nt id="_ref_22079"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>.
</li>
<li>
It is a Syntax Error if any element of the <emu-xref aoid="BoundNames" id="_ref_7480"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_22080"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> also occurs in the <emu-xref aoid="VarDeclaredNames" id="_ref_7481"><a href="syntax-directed-operations.html#sec-static-semantics-vardeclarednames">VarDeclaredNames</a></emu-xref> of <emu-nt id="_ref_22081"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt><span normative-optional="">, unless <emu-nt id="_ref_22082"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> is <emu-grammar><emu-production name="CatchParameter" collapsed="" class=" inline">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="uolyom43"><emu-nt id="_ref_22083"><a href="ecmascript-language-expressions.html#prod-BindingIdentifier">BindingIdentifier</a></emu-nt></emu-rhs>
</emu-production>
</emu-grammar> and the <emu-xref href="#host" id="_ref_7482"><a href="overview.html#host">host</a></emu-xref> is a web browser or otherwise supports <emu-xref href="#sec-variablestatements-in-catch-blocks" title="" id="_ref_460"><a href="additional-ecmascript-features-for-web-browsers.html#sec-variablestatements-in-catch-blocks">VariableStatements in Catch Blocks</a></emu-xref></span>.
</li>
</ul>
</emu-clause>
<emu-clause id="sec-runtime-semantics-catchclauseevaluation" type="sdo" aoid="CatchClauseEvaluation">
<h1><span class="secnum">14.15.2</span> Runtime Semantics: CatchClauseEvaluation</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_7483"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> CatchClauseEvaluation takes argument <var>thrownValue</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7484"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7485"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> either an <emu-xref href="#sec-ecmascript-language-types" id="_ref_7486"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref> or <emu-const>empty</emu-const>, or an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7487"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>. It is defined piecewise over the following productions:</p>
<emu-grammar><emu-production name="Catch" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="3ce8nhiw" id="prod-tivA4mFO">
<emu-t>catch</emu-t>
<emu-t>(</emu-t>
<emu-nt id="_ref_22084"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt>
<emu-t>)</emu-t>
<emu-nt id="_ref_22085"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>oldEnv</var> be the <emu-xref href="#running-execution-context" id="_ref_7488"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment.</li><li>Let <var>catchEnv</var> be <emu-xref aoid="NewDeclarativeEnvironment" id="_ref_7489"><a href="executable-code-and-execution-contexts.html#sec-newdeclarativeenvironment">NewDeclarativeEnvironment</a></emu-xref>(<var>oldEnv</var>).</li><li>For each element <var>argName</var> of the <emu-xref aoid="BoundNames" id="_ref_7490"><a href="syntax-directed-operations.html#sec-static-semantics-boundnames">BoundNames</a></emu-xref> of <emu-nt id="_ref_22086"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt>, do<ol><li>Perform !&nbsp;<var>catchEnv</var>.<emu-xref aoid="CreateMutableBinding" id="_ref_7491"><a href="executable-code-and-execution-contexts.html#abstract-createmutablebinding">CreateMutableBinding</a></emu-xref>(<var>argName</var>, <emu-val>false</emu-val>).</li></ol></li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7492"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>catchEnv</var>.</li><li>Let <var>status</var> be <emu-xref aoid="Completion" id="_ref_7493"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="BindingInitialization" id="_ref_7494"><a href="syntax-directed-operations.html#sec-runtime-semantics-bindinginitialization" class="e-user-code">BindingInitialization</a></emu-xref> of <emu-nt id="_ref_22087"><a href="ecmascript-language-statements-and-declarations.html#prod-CatchParameter">CatchParameter</a></emu-nt> with arguments <var>thrownValue</var> and <var>catchEnv</var>).</li><li>If <var>status</var> is an <emu-xref href="#sec-completion-record-specification-type" id="_ref_7495"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, then<ol><li>Set the <emu-xref href="#running-execution-context" id="_ref_7496"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return ?&nbsp;<var>status</var>.</li></ol></li><li>Let <var>B</var> be <emu-xref aoid="Completion" id="_ref_7497"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7498"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22088"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>).</li><li>Set the <emu-xref href="#running-execution-context" id="_ref_7499"><a href="executable-code-and-execution-contexts.html#running-execution-context">running execution context</a></emu-xref>'s LexicalEnvironment to <var>oldEnv</var>.</li><li>Return ?&nbsp;<var>B</var>.</li></ol></emu-alg>
<emu-grammar><emu-production name="Catch" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="oyp2rsut" id="prod-7Gz_IT_v">
<emu-t>catch</emu-t>
<emu-nt id="_ref_22089"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="Evaluation" id="_ref_7500"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22090"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>No matter how control leaves the <emu-nt id="_ref_22091"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt> the LexicalEnvironment is always restored to its former state.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-try-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.15.3</span> Runtime Semantics: Evaluation</h1>
<emu-grammar><emu-production name="TryStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-TryStatement">TryStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="qhfov2lc" id="prod-TjGqXGk4">
<emu-t>try</emu-t>
<emu-nt id="_ref_22092"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>
<emu-nt id="_ref_22093"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>B</var> be <emu-xref aoid="Completion" id="_ref_7501"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7502"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22094"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>).</li><li>If <var>B</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7503"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>, let <var>C</var> be <emu-xref aoid="Completion" id="_ref_7504"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="CatchClauseEvaluation" id="_ref_7505"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-catchclauseevaluation" class="e-user-code">CatchClauseEvaluation</a></emu-xref> of <emu-nt id="_ref_22095"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> with argument <var>B</var>.<var class="field">[[Value]]</var>).</li><li>Else, let <var>C</var> be <var>B</var>.</li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7506"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>C</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
<emu-grammar><emu-production name="TryStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-TryStatement">TryStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="xsakufa6" id="prod-BNnGZMkj">
<emu-t>try</emu-t>
<emu-nt id="_ref_22096"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>
<emu-nt id="_ref_22097"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>B</var> be <emu-xref aoid="Completion" id="_ref_7507"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7508"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22098"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>).</li><li>Let <var>F</var> be <emu-xref aoid="Completion" id="_ref_7509"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7510"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22099"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a></emu-nt>).</li><li>If <var>F</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7511"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref>, set <var>F</var> to <var>B</var>.</li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7512"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>F</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
<emu-grammar><emu-production name="TryStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-TryStatement">TryStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="gxlzfd5s" id="prod-fUrDxi55">
<emu-t>try</emu-t>
<emu-nt id="_ref_22100"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>
<emu-nt id="_ref_22101"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt>
<emu-nt id="_ref_22102"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a></emu-nt>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>Let <var>B</var> be <emu-xref aoid="Completion" id="_ref_7513"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7514"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22103"><a href="ecmascript-language-statements-and-declarations.html#prod-Block">Block</a></emu-nt>).</li><li>If <var>B</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7515"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>, let <var>C</var> be <emu-xref aoid="Completion" id="_ref_7516"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="CatchClauseEvaluation" id="_ref_7517"><a href="ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-catchclauseevaluation" class="e-user-code">CatchClauseEvaluation</a></emu-xref> of <emu-nt id="_ref_22104"><a href="ecmascript-language-statements-and-declarations.html#prod-Catch">Catch</a></emu-nt> with argument <var>B</var>.<var class="field">[[Value]]</var>).</li><li>Else, let <var>C</var> be <var>B</var>.</li><li>Let <var>F</var> be <emu-xref aoid="Completion" id="_ref_7518"><a href="notational-conventions.html#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Evaluation" id="_ref_7519"><a href="syntax-directed-operations.html#sec-evaluation" class="e-user-code">Evaluation</a></emu-xref> of <emu-nt id="_ref_22105"><a href="ecmascript-language-statements-and-declarations.html#prod-Finally">Finally</a></emu-nt>).</li><li>If <var>F</var> is a <emu-xref href="#sec-completion-record-specification-type" id="_ref_7520"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion</a></emu-xref>, set <var>F</var> to <var>C</var>.</li><li>Return ?&nbsp;<emu-xref aoid="UpdateEmpty" id="_ref_7521"><a href="ecmascript-data-types-and-values.html#sec-updateempty">UpdateEmpty</a></emu-xref>(<var>F</var>, <emu-val>undefined</emu-val>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-debugger-statement">
<h1><span class="secnum">14.16</span> The <code>debugger</code> Statement</h1>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="DebuggerStatement" id="prod-DebuggerStatement">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-DebuggerStatement">DebuggerStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ns5hclvt" id="prod-Kx8jxmHA">
<emu-t>debugger</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-debugger-statement-runtime-semantics-evaluation" type="sdo">
<h1><span class="secnum">14.16.1</span> Runtime Semantics: Evaluation</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Evaluating a <emu-nt id="_ref_22106"><a href="ecmascript-language-statements-and-declarations.html#prod-DebuggerStatement">DebuggerStatement</a></emu-nt> 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></emu-note>
<emu-grammar><emu-production name="DebuggerStatement" collapsed="">
<emu-nt><a href="ecmascript-language-statements-and-declarations.html#prod-DebuggerStatement">DebuggerStatement</a></emu-nt> <emu-geq>:</emu-geq> <emu-rhs a="ns5hclvt" id="prod-eDCsgVlr">
<emu-t>debugger</emu-t>
<emu-t>;</emu-t>
</emu-rhs>
</emu-production>
</emu-grammar>
<emu-alg><ol><li>If an <emu-xref href="#implementation-defined" id="_ref_7522"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> debugging facility is available and enabled, then<ol><li>Perform an <emu-xref href="#implementation-defined" id="_ref_7523"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> debugging action.</li><li>Return a new <emu-xref href="#implementation-defined" id="_ref_7524"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> <emu-xref href="#sec-completion-record-specification-type" id="_ref_7525"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref>.</li></ol></li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause></div></body></html>