Created
December 4, 2018 04:57
-
-
Save domzgarcia/ce81eca094a4979d8db4f8d560b92c7f to your computer and use it in GitHub Desktop.
modifying data using spread on array and objects
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
let arr = ['only_one'] | |
// console.log([...arr, 'two']) | |
let obj = { sub: {obj1:'one', obj2: 'two'} } | |
console.log( {...obj, sub:{...obj.sub, obj1: 'modify this using spread'}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment