Question d’entretien chez Virtusa

Difference between call and apply in JavaScript?

Réponses aux questions d'entretien

Utilisateur anonyme

21 févr. 2019

call() and apply() serve the exact same purpose. The only difference between how they work is that call() expects all parameters to be passed in individually, whereas apply() expects an array of all of our parameters.

Utilisateur anonyme

21 févr. 2019

The main differences between bind() and call() are that the call() method: Accepts additional parameters as well Executes the function it was called upon right away. The call() method does not make a copy of the function it is being called on. call() and apply() serve the exact same purpose. The only difference between how they work is that call() expects all parameters to be passed in individually, whereas apply() expects an array of all of our parameters.