Hey there! I'm working with a JavaScript array that looks a little something like this.
{x: red, y: 2}
{x: blue, y: 3}
{x: blue, y; 4}
{x: green, y: 5}
I'm wondering how to combine the duplicate values so that my array ends up looking like the code snippet below.
Is it possible to achieve this using a loop? I have a large amount of data that needs to be formatted in the same way.
{x: red, y: 2}
{x: blue, y: 7} #the two blue y variables have been added
{x: green, y: 5}