Create array-without.md
This commit is contained in:
9
snippets/array-without.md
Normal file
9
snippets/array-without.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
### Array without
|
||||||
|
|
||||||
|
Filters out array elements if they are included in the given `values` arguments
|
||||||
|
|
||||||
|
```js
|
||||||
|
const without = ((arr, ...values) => arr.filter(x => !values.includes(x)))
|
||||||
|
|
||||||
|
//without([2, 1, 2, 3], 1, 2); -> [3]
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user