Update intersection.md

This commit is contained in:
Angelos Chalaris
2020-02-18 21:28:58 +02:00
committed by GitHub
parent 445ea8e049
commit 95f5aca09b

View File

@ -10,7 +10,7 @@ Create a `Set` from `b`, then use `Array.prototype.filter()` on `a` to only keep
```js
const intersection = (a, b) => {
const s = new Set(b);
return a.filter(x => s.has(x));
return [...new Set(a)].filter(x => s.has(x));
};
```