JS Built-ins
← Object120 / 150
ObjectObject.valuesbeginner

Object.values() β€” empty object

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

Object.values({}) returns an empty array [].

Challenge: Use Object.values() to check if an object has any own enumerable properties.

πŸ’‘ Hints (1)
  • β€’ Object.values([]).length is 0 means the object is empty