Wouldn't do it with variable, since it will make your function impure [1]
1 : http://www.nicoespeon.com/en/2015/01/pure-functions-javascri...
1 : http://www.nicoespeon.com/en/2015/01/pure-functions-javascri...
let acc = {...}
footballPlayers.reduce(...,acc)
It should become clear: acc is an external variable that got mutated by the reduce.I'd do it like this (yay for one-ish-liners!):
const playersByCountry = footballPlayers.reduce((acc, player) => {
return {...acc, [player.country]: [...(acc[player.country] || []), player]};
}, {});