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, assignthiskeyword & link to PrototypeFactory Functionβ function to return Object (w/othiskeyword &new)**Creation Phase**β Global EC created withwindow&thiskeyword pointing to itArrow Functionβ compact Anon Function w/o bind tothiskeyword or Args Object.call()βFunctionInstance Method to invoke function with explicitthiskeyword [and optional Argument].bind()βFunctionInstance Method to fixthiskeyword for Method (with optional Argument), for new standalone fn--noImplicitThisβ to flag TSC to throw error when Type ofthiskeyword unclear