Call is a function that helps you change the context of the invoking function. In layperson’s terms, it helps you replace the value of this inside a function with whatever value you want.

Apply is very similar to the call function. The only difference is that in apply you can pass an array as an argument list.

Bind is a function that helps you create another function that you can execute later with the new context of this that is provided.

call()

  • It calls a function and explicitely speicifies the “this” value inside that function.
  • First argument is the “this” value and rest are the individual arguments expected by the function.

Apply()

  • It works similar to the call() method but instead of passing the expected arguments individually, it passes them in an array.

bind()

  • It creates a new copy of the given function and specifies its “this” value with the provided value. This new function then can be called with its expected arguments

By Shabazz

Software Engineer, MCSD, Web developer & Angular specialist

Leave a Reply

Your email address will not be published. Required fields are marked *