1const object1 = {
2 name: 'Flavio'
3}
4
5const object2 = {
6 age: 35
7}
8const object3 = {...object1, ...object2 } //{name: "Flavio", age: 35}
9
1var person={"name":"Billy","age":34};
2var clothing={"shoes":"nike","shirt":"long sleeve"};
3
4var personWithClothes= Object.assign(person, clothing);//merge the two object
5
1const a = { b: 1, c: 2 };
2const d = { e: 1, f: 2 };
3
4const ad = { ...a, ...d }; // { b: 1, c: 2, e: 1, f: 2 }
1let obj1 = { foo: 'bar', x: 42 };
2let obj2 = { foo: 'baz', y: 13 };
3
4let clonedObj = { ...obj1 };
5// Object { foo: "bar", x: 42 }
6
7let mergedObj = { ...obj1, ...obj2 };
8// Object { foo: "baz", x: 42, y: 13 }
9
10
1const obj1 = {'a': 1, 'b': 2};
2const obj2 = {'c': 3};
3const obj3 = {'d': 4};
4
5const objCombined = {...obj1, ...obj2, ...obj3};