Correct: `Array.from()` (it’s a static method) Incorrect: `Array.join()` (doesn’t exist; it’s a prototype method) This patch uses the common `#` syntax to denote `.prototype.`.
395 B
395 B
without
Filters out the elements of an array, that have one of the specified values.
Use Array.prototype.filter() to create an array excluding(using !Array.includes()) all given values.
(For a snippet that mutates the original array see pull)
const without = (arr, ...args) => arr.filter(v => !args.includes(v));
without([2, 1, 2, 3], 1, 2); // [3]