JS Built-ins
Reflecthasbeginner

Reflect.has() β€” missing key returns false

πŸ“– Usage Example
const obj = { a: 1 }
console.log(Reflect.has(obj, 'a'))  // β†’ true
console.log(Reflect.has(obj, 'b'))  // β†’ false
// Equivalent to: 'a' in obj

Reflect.has() checks whether an object has a property, equivalent to the in operator.

Reflect.has() β€” missing key

When the key does not exist in the object or its prototype chain, Reflect.has() returns false.

Challenge: Verify that Reflect.has({}, 'missing') returns false.

πŸ’‘ Hints (1)
  • β€’ `Reflect.has` returns `false` for keys that do not exist on the target or its prototype chain.