Understanding javascript borrowing methods

the first argument of bind should be an object (as context)

Yes.

and not a function (Array.prototype.slice).

Why not? For one, all functions are objects, so nothing wrong here.

From another perspective, if you use slice.call(…) or slice.apply(…) then the slice object is the context (receiver) of the call/apply method invocations.

What is the difference between binding apply and call?

There is no difference between applyBoundToSlice(arguments) and callBoundToSlice(arguments). The difference is applyBoundToSlice(arguments, [0, n]) vs callBoundToSlice(arguments, 0, n) if you want pass start and end arguments to the slice.

Tags:

Javascript