DEV Community

Use spread operator in Javascript to merge two objects

If you need merge two objects in javascript, you only need to use spread operator. It's very simple to use.
Merge two objects in javascript

Pay attention if both objects have the sam property name. The second will override the first property.

Merge two objects in javascript. Same property name

Discussion (0)