Script (Definition)

A collection of source elements and optional function declarations.

Availability:

ECMAScript edition - 2

The ECMAScript standard describes a script as a collection of source elements and optional function declarations.

Any statements that are not part of a function body are considered to be part of the global code. The statements encountered as part of the global code are executed as they are parsed. Any statements that are inside a function body are simply stored and deferred for execution until the function is actually called.

See also:Function code, function( ... ) ..., Global code, Script execution, Script source text, Script termination

Cross-references:

ECMA 262 edition 2 - section - 14

ECMA 262 edition 3 - section - 14