- Why do we use a call() Function?
So, with call(), an object can use another object method.
Let’s understand through an example.
So, you can see, this example calls the method fullName method of myName , on rameshName. Originally, rameshName has no any method fullName. But using call() function, we can access the method of another object.
Note: Even call() accepts arguments. In the above example, “demo” and “other” are the arguments.