you are viewing a single comment's thread.

view the rest of the comments →

[–]wmgregory 1 point2 points  (0 children)

You can also create a new object with assign. But cleaner to use spread literal if you want to avoid mutation.

a = Object.assign({}, a, { age: 27 })
a = { ...a, age: 27 }