Created
September 3, 2019 09:59
-
-
Save nfriedly/a5805ac9af5940d0f0a7032837946683 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
a = { note: "I'm global" }; | |
function foo(b) { | |
// b is scoped to this function, but currently points to the same object as a | |
b === a; // => true | |
b = { note: "I'm not global" }; | |
// now b points to a new object | |
b !== a; // => true | |
} | |
foo(a); | |
// a is global, b isn't. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment