- In a global function,
this
refers to the global object (window
in browsers). - Inside an object method,
this
refers to the object. - In a constructor function,
this
refers to the newly created object. - In an event handler,
this
refers to the element that received the event.
However, there are situations where you might want to control or change the value of this
, and that's where call
, apply
, and bind
come into play.