Created
May 27, 2020 14:48
-
-
Save fhsinchy/85073405379940ff71b7153059a52212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let globalThis = this; | |
let obj1 = { | |
innerMethod: function() { | |
console.log('Global This: ', globalThis); | |
console.log('Local This: ', this); | |
console.log('Are they same?', globalThis === this); | |
console.log('Is this the object?', obj1 === this); | |
} | |
}; | |
obj1.innerMethod(); | |
// Global This: Window | |
// Local This: Object { innerMethod: innerMethod() } | |
// Are they same? false | |
// Is this the object? true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment