JavaScript Function.prototype.bind() Example

JavaScript Function.prototype.bind()

Method description

The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.

Show full syntax.



The value to be passed as the this parameter to the target function when the bound function is called. The value is ignored if the bound function is constructed using the new operator.
arg1, arg2, …
Arguments to prepend to arguments provided to the bound function when invoking the target function.

Return value

A copy of the given function with the specified this value and initial arguments.

In depth description

You can find the full definition of Function.prototype.bind() on


You can find more advanced examples on

Browser compatibility

Chrome Firefox (Gecko) Internet Explorer Opera Safari
7 4.0 (2) 9 11.60 5.1


The feature is supported by most browsers. Though if your browser/version does not support this feature you can create a polyfill.

Show polyfill code.

See also
  • Function.prototype.apply()

%d bloggers like this: