Javatpoint Logo
Javatpoint Logo

JavaScript Function call() method

The JavaScript Function call() method is used to call a function contains this value and an argument provided individually. Unlike apply() method, it accepts the argument list.

Syntax

Parameter

thisArg - It is optional. The this value is given for the call to function.

arg1,arg2,...,argn - It is optional. It represents the arguments for the function.

Return Value

It returns the result of the calling function along provided this value and arguments.

JavaScript Function call() method Example

Example 1

Let's see a simple example of call() method.

Test it Now

Output:

John Martin

Example 2

Let's see an example of call() method.

Test it Now

Output:

101 John Martin
201 Duke William





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA