Skip to content

this Keyword

Preeti Wadhwani edited this page Jun 11, 2021 · 1 revision

this inside functions

this in js is an object which refers to current execution scope

the execution context is based on the left hand side of the function which means how we calling the method.

  • if using object, this will refer to that object
  • if without anything, this will refer to global window object

this in arrow functions

  • they don't get their own this access
  • this will be identical to the parent function this
Clone this wiki locally