Sums the values of a specified numeric property in an array of objects.
The type of objects in the array.
The array of objects.
The key whose numeric values will be summed.
The total sum of the values for the specified key.
const data = [{ a: 2 }, { a: 3 }, { a: 5 }];sumBy(data, 'a'); // Returns 10 Copy
const data = [{ a: 2 }, { a: 3 }, { a: 5 }];sumBy(data, 'a'); // Returns 10
Sums the values of a specified numeric property in an array of objects.