javascript union objects on one field code example
Example 1: javascript merge objects
var person={"name":"Billy","age":34};
var clothing={"shoes":"nike","shirt":"long sleeve"};
var personWithClothes= Object.assign(person, clothing);//merge the two object
Example 2: react merge two objects
const object1 = {
name: 'Flavio'
}
const object2 = {
age: 35
}
const object3 = {...object1, ...object2 }