1var obj1 = {
2 foo: {
3 prop1: 42,
4 },
5};
6
7var obj2 = {
8 foo: {
9 prop2: 21,
10 },
11 bar: {
12 prop3: 10,
13 },
14};
15
16var result = {
17 foo: { // `foo` got overwritten with the value of `obj2`
18 prop2: 21,
19 },
20 bar: {
21 prop3: 10,
22 },
23}