Last active
May 25, 2019 13:36
-
-
Save splincode/f1425233b115e0aeb6519664cdf1c72c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
You have to understand that each object | |
has a unique identity in JavaScript | |
console.log(new Object() === new Object()); | |
*/ | |
console.log({} === {}); // false | |
/* | |
But when you assign `fiz` to `baz`, `baz` points to the same object as `fiz`. | |
Since `fiz` and `baz` are the same thing, when you change `baz`, `fiz` reflects the same change. | |
*/ | |
const fiz = { foo: 'bar' }; | |
const baz = fiz; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment