reduce similar objects in array in javascript code example
Example: javascript reduce array of objects
var objs = [
{name: "Peter", age: 35},
{name: "John", age: 27},
{name: "Jake", age: 28}
];
objs.reduce(function(accumulator, currentValue) {
return accumulator + currentValue.age;
}, 0); // 35 + 27 + 28 = 90