Example 1 — Official: Three Keys
The docs list the own property names of a small object.
_.keys({one: 1, two: 2, three: 3});
// → ["one", "two", "three"] How It Works
- Source object. Three own properties:
one,two,three. - Collect names. Underscore pushes each enumerable own key into a new array.
- Result.
["one", "two", "three"]— the official docs example. - Safe. The original object is not modified.

