{"ScriptPreparationCode":"\r\nvar array = [];\r\nfor (let i = 0; i \u003C 100000; i\u002B\u002B) {\r\n array.push({\r\n id: Math.floor((Math.random() * 10) \u002B 1),\r\n name: \u0027name\u0027 \u002B i\r\n });\r\n}","TestCases":[{"Name":"Set \u002B filter","Code":"const seen = new Set();\r\nconst filtered = array.filter(el =\u003E {\r\n const duplicate = seen.has(el.id);\r\n seen.add(el.id);\r\n return !duplicate;\r\n});","IsDeferred":false},{"Name":"Reduce","Code":"const filtered = array.reduce((acc, current) =\u003E {\r\n const x = acc.find(item =\u003E item.id === current.id);\r\n if (!x) {\r\n return acc.concat([current]);\r\n } else {\r\n return acc;\r\n }\r\n}, []);","IsDeferred":false},{"Name":"Set","Code":"const filtered = Array.from(new Set(array.map(a =\u003E a.id)))\r\n .map(id =\u003E {\r\n return array.find(a =\u003E a.id === id)\r\n })","IsDeferred":false}]}