How would I turn an array of objects like this
const scores = [
{
year: 2020,
dave: 20
},
{
year: 2020,
steve: 17
},
{
year: 2019,
bill: 18
}
];
into this
const scores = [
{
year: 2020,
dave: 20,
steve: 17
},
{
year: 2019,
bill: 18
}
];