It will iterate through each element of the provided values array and add the value of each element's property to produce the desired sum.
values
property
sum
1.0.0
sumByProperty([{ a: 1 }, { a: 2 }, { a: 3 }], "a"); // => 6 Copy
sumByProperty([{ a: 1 }, { a: 2 }, { a: 3 }], "a"); // => 6
It will iterate through each element of the provided
valuesarray and add the value of each element'spropertyto produce the desiredsum.