I have searched stackoverflow for answers but I do not really see anything which solves this. I want to take an objects in an array, match them by their name. Then calculate the total of the matching objects hours value.
If this is the array
var arr = [{name: 'Apple', hours: 6}, {name: 'Nokia', hours: 8},
{name: 'Apple', hours: 4}, {name: 'Nokia', hours: 12},];
//return [{name: 'Apple', totalHrs: '10'}], [{name: 'Nokia', totalHrs:
'24'}]
Thank you for any help.
nameand twototalHrsproperties.