JSON – is a collection of values and properties stored as a map.
In ECMAScript 2018, the Object
Spread operator will do the trick for you in no time, let’s try it out.
The result of this would be to combine all the elements and override any newer ones where applicable.
An alternative to using the
Spread operator is to use
Object.assign as follows:
This results in exactly the same output.