Created
July 27, 2018 23:10
-
-
Save kristyburge/9b8057a1b647df6f4721a7ca0be22066 to your computer and use it in GitHub Desktop.
When 'this' points to the Window object
This file contains hidden or 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
console.log(this); | |
// returns the Window object | |
// Window { postMessage: ƒ, | |
// blur: ƒ, | |
// focus: ƒ, | |
// close: ƒ, | |
// frames: Window, …} | |
function myFunction() { | |
console.log(this); | |
} | |
// Call the function | |
myFunction(); | |
// returns the Window object! | |
// Window { postMessage: ƒ, | |
// blur: ƒ, | |
// focus: ƒ, | |
// close: ƒ, | |
// frames: Window, …} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment