JS Built-ins
← Object118 / 150
ObjectObject.valuesintermediate

Object.values() β€” non-enumerable excluded

πŸ“– 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() β€” enumerable only

Like Object.keys(), Object.values() only returns values for own enumerable properties. Non-enumerable properties defined via Object.defineProperty are excluded.

Challenge: Demonstrate the difference between enumerable and non-enumerable property values.

πŸ’‘ Hints (1)
  • β€’ Non-enumerable properties are invisible to Object.values