Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.