The difference is how you make the call. If you've used bind
to get back a function with a bound this
value, you just call the function:
getx();
If you don't have a bound function, and you want to set this
, you do so with call
or apply
:
someFunction.call(objectToUseAsThis, arg1, arg2);
// or
someFunction.apply(objectToUseAsThis, [arg1, arg2]);
Note that if you have a bound function (like your getX
), using call
on it is pointless, because the this
you supply will just get overridden by the bound this
. (Using apply
might still be useful, if you have an array of values you want to ass as arguments.)