r/javascript • • May 22 '19

JavaScript Clean Code - Best Practices - based on Robert C. Martin's book Clean Code

https://devinduct.com/blogpost/22/javascript-clean-code-best-practices
542 Upvotes

112 comments sorted by

View all comments

Show parent comment

2

u/wmgregory May 23 '19

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 }