我在数组下面
[{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)},]