I am facing a challenge with merging an array of objects in JavaScript. My goal is to combine them into a single object using either a JS library or lodash.
Here is how my array looks:
[{
2017: {
a: "100",
b: "200"
},
2018: {
a: "101",
b: "202"
},
...
},
{
2017: {
a: "300",
b: "400"
},
2018: {
a: "303",
b: "404"
},
...
},
...
]
What I aim for is the following result:
[{
2017: {
a: "400",
b: "600"
},
2018: {
a: "404",
b: "606"
},
...
}]
Is there a straightforward method to achieve this?