Created
March 21, 2019 03:38
-
-
Save singhArmani/f29d03baa7da75d2aceb8a052a8b2d9f 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
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