This

“this” Keyword in Javascript

  • In a methods, this refers to the owner object.
  • Alone, this refers to the global object.
  • In a function, this refers to the global object.
  • In a function, in strict mode, this is undefined.
  • In an event, this refers to the element that received the event.
  • Methods like call(), and apply() can refer this to any object.

Children
  1. 8 Different Places “this” Can Point to in JavaScript
  2. JavaScript Interview Question: Explain the ‘this’ Keyword