Hi I have a JavaScript array, which looks something like the following.
{x: red, y: 2}
{x: blue, y: 3}
{x: blue, y; 4}
{x: green, y: 5}
My question is, how to add up the dupilicates, so in the end my array looks like the code below.
Also could the process be done in a loop since I actually have a much larger amount of data to format this way.
{x: red, y: 2}
{x: blue, y: 7} #the two blue y variables have been added
{x: green, y: 5}