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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s