Anonymous code (Definition)

Script source executed by function objects.


ECMAScript edition - 2

Anonymous code is script source text that is supplied to the constructor when an anonymous function is being instantiated.

As the constructor creates the function, one of the arguments to the constructor call will contain the script source text to be stored as the code block associated with that function. Only the code in the last argument on the constructor call is used in this way. All but the last argument are concatenated together and are separated by commas and are then passed as the formal parameter list to the anonymous function.

Anonymous code initializes the scope chain to include its activation object followed by the global object.

Variable instantiation is performed using the activation object as the variable object and any initial variables are flagged with a DontDelete attribute.

The caller provides this value, but in some situations the value null may be passed. In that case, the global object will be used in its place.

If you need more information, the ECMA standard is the authoritative source on what anonymous code is and how a compliant interpreter implementation should manage it.

See also:Executable code, Execution context


ECMA 262 edition 2 - section - 10.1.2

ECMA 262 edition 2 - section - 10.1.6

ECMA 262 edition 2 - section - 10.2.3

ECMA 262 edition 3 - section - 10.1.2

ECMA 262 edition 3 - section - 10.1.6

ECMA 262 edition 3 - section - 10.2.3