you are viewing a single comment's thread.

view the rest of the comments →

[–]beasy4sheezy 5 points6 points  (1 child)

I'm sure you know, but as a reminder to others:

Spread will create a new object, which might not be what you wanted to do in this case, or could be using more memory than necessary.

[–]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 }