I have an array like this:
I would like to group and get the sum of each repetition like this:
Try this out:
function( data ){ var outputObj = {} ; for(var i=0;i < data.length; i++){ datum = data[i]; if(outputObj[datum.AGENDADOR]) outputObj[datum.AGENDADOR] += parseInt( datum.TOTAL) ; else outputObj[datum.AGENDADOR] = parseInt( datum.TOTAL); } return outputObj;
};