Filter out matching array elements

JavaScript, Array · Oct 22, 2020

Filters out the elements of an array that have one of the specified values.

const without = (arr, ...args) => arr.filter(v => !args.includes(v));
without([2, 1, 2, 3], 1, 2); // [3]

More like this