Home » JavaScript Function bind() Method

JavaScript Function bind() Method

by Online Tutorials Library

JavaScript Function bind() method

The JavaScript Function bind() method is used to create a new function. When a function is called, it has its own this keyword set to the provided value, with a given sequence of arguments.

Syntax

Parameter

thisArg – The this value passed to the target function.

arg1,arg2,….,argn – It represents the arguments for the function.

Return Value

It returns the replica of the given function along provided this value and initial arguments.

JavaScript Function bind() method Example

Example 1

Let’s see a simple example of bind() method.

Test it Now

Output:

Tutoraspire  

Example 2

Let’s see an example of bind() method.

Test it Now

Output:

Tutoraspire Oracle TutorAspire 

You may also like