Difference between arrays

This commit is contained in:
Angelos Chalaris
2017-12-09 17:24:34 +02:00
parent e38dc0c7bc
commit dcedc10fa0
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,8 @@
### Difference between arrays
Use `filter()` to remove values that are not part of `values`, determined using `indexOf()`.
```js
var difference = (arr, values) =>
arr.filter(v => values.indexOf(v) === -1);
```