Comparation with Array search and Map Search


Sample code

function searchMap(a, b) { //fast
let s = new Set()
for (let x of a)
if (b.has(x)) s.add(x)
return s
}
function searchArray() { //slow
let s = new Set()
for (let x of a)
for (let y of b)
if (x == y) s.add(x)
return s
}