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?
Similar Posts
- Remove duplicates from an array and return unique values in O(n) complexity
- Lodash - merge two arrays and remove duplicates from it
- Remove an object from array by value in Javascript
- Remove a key or property from Object in Javascript
- Convert object {key: value} to Array [[key, value]] Javascript
- Get all values as array items from an Object in Javascript
- Lodash - Convert paired Array to key value paired object