Function

Moduleejs
Definitionfinal class Function
InheritanceFunction inherit Object
StabilityEvolving.

The Function type is used to represent closures, function expressions and class methods.

It contains a reference to the code to execute, the execution scope and possibly a bound "this" reference.


Properties

QualifiersPropertyTypeDescription
No properties defined

Function Methods

QualifiersMethod
public apply(thisObject: Object, args: Array): Object
 Invoke the function on another object.
public call(thisObject: Object, args: Array): Object
 Invoke the function on another object.

Method Detail

public apply(thisObject: Object, args: Array): Object

Invoke the function on another object.

Parameters
thisObject: Object The object to set as the "this" object when the function is called.
args: Array Array of actual parameters to the function.
Returns
Any object returned as a result of applying the function.
Throws
ReferenceError: If the function cannot be applied to this object.

public call(thisObject: Object, args: Array): Object

Invoke the function on another object.

Description
This function takes the "this" parameter and then a variable number of actual parameters to pass to the function.
Parameters
thisObject: Object The object to set as the "this" object when the function is called.
args: Array Actual parameters to the function.
Returns
Any object returned as a result of applying the function.
Throws
ReferenceError: If the function cannot be applied to this object.