javascript

Remove duplicates ids from object array

score = [
    {
        id:123,
        name:"Arun",
        point:"10"
    },
    {
        id:123,
        name:"Arun",
        point:"10"
    },
    {
        id:12233,
        name:"Arudfn",
        point:"11230"
    },
]


const unique_result = [...new Map(score.map((item) => [item['id'], item])).values()]
Was this helpful?