Skip to content

Instantly share code, notes, and snippets.

@nfriedly
Created September 3, 2019 09:59
Show Gist options
  • Save nfriedly/a5805ac9af5940d0f0a7032837946683 to your computer and use it in GitHub Desktop.
Save nfriedly/a5805ac9af5940d0f0a7032837946683 to your computer and use it in GitHub Desktop.
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