CKTIS / JavaScript
Reflect.has — checking whether a property exists
`Reflect.has(target, propertyKey)` returns a boolean. When the object and its entire prototype chain consist of ordinary objects, it distinguishes a missing property from an existing own or inherited property, even if its value is `undefined`. A `Proxy` object's `has` trap can change the result.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
Reflect.has(target, propertyKey)Reflect.has(target, propertyKey) checks property existence, not its value. When the object and all of its prototypes are ordinary objects, it searches the object and its prototype chain and returns true or false. A property whose value is undefined still exists; enumerability does not matter.
It is the function form of propertyKey in target. If you only want own properties, use Object.hasOwn(target, propertyKey): unlike Reflect.has, it excludes inherited properties.
target must be an object; a primitive value, including null or undefined, causes a TypeError. propertyKey is converted to a property key: a string or symbol. For example, the number 0 addresses the key "0". Conversion errors propagate to the caller.
The method invokes the internal [[HasProperty]] operation. If the lookup encounters a Proxy, it can invoke the has trap. The trap can change the boolean result: it can report an absent property as present or hide an existing configurable own property on an extensible target. The check can also have side effects or throw an exception. In the example, own exists despite its undefined value, whereas inherited is found only by the prototype-aware check.
Examples
const parent = { inherited: 42 };
const item = Object.create(parent);
item.own = undefined;
console.log(Reflect.has(item, "own"));
console.log(Reflect.has(item, "inherited"));
console.log(Reflect.has(item, "missing"));
console.log(Object.hasOwn(item, "inherited"));Result
true true false false
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.