I am trying to remove duplicate from an array of object in Javascript. Below is the code which doesnot work, it is creating Array of map of size 4.
let arr = [{id: 32, name: 'Name1', age: 88},
{id: 33, name: 'Name2', age: 88},
{id: 32, name: 'Name3', age: 88},
{id: 1, name: 'Sam', age: 88},
{id: 33, name: 'Name2', age: 88},
{id: 2, name: 'Tom', age: 88}
];
console.log(arr)
let mp1 = new Map();
let uniqueElements = arr.map( obj => mp1.set(obj.id, obj))
console.log(uniqueElements);