JS Built-ins
ReflectownKeysbeginner

Reflect.ownKeys() - empty object

πŸ“– Usage Example
const obj = { a: 1, b: 2 }
const keys = Reflect.ownKeys(obj)
console.log(keys) // β†’ ['a', 'b']
// Includes string keys, Symbol keys, and non-enumerable keys

Reflect.ownKeys() returns an array of all own property keys (strings and Symbols) of an object.

Empty object has 0 own keys.

πŸ’‘ Hints (1)
  • β€’ Reflect.ownKeys returns only own keys, not prototype chain.