Skip to content

Instantly share code, notes, and snippets.

@domzgarcia
Created December 4, 2018 04:57
Show Gist options
  • Save domzgarcia/ce81eca094a4979d8db4f8d560b92c7f to your computer and use it in GitHub Desktop.
Save domzgarcia/ce81eca094a4979d8db4f8d560b92c7f to your computer and use it in GitHub Desktop.
modifying data using spread on array and objects
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