Created
December 27, 2020 23:04
-
-
Save reime005/37767939e7b8179162797d546253f0c5 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
const someObject = { | |
magicValue: 42, | |
}; | |
const hugeObject = { | |
...someObject, | |
someValue: 37, | |
deepObject: { | |
foo: [42, 43], | |
} | |
} | |
const overridenObject = { | |
...hugeObject, | |
someValue: 24, | |
deepObject: { | |
someArray: [91, 21], // foo[] will be overridden | |
} | |
} | |
const notOverridenObject = { | |
...hugeObject, | |
anotherValue: 37, | |
deepObject: { | |
...hugeObject.deepObject, // extend nested object | |
someArray: [42, 43], | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment