1const object1 = {
2 name: 'Flavio'
3}
4
5const object2 = {
6 age: 35
7}
8const object3 = {...object1, ...object2 } //{name: "Flavio", age: 35}
9
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 }
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 }
5
6
7let objs = [{firstName: "Steven"}, {lastName: "Hancock"}, {score: 85}];
8
9let obj = objs.reduce(function(acc, val) {
10 return Object.assign(acc, val);
11},{});