Declared function (Definition)

A function can be declared in the script source text.


ECMAScript edition - 2

Declared functions are added to the script source text to provide additional functions that are only needed while that script is being executed.

Declaring a function in a script requires a function declaration, which includes the name of the function, its arguments and a block of source script code to be executed when the function is called.

Through the Prototype Inheritance mechanism, this script code will be called in preference to any identically named function higher up the inheritance chain. This provides a way to override methods in parent object classes, which mimics (but is not identical to) the sub-class/super-class relationships in class-based languages.

See also:Function object, function( ... ) ...


ECMA 262 edition 2 - section - 10.1.1

ECMA 262 edition 3 - section - 10.1.1