Eval code (Definition)

Script source executed by an eval() function call.


ECMAScript edition - 2

Eval code is the source text that is supplied to the built-in eval() function.

When the eval() function is called, it expects a string as an argument value. The contents of that string should be syntactically correct executable script source text.

On initialization, the scope chain is based on the caller's scope chain. The variable object and its 'this' property value are also inherited. If there is no calling context, then the global object is used instead. The scope chain is identical to the caller's. Variable instantiation is performed by using the variable object belonging to the caller, but with empty property attributes. The caller provides its own this value.

Eval code therefore executes very much as if it were part of the caller's execution context.

See also:eval(), Executable code, Execution context, JSObject.eval()


ECMA 262 edition 2 - section - 10.1.2

ECMA 262 edition 2 - section - 10.2.2

ECMA 262 edition 3 - section - 10.1.2

ECMA 262 edition 3 - section - 10.2.2