this keyword
β Special variable which πto "owner" of calling function
aka this
implicit parameter of functions
this
is dynamic and depends on how function is called and value is only assigned when function is called
this Methodβ
π <Object called method\>
this Function Callβ
π <undefined\>
(in Strict Mode; Sloppy Mode π window
)
this Arrow
β
lexical this keyword π <surrounding function\>
this Event Listenerβ
π <DOM Element e handler attached to\>
this <script> tagβ
π globalThis
this ECMAScript moduleβ
π undefined
this CommonJS moduleβ
π module.exports
!exception arrow functions do not get Args Object or this
keyword
arrow functions borrow Args Object & this
keyword from their closest regular function parent
Referencesβ
new
β JS Operatorto call Constructor Function, assignthis
keyword & link to PrototypeFactory Function
β function to return Object (w/othis
keyword &new
)**Creation Phase**
β Global EC created withwindow
&this
keyword pointing to itArrow Function
β compact Anon Function w/o bind tothis
keyword or Args Object.call()
βFunction
Instance Method to invoke function with explicitthis
keyword [and optional Argument].bind()
βFunction
Instance Method to fixthis
keyword for Method (with optional Argument), for new standalone fn--noImplicitThis
β to flag TSC to throw error when Type ofthis
keyword unclear