_.omit

Returns a copy of the object, filtered to omit the keys specified.

  1. var object = { 'a': 1, 'b': '2', 'c': 3 };
  2.  
  3. // Underscore/Lodash
  4. var result = _.omit(object, ['a', 'c']);
  5. console.log(result)
  6. // output: { 'b': '2' }
  7.  
  8. // Native
  9. var { a, c, ...result2 } = object;
  10. console.log(result2)
  11. // output: { 'b': '2' }

Browser Support for Spread in object literals

ChromeEdgeFirefoxIEOperaSafari
60.0 ✔55.0 ✔37.0 ✔