TIL a neat way to clone and object and override the items
POSTED ON:
TAGS: javascript objects
const wizard = {
health: 20
spells: 'fireball',
armor: 'robes'
}
const betterWizard = {
...wizard,
spells: 'better fireball'
}
console.log(betterWizard);
// { health: 20, spells: 'better fireball' }
Related TILs
Tagged: javascript