Yes, there is an important difference in some cases. For example, dealing with callbacks. Let's assume you have a class with constructor that accepts callback
parameter and stores it under this.callback
. Later, when this callback is invoked via this.callback()
, suddenly the foreign code gets the reference to your object via this
. It is not always desirable, and it is better/safer to use this.callback.call()
in such case.
That way, the foreign code will get undefined
as this
and won't try to modify your object by accident. And properly written callback won't be affected by this usage of call()
anyways, since they would supply the callback defined as an arrow function or as bound function (via .bind()
). In both such cases, the callback will have its own, proper this, unaffected by call()
, since arrow and bound functions just ignore the value, set by apply()/call()
.