JavaScript: Function Call, Apply, Bind

By Xah Lee. Date: . Last updated: .

In JavaScript, any function, when called, has a associated value called “this binding”.

In function definition, the value of “this binding” is represented by the keyword this.

〔►see JavaScript: Keyword “this”

When a function f is called in the form x.f(…), the value of “this binding” is the object x.

You can use methods {call, apply, bind} to pass any object to be “this binding”.

The methods {call, apply, bind} are properties of the object Function.prototype. ALL JavaScript functions are decedents of Function.prototype. 〔►see JavaScript: Prototype and Inheritance

Function.prototype.call

〔►see JavaScript: Function.prototype.call

Function.prototype.apply

The function “apply” is the similar to “call”, but the second argument is a array. The elements of the array is passed to the function as separate arguments.

〔►see JavaScript: Function.prototype.apply

Function.prototype.bind

〔►see JavaScript: Function.prototype.bind

Function Topic

  1. JavaScript: Define Function
  2. JavaScript: Function Parameters
  3. JavaScript: Variable/Function Declaration Order, Name Hoisting
  4. JavaScript Variable Scope: Function Level vs Block Level
  5. JavaScript: Function Declaration vs Function Expression
  6. JavaScript: Closure
  7. JavaScript: Functional Programing
  8. JavaScript: Function Call, Apply, Bind
  9. JavaScript: Function Argument Default Value
  10. JavaScript: Function Rest Parameters
  11. JavaScript: Arrow Function

  1. JavaScript: Function Object
  2. JavaScript: Function.prototype
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.