Skip to content

Instantly share code, notes, and snippets.

@abhinavdhasmana
Last active March 28, 2017 05:59
Show Gist options
  • Save abhinavdhasmana/209fb3ce9e93e8686b008f8310a05d78 to your computer and use it in GitHub Desktop.
Save abhinavdhasmana/209fb3ce9e93e8686b008f8310a05d78 to your computer and use it in GitHub Desktop.
'use strict';
function whoAmI() {
console.log('I am in local scope:', this);
}
console.log('I am in global scope:', this);
whoAmI();
// Output in Node
// I am in global scope: {}
// I am in local scope: undefined
// Output in Chrome console
// I am in global scope: <Window Object>
// I am in local scope: undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment