diff --git a/snippets/array-without.md b/snippets/array-without.md new file mode 100644 index 000000000..353d1308e --- /dev/null +++ b/snippets/array-without.md @@ -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] +```