O'Reilly logo

Simplifying JavaScript by Joe Morgan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tip 12 Update Information with Object Spread

In this tip, you’ll learn how the object spread operator gives you all the advantages of Object.assign() with reduced syntax.

You saw in the previous tip how you can use Object.assign() to make copies of objects and how you can overwrite object values with new values from another object. It’s a great tool that has a lot of value. But, wow—it’s ugly.

The spread operator was such a popular addition in ES6 that similar syntax is being introduced for objects. The object spread operator is not officially part of the spec, but it’s so widely used that it will likely be adopted in the future. You can check out the proposal on github.[12]

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required