_.keys

Retrieves all the names of the object's own enumerable properties.

  1. // Underscore/Lodash
  2. var result = _.keys({one: 1, two: 2, three: 3})
  3. console.log(result)
  4. // output: ["one", "two", "three"]
  5.  
  6. // Native
  7. var result2 = Object.keys({one: 1, two: 2, three: 3})
  8. console.log(result2)
  9. // output: ["one", "two", "three"]

Browser Support for Object.keys()

ChromeEdgeFirefoxIEOperaSafari
5.0 ✔4.0 ✔9.0 ✔12.0 ✔5.0 ✔