6 lines
125 B
JavaScript
6 lines
125 B
JavaScript
const intersection = (a, b) => {
|
|
const s = new Set(b);
|
|
return a.filter(x => s.has(x));
|
|
};
|
|
module.exports = intersection;
|