Here's an example of an array:
const arr = [{
a: 12,
b: "A"
c: 17
},
{
a: 12,
b: "B"
c: 17
},
{
a: 12,
b: "C"
c: 17
}
];
What is the most efficient way to calculate the sum of all objects in the array? The expected result is [29,29,29]
I attempted to use
arr.map(a => Object.values(a).reduce((p,c) => p+c))
but this included non-numeric values in the result.