I have an array of objects with categories and corresponding points, and I need to calculate the total points for each category.
{
category: A,
points:2
},
{
category: A
points: 3
},
{
category: B,
points:2
},
{
category: B
points: 3
}
]
What is the most efficient way to sum up the points for category A and category B separately?