{"ScriptPreparationCode":"var empty = { id: \u0027\u0027, number: 10000 };\r\nvar array1 = [empty];\r\nvar array2 = [empty];\r\nvar entities = { \u0027\u0027: empty };\r\nvar id = \u0027\u0027;\r\n\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n id = String(i);\r\n entities[id] = { id, number: i }\r\n}\r\n\r\nfunction getRandomInt(min, max) {\r\n min = Math.ceil(min);\r\n max = Math.floor(max);\r\n return Math.floor(Math.random() * (max - min) \u002B min); //The maximum is exclusive and the minimum is inclusive\r\n}\r\n\r\nfor (let i = 0; i \u003C 100; i\u002B\u002B) {\r\n array1.push(entities[getRandomInt(i, 10000)]);\r\n}\r\n\r\nfor (let i = 0; i \u003C 100; i\u002B\u002B) {\r\n array2.push(entities[getRandomInt(i, 10000)]);\r\n}","TestCases":[{"Name":"Array.includes","Code":"var data = Array.from(new Set([...array1, ...array2])).reduce(\r\n (acc, item) =\u003E {\r\n if (array1.includes(item)) {\r\n if (array2.includes(item)) {\r\n acc.union.push(item);\r\n } else {\r\n acc.lhsOnly.push(item);\r\n }\r\n } else {\r\n acc.rhsOnly.push(item);\r\n }\r\n\r\n return acc;\r\n },\r\n { rhsOnly: [], lhsOnly: [], union: [] }\r\n);\r\n\r\nconsole.log(data)","IsDeferred":false},{"Name":"Map.has","Code":"var lMap = new Map(array1.map((item) =\u003E [item, true]));\r\nvar rMap = new Map(array2.map((item) =\u003E [item, true]));\r\nvar unionMap = new Map([...lMap.entries(), ...rMap.entries()]);\r\n\r\nvar result = { rhsOnly: [], lhsOnly: [], union: [] };\r\n\r\nfor (var [item] of unionMap) {\r\n if (lMap.has(item)) {\r\n if (rMap.has(item)) {\r\n result.union.push(item);\r\n } else {\r\n result.lhsOnly.push(item);\r\n }\r\n } else {\r\n result.rhsOnly.push(item);\r\n }\r\n}\r\n\r\nconsole.log(result)","IsDeferred":false}]}