Learn JavaScript
call, apply and bind


‚Äč bind() creates a new function and executes it when we run the function. The value of this in the newly created function depends on the first argument passed to bind().

In the example given above, when the bind() method has firstPerson as the argument, the value of this.name is Sam. The value of this.name is Oliver when the argument changes to secondPerson.