Skip to content

Instantly share code, notes, and snippets.

@singhArmani
Created March 21, 2019 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singhArmani/f29d03baa7da75d2aceb8a052a8b2d9f to your computer and use it in GitHub Desktop.
Save singhArmani/f29d03baa7da75d2aceb8a052a8b2d9f to your computer and use it in GitHub Desktop.
var x = 10; // global scope
var foo = {
x: 90,
getX: function() {
return this.x;
}
};
foo.getX(); // prints 90
let xGetter = foo.getX;
xGetter(); // prints 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment