How to filter array of objects by duplicate and property?
I have a array like this:
let data = [
{
name: 'foo',
score: 10,
},
{
name: 'bar',
score: 20
},
{
name: 'foo',
score: 15,
},
];
Now this represents a track records of scores by player. I want to get the highest score of each player. How can I achieve this? I tried different combinations of filters and I cant find a way without iterating multiple times over the array.
Thanks for any help!
from Recent Questions - Stack Overflow https://ift.tt/3i3pV9h
https://ift.tt/eA8V8J
Comments
Post a Comment