{"ScriptPreparationCode":"function generateId(len) {\r\n return [...Array(len)]\r\n .map(i =\u003E (~~(Math.random() * 36)).toString(36))\r\n .join(\u0022\u0022);\r\n}","TestCases":[{"Name":"Reduce","Code":"let data = [];\r\n\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n data.push({\r\n id: generateId(4)\r\n });\r\n}\r\n\r\nconst newDataReduce = Object.keys(data.reduce((acc, cur) =\u003E {\r\n\tif(acc[cur.id]) return acc;\r\n\tacc[cur.id] = true;\r\n\treturn acc;\r\n}, {}));","IsDeferred":false},{"Name":"Set Map","Code":"let data = [];\r\n\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n data.push({\r\n id: generateId(4)\r\n });\r\n}\r\n\r\nconst newDataSet = Array.from(new Set(data.map(f =\u003E f.id)));","IsDeferred":false},{"Name":"Set Simple For","Code":"let data = [];\r\n\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n data.push({\r\n id: generateId(4)\r\n });\r\n}\r\n\r\nconst newDataSimpleFor = new Set();\r\n\r\nfor(let i = 0; i \u003C data.length; i\u002B\u002B){\r\n\tif(newDataSimpleFor.has(data[i].id)) continue;\r\n\tnewDataSimpleFor.add(data[i].id);\r\n}\r\n\r\nconst res = Array.from(newDataSimpleFor);","IsDeferred":false},{"Name":"Set For Of","Code":"let data = [];\r\n\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n data.push({\r\n id: generateId(4)\r\n });\r\n}\r\n\r\nconst newDataForOf = new Set();\r\n\r\nfor(let dp of data){\r\n\tif(newDataForOf.has(dp.id)) continue;\r\n\tnewDataForOf.add(dp.id);\r\n}\r\n\r\nconst res2 = Array.from(newDataForOf);","IsDeferred":false},{"Name":"Set For Each","Code":"let data = [];\r\n\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n data.push({\r\n id: generateId(4)\r\n });\r\n}\r\n\r\nconst newDataForEach = new Set();\r\n\r\ndata.forEach(dp =\u003E {\r\n\tif(newDataForEach.has(dp.id)) return;\r\n\tnewDataForEach.add(dp.id);\r\n});\r\n\r\nconst res3 = Array.from(newDataForEach);","IsDeferred":false}]}