{"ScriptPreparationCode":"var first = [...Array(100)].map(it =\u003E ~~(Math.random() * 1000));\r\nvar second = [...Array(20)].map(it =\u003E ~~(Math.random() * 1000));\r\n\r\nvar firstSet = new Set(first);\r\nvar secondSet = new Set(second);","TestCases":[{"Name":"Lodash intersection","Code":"_.intersection(first, second)","IsDeferred":false},{"Name":"Javascript Array intersection - filter","Code":"first.filter(it =\u003E second.includes(it))","IsDeferred":false},{"Name":"Javascript Array intersection - loop","Code":"let _intersection = new Array()\r\nfor (let elem of second) {\r\n if (first.indexOf(elem) \u003E -1) {\r\n _intersection.push(elem)\r\n } \r\n} \r\nreturn _intersection","IsDeferred":false},{"Name":"Javascript Set intersection - filter","Code":"new Set([...firstSet].filter(item =\u003E secondSet.has(item)));","IsDeferred":false},{"Name":"Javascript Set intersection - loop","Code":"let _intersection = new Set()\r\nfor (let elem of secondSet) {\r\n if (firstSet.has(elem)) {\r\n _intersection.add(elem)\r\n } \r\n} \r\nreturn _intersection","IsDeferred":false}]}