DEV Community

Discussion on: Simple concepts of Modern JavaScript

Collapse
 
allenporter1986 profile image
Allen Porter

You'll need to be careful with the order you use the spread operator. If the first object contained c it would not have been replaced. Change the order and you'll get your expected result. Also the spread operator is a shallow copy.