JavaScript: bind() vs apply() and call()
The this refers to object can be different based on whether it is global, an object, and also on the usage of the three Function prototype methods — namely bind, call, and apply.
Call
The call() method calls the function with a given this value and allows passing in arguments one by one separating them with commas:
Apply
The apply() method calls the function with a given this value and allows passing in arguments as an array (or an array-like object).
The call() and apply() methods are interchangeable. Choosing between these two is up to the situation. If it is easier to send in an array, you can use apply() or call() for a comma separated list of arguments.
Bind
The bind() method returns a new function and allows passing in a this array and any number of arguments.
Among these three methods above, bind() works a little bit differently. Unlike call() and apply() that execute the current function immediately, bind() returns a new function. You can use bind() for events like onClick where you don’t know when they will be fired but you know the desired context.