Kevin Powell - CommunityKP-C
Kevin Powell - Communityโ€ข13mo agoโ€ข
8 replies
snxxwyy

use cases for arrow functions inheriting their this value

Hey, mdn says that the this value of arrow functions equates to the parent scope, i don't understand how that could be useful? For example, if i defined an arrow function in an object below that utilized the this keyword, how would i benefit from it being equal to the window object? (i'm aware if i want that behaviour then to use a regular function of course but the concept confuses me)
const myObject = {
  arrowExample: () => {
    console.log(this) // Window
  }
}

myObject.arrowExample()


i'd appreciate any help. thanks in advance.
Was this page helpful?