这组数据中 怎么把name的值相同的number相加?
原数据
var res = [{
"name": "apple",
"number": "15",
"date": "2017/1/2",
}, {
"name": "orange",
"number": "25",
"date": "2017/1/4",
}, {
"name": "apple",
"number": "4",
"date": "2017/1/7",
}, {
"name": "banana",
"number": "1",
"date": "2017/1/1",
}];
希望统计的结果
var res = [{
"name": "apple",
"number": "19",
}, {
"name": "orange",
"number": "25",
}, {
"name": "banana",
"number": "1",
}];