I have been stuck on this for a little while now, but I'm unsure on how I can flatten and reduce the below example data into unique key value pairs with the value being combined if there are multiples of the same key.
Example:
const data = [
{ test: 200 },
{ test2: 300, test3: 100 },
{ test3: 400, test4: 150, test2: 50 },
];
Expected result:
const result = [
{ test: 200 },
{ test2: 350 },
{ test3: 500 },
{ test4: 150 }
];
Any ideas?
TIA