Skip to content

Instantly share code, notes, and snippets.

@kristyburge
Created July 27, 2018 23:10
Show Gist options
  • Save kristyburge/9b8057a1b647df6f4721a7ca0be22066 to your computer and use it in GitHub Desktop.
Save kristyburge/9b8057a1b647df6f4721a7ca0be22066 to your computer and use it in GitHub Desktop.
When 'this' points to the Window object
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