DEV Community

Discussion on: Removing duplicates in an Array of Objects in JS with Sets

Collapse
 
programmist profile image
Tony Childs

Hi Mayank,

I'm not sure I follow. If no duplicates are removed then that is just the original array is it not? Or do you mean you want an array with just ids 1, 2, and 3? If so, you can use Array.prototype.filter and only return true for the ids you want to keep.