I have an array of objects and I need to scroll through them and add Maria and Cristiano's battlesWon, in the end I need to display how many BattleWon each one won as shown in the example
const array = [
{
id: '147acaa3-363c-4a28-af43-fcc035a1d500',
arena: 'Philippine Arena',
firstParticipant: {
address: '0x3ba59bcc1a02cb46e7de35fb0bacc860bf075661',
name: 'Cristiano',
battlesWon: 0
},
secondParticipant: {
address: '0x3ba59bcc1a02cb46e7de35fb0bacc860bf075644',
name: 'Maria',
battlesWon: 1
},
logs: [ [Object] ]
},
{
id: 'b2ef2d28-d84d-4cc9-946f-3d57b8ce05ab',
arena: 'Greensboro Coliseum',
firstParticipant: {
address: '0x3ba59bcc1a02cb46e7de35fb0bacc860bf075644',
name: 'Maria',
battlesWon: 1
},
secondParticipant: {
address: '0x3ba59bcc1a02cb46e7de35fb0bacc860bf075661',
name: 'Cristiano',
battlesWon: 0
},
logs: [ [Object] ]
}
]
Expected:
{
Cristiano: 0,
Maria: 2
}