Video- Why You need the apply() and the call() methods in JavaScript

To pass value of ‘this’ object in a function apply and the call methods are used.

 

The apply() and the call() methods are used to call a function indirectly. When you call a function using the apply() and the call() methods, that is called Indirect Invocation Pattern .

The first parameter is always the value for ‘this’ object.

In the apply() method parameters are passed as an array In the call() method parameters are passed as comma-separated


Discover more from Dhananjay Kumar

Subscribe to get the latest posts sent to your email.

Published by Dhananjay Kumar

Dhananjay Kumar is founder of NomadCoder and ng-India

Leave a comment

Discover more from Dhananjay Kumar

Subscribe now to keep reading and get access to the full archive.

Continue reading