How to Use Function "Constructors"

Functions can be created using a "function" statement or the Function() constructor. Dynamic functions are created when defining functions with the "new" operator and Function() constructor. Constructors not only create new objects but also specify the behaviors and properties of those objects.

Instance methods

Function.prototype.apply()

Calls a function with a given this value and optional arguments provided as an array (or an array-like object).

Function.prototype.bind()

Creates a new function that, when called, has its this keyword set to a provided value, optionally with a given sequence of arguments preceding any provided when the new function is called.

Function.prototype.call()

Calls a function with a given this value and optional arguments.

Function.prototype.toString()

Returns a string representing the source code of the function. Overrides the Object.prototype.toString method.

Function.prototype[@@hasInstance]()

Specifies the default procedure for determining if a constructor function recognizes an object as one of the constructor's instances. Called by the instanceof operator.