Explicit Binding: call, apply and bind
call invokes an ordinary function with a receiver and positional arguments. apply uses an argument list. bind creates another function with a fixed receiver and optional leading arguments.
Calling now and preparing a callable for later are separate operations.
See the mechanism
article"Read: "Follow one example
call and apply run label immediately and return its result. bind does not run it; later is a function you can invoke afterwards. Bound ordinary-function receivers cannot be changed by another call receiver. These methods do not install a dynamic this binding into an arrow.
Predict, change and check
Predict: What is typeof later before you invoke it?
Test your explanation: Print typeof later, then call it twice. Replace article with a second record when creating a separate bound function and compare results.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
Separate calling now from preparing a later call
call invokes a function now with an explicit receiver and positional arguments. apply invokes it now with an array-like argument list. bind returns a new function for a later call and can preset arguments as well as an ordinary function's receiver.
Borrowing a method does not copy its entire original object into the new receiver. The borrowed method must be compatible with the receiver's shape; some built-in methods require internal slots and are not generic. A constructor call through a bound ordinary function has additional this behavior, and lexical arrows still do not acquire a replaceable receiver.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.