Functions
The topics are:
Script Functions
In Script, functions are regular values (also known as "first class" values) which can be manipulated like any other type of value: They can be passed to functions, returned by functions, stored into variables or into objects properties, etc.
For example, the function
parseInt is actually a function value which is stored in the
parseInt variable:
parseInt −> a function value
This function value can be, for example, assigned to another variable:
myFunction = parseInt
and then called through this variable:
myFunction("-25") −> -25
Function Methods
The only method of functions is:
Script Function Method
Syntax | Effect |
---|
function.toString( ) | Returns a string which contains some information about the function. Examples: "foo".substring.toString() −> "[primitive method substring]" eval.toString() −> "[primitive function eval]" |
Published date: 05/24/2022
Last modified date: 02/24/2022