{"ScriptPreparationCode":"function dec2hex (dec) {\r\n return dec \u003C 10\r\n ? \u00270\u0027 \u002B String(dec)\r\n : dec.toString(16)\r\n}\r\n\r\nfunction generateId (len) {\r\n var arr = new Uint8Array((len || 40) / 2)\r\n window.crypto.getRandomValues(arr)\r\n return Array.from(arr, dec2hex).join(\u0027\u0027)\r\n}\r\n\r\nvar a = []\r\nvar b = []\r\nfor( let i = 0; i \u003C 1000; i\u002B\u002B)\r\n{\r\n a[i] = generateId(16)\r\n b[i] = generateId(16)\r\n}","TestCases":[{"Name":"current xor implementation","Code":"const res = _.xor(a,b)","IsDeferred":false},{"Name":"alternative with Sets","Code":"function xor(...arrs) {\r\n const processSet = (set1, set2, targetSet) =\u003E {\r\n for (const item of set1) {\r\n if (!set2.has(item)) {\r\n targetSet.add(item);\r\n }\r\n }\r\n };\r\n const xorValues = arrs\r\n .reduce((current, next) =\u003E {\r\n const newSet = new Set();\r\n const nextSet = new Set(next);\r\n processSet(current, nextSet, newSet);\r\n processSet(nextSet, current, newSet);\r\n return newSet;\r\n }, new Set());\r\n return Array.from(xorValues);\r\n}\r\n\r\nconst res = xor(a,b)","IsDeferred":false}]}