Function : Object
Functions are reusable pieces of code that can be executed with different parameters.
Constructors
Creates a new normal Function that has the supplied parameter names and body. If any parameter name contains a ',', it will be split on the ',' and each component will be added as a parameter. Unless the body needs to be modified at run time, Functions are typically created with the function keyword.
See example below on how to construct generator (function*()) and async functions (async function()).
Example:
RunResults:
Instance Methods
Call this with the this value inside the function bound to thisArg and the parameters to the function from parameters. Returns the result of the function call. See Reflect.apply().
Example:
RunResults:
Returns a new function that, when called, will have this equal to thisArg, the first parameter equal to param1, the second parameter equal to param2, etc.
Example:
RunResults:
Copyright © JavaScripture Contributors