?
u
m
/
p
1-9
No matter how control leaves the
The value of a eval
function all return the value 1:
eval("1;;;;;")
eval("1;{}")
eval("1;var a;")
The abstract operation BlockDeclarationInstantiation takes arguments code (a
When a
It performs the following steps when called:
let
and const
declarations define variables that are scoped to the let
declaration does not have an
A const
declaration.
A var
statement declares variables that are scoped to the
If a
The
The
The
When
It is defined piecewise over the following productions:
An function
or class
async function
because that would make it ambiguous with an let [
because that would make it ambiguous with a let
if
Statementelse
] resolves the classic "dangling else" problem in the usual way. That is, when the choice of associated if
is otherwise ambiguous, the else
is associated with the nearest (innermost) of the candidate if
sIt is only necessary to apply this rule if the extension specified in
The abstract operation LoopContinues takes arguments completion (a
Within the
The
do
-while
StatementIt is only necessary to apply this rule if the extension specified in
The
while
StatementIt is only necessary to apply this rule if the extension specified in
The
for
StatementIt is only necessary to apply this rule if the extension specified in
The
The abstract operation ForBodyEvaluation takes arguments test (an
The abstract operation CreatePerIterationEnvironment takes argument perIterationBindings (a
for
-in
, for
-of
, and for
-await
-of
StatementsThis section is extended by Annex
It is only necessary to apply this rule if the extension specified in
If
If
The
This section is extended by Annex
The
var
statements and the formal parameter lists of some
It is defined piecewise over the following productions:
The
The
This section is extended by Annex
The abstract operation ForIn/OfHeadEvaluation takes arguments uninitializedBoundNames (a
The abstract operation ForIn/OfBodyEvaluation takes arguments lhs (a
The abstract operation EnumerateObjectProperties takes argument O (an Object) and returns an Iterator. It performs the following steps when called:
next
method iterates over all the String-valued keys of enumerable properties of O. The iterator object 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.The iterator's throw
and return
methods are next
method processes object properties to determine whether the next
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 next
method at most once in any enumeration.
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 iterator's next
method. The values of [[Enumerable]] attributes are not considered when determining if a property of a prototype object has already been processed. The enumerable property names of prototype objects must be obtained by invoking EnumerateObjectProperties passing the prototype object as the argument. EnumerateObjectProperties must obtain the own
In addition, if neither O nor any object in its prototype chain is a
ECMAScript implementations are not required to implement the algorithm in
The following is an informative definition of an ECMAScript generator function that conforms to these rules:
function* EnumerateObjectProperties(obj) {
const visited = new Set();
for (const key of Reflect.ownKeys(obj)) {
if (typeof key === "symbol") continue;
const desc = Reflect.getOwnPropertyDescriptor(obj, key);
if (desc) {
visited.add(key);
if (desc.enumerable) yield key;
}
}
const proto = Reflect.getPrototypeOf(obj);
if (proto === null) return;
for (const protoKey of EnumerateObjectProperties(proto)) {
if (!visited.has(protoKey)) yield protoKey;
}
}
A For-In Iterator 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
The abstract operation CreateForInIterator takes argument object (an Object) and returns a For-In Iterator. It is used to create a For-In Iterator object which iterates over the own and inherited enumerable string properties of object in a specific order. It performs the following steps when called:
The %ForInIteratorPrototype% object:
For-In Iterator instances are
Internal Slot | Type | Description |
---|---|---|
[[Object]] | an Object | The Object value whose properties are being iterated. |
[[ObjectWasVisited]] | a Boolean |
|
[[VisitedKeys]] |
a |
The values that have been emitted by this iterator thus far. |
[[RemainingKeys]] |
a |
The values remaining to be emitted for the current object, before iterating the properties of its prototype (if its prototype is not |
continue
Statementstatic
initialization block boundaries), within an break
Statementstatic
initialization block boundaries), within an return
StatementA return
statement causes a function to cease execution and, in most cases, returns a value to the caller. If return
statement may not actually return a value to the caller depending on surrounding context. For example, in a try
block, a return
statement's finally
block.
with
StatementUse of the with
statement is discouraged in new ECMAScript code. Consider alternatives that are permitted in both
The with
statement adds an
It is only necessary to apply the second rule if the extension specified in
No matter how control leaves the embedded
switch
StatementThe
The abstract operation CaseClauseIsSelected takes arguments C (a
This operation does not execute C's
No matter how control leaves the
A break
and continue
statements. ECMAScript has no goto
statement. A
An alternative definition for this rule is provided in
The abstract operation IsLabelledFunction takes argument stmt (a
The
A
The only two productions of
throw
Statementtry
StatementThe try
statement encloses a block of code in which an exceptional condition can occur, such as a runtime error or a throw
statement. The catch
clause provides the exception-handling code. When a catch clause catches an exception, its
An alternative
The
No matter how control leaves the
debugger
StatementEvaluating a