Array.prototype.includes()
to find values to exclude.Array.prototype.filter()
to create an array excluding them.const without = (arr, ...args) => arr.filter(v => !args.includes(v));
without([2, 1, 2, 3], 1, 2); // [3]
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️