consider the array:
var arr = [
{ val: 12, timestamp: 'Thu Jan 12 2017 02:00:00 GMT+0100 (CET)'},
{ val: 54, timestamp: 'Thu Jan 12 2017 02:00:00 GMT+0100 (CET)'},
{ val: 34, timestamp: 'Thu Jan 13 2017 02:00:00 GMT+0100 (CET)'},
{ val: 21, timestamp: 'Thu Jan 13 2017 02:00:00 GMT+0100 (CET)'}];
What should i use to find where the timestamp meet, and sum the val ? so I would get
result: [
{ val: 66, timestamp: 'Thu Jan 12 2017 02:00:00 GMT+0100 (CET)' }
....
]
I tried to loop, but I cannot know to how group and merge?