JS Built-ins
← Object119 / 150
ObjectObject.valuesintermediate

Object.values() β€” inherited not included

πŸ“– Usage Example
// Get array of own enumerable property values
const obj = { a: 1, b: 2, c: 3 }
Object.values(obj)   // β†’ [1, 2, 3]

Use Object.values() to get an array of an object's own enumerable property values for easy iteration.

Object.values() β€” own properties only

Object.values() does not include values from inherited prototype properties.

Challenge: Show that inherited property values are excluded from Object.values().

πŸ’‘ Hints (1)
  • β€’ Own properties only β€” prototype chain is ignored