How can I map this array of objects to a new array of objects where the object's id is the key and its value is the object?
var players = [{id: 2, score: 5}, {id: 3, score: 10}]
var mapped = _.map(players, function(x) { return {x.id: x}})
// desired output = [{2: {id: 2, score: 4}, {3: {id: 3, score: 10}} ]
I get a syntax error trying the above Uncaught SyntaxError: Unexpected token .(…)