update snippets 16-31
This commit is contained in:
@ -6,5 +6,8 @@ Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values no
|
||||
|
||||
```js
|
||||
const difference = (a, b) => { const s = new Set(b); return a.filter(x => !s.has(x)); };
|
||||
// difference([1,2,3], [1,2,4]) -> [3]
|
||||
```
|
||||
|
||||
```js
|
||||
difference([1,2,3], [1,2,4]) -> [3]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user