我想从重复数组对象中删除重复项

时间:2019-05-14 13:53:49

标签: duplicates

我在数组下面

[{name:'Benefactor 1',totalDonated:10},

{name:'Benefactor 2',totalDonated:8},

{name:'Benefactor 3',totalDonated:20},

{名称:'Benefactor 4',总计捐款:50},

{name:'Benefactor 2',totalDonated:5},

{名称:'Benefactor 4',总计:5}]

我想删除重复项,并将已删除的重复项的总和删除为已存在的内容,如下所示:

[{name:'Benefactor 1',totalDonated:10},

{name:'Benefactor 2',totalDonated:(8 + 5)},

{name:'Benefactor 3',totalDonated:20},

{名称:“恩人4”,totalDonated:(50 + 5)},]

0 个答案:

没有答案