loading...

re: Returning an object using reduce() VIEW POST

FULL DISCUSSION
 

Do not use reduce.

Try :

Array.from(new Set(songs.map(e => e.artist).sort()).values()).map(e => {let obj = {}; obj[e] = songs.filter(f => f.artist == e).length; return obj;})

code of conduct - report abuse