i have an array that looks like this:
array = [{game: 1, team: aName, score: 10 },{game: 1, team: bName, score: 1}, {game: 2, team: aName, score: 20}, {game:2, team: bName, score: 30}]
i need a way to sum all the scores from the different teams so i get something like this:
sumArray = [{team:aName, score: 30},{team:bName, score:31}]
is there a way to achieve this with JS?
thanks!