Function
Module | ejs |
Definition | class Function |
Inheritance | Function Object |
Stability | Evolving. |
The Function type is used to represent functions, function expressions, closures and class methods.
It contains a
reference to the code to execute, the execution scope and possibly a bound "this" reference.
Properties
Qualifiers | Property | Type | Description |
get | bound | Object | The bound object representing the "this" object for the function. Will be set to null if no object is bound.
Use bind() to set the bound "this" object. |
get | length | Number | null |
get | name | String | The name of the function. Function expressions do not have a name and set the name property to the empty string. |
Inherited Properties
Function Class Methods
Qualifiers | Method |
(No own class methods defined)
Inherited Methods
Function Instance Methods
Inherited Methods
Method Detail
- Description
- Create a function from the supplied formal parameter names and function body expression.
- Parameters
args: Array | The parameters and body are suplied as discrete parameters to Function(), i.e. not as an array of args. Function ([args, ...], body). |
- Description
- 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. H
- Description
- Bind the value of "this" for the function. This can set the value of "this" for the function.
Use bound to examine the bound "this" value.
- Parameters
thisObj: Object | Value of "this" to define. |
args: Array | Function arguments to supply to the function. These arguments preceed any caller supplied arguments when the function is actually invoked. |
- Returns
- The function for chaining.
- Description
- Invoke the function on another object. 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.