I have an array of objects
list = [{x:1,y:2}, {x:3,y:4}, {x:5,y:6}, {x:1,y:2}]
And I\'m looking for an efficient way (if possible O(
O(
Plain javascript (ES2015), using Set
const list = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }, { x: 1, y: 2 }]; const uniq = new Set(list.map(e => JSON.stringify(e))); const res = Array.from(uniq).map(e => JSON.parse(e)); document.write(JSON.stringify(res));