_.without

❗️Lodash onlyReturns an array where matching items are filtered.

  1. // Lodash
  2. var array = [1, 2, 3]
  3. console.log(_.without(array, 2))
  4. // output: [1, 3]
  5.  
  6. // Native
  7. var array = [1, 2, 3]
  8. console.log(array.filter(function(value) {
  9. return value !== 2;
  10. }));
  11. // output: [1, 3]

Browser Support for Array.prototype.filter()

ChromeEdgeFirefoxIEOperaSafari
1.0 ✔1.5 ✔9 ✔