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;")
When a
The abstract operation BlockDeclarationInstantiation takes arguments code (a
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
With parameters value and environment.
With parameters value, environment, and excludedNames.
With parameters value, environment, and propertyName.
When
An function or class keywords because that would make it ambiguous with a 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 ifsIt is only necessary to apply this rule if the extension specified in
The abstract operation LoopContinues takes arguments completion and labelSet. It performs the following steps when called:
Within the
With parameter labelSet.
do-while StatementIt is only necessary to apply this rule if the extension specified in
With parameter labelSet.
while StatementIt is only necessary to apply this rule if the extension specified in
With parameter labelSet.
for StatementIt is only necessary to apply this rule if the extension specified in
With parameter labelSet.
The abstract operation ForBodyEvaluation takes arguments test, increment, stmt, perIterationBindings, and labelSet. It performs the following steps when called:
The abstract operation CreatePerIterationEnvironment takes argument perIterationBindings. It performs the following steps when called:
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
This section is extended by Annex
With parameters value and environment.
var statements and the formal parameter lists of some non-strict functions (see
With parameter environment.
With parameter labelSet.
This section is extended by Annex
The abstract operation ForIn/OfHeadEvaluation takes arguments uninitializedBoundNames, expr, and iterationKind (either
The abstract operation ForIn/OfBodyEvaluation takes arguments lhs, stmt, iteratorRecord, iterationKind, lhsKind (either
The abstract operation EnumerateObjectProperties takes argument O. 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 property key should be returned as an iterator value. Returned property keys 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 iterator's 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 property keys of the target object by calling its [[OwnPropertyKeys]] internal method. Property attributes of the target object must be obtained by calling its [[GetOwnProperty]] internal method.
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. 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 ordinary objects that inherit properties from the
| Internal Slot | Description |
|---|---|
| [[Object]] | The Object value whose properties are being iterated. |
| [[ObjectWasVisited]] |
|
| [[VisitedKeys]] | A list of String values which have been emitted by this iterator thus far. |
| [[RemainingKeys]] |
A list of String values remaining to be emitted for the current object, before iterating the properties of its prototype (if its prototype is not |
continue Statementbreak Statementreturn 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 completion record may be replaced with another completion record during evaluation of the finally block.
with StatementThe 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 StatementWith parameter input.
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. It performs the following steps when called:
With parameter labelSet.
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
With parameter thrownValue.
No matter how control leaves the
debugger StatementEvaluating a