JavaScript Reflect.has() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Static method

Definition

Reflect.has(target, propertyKey) checks whether an object has a property. It returns true or false. It is the function version of the in operator: Reflect.has(obj, "a") does the same as "a" in obj.

The check also looks at the prototype chain. So inherited properties, such as toString, count as well. To check only the object's own properties, use hasOwnProperty() or Object.hasOwn() instead.

Remember
Reflect.has(target, key)

property found (own or inherited)  → true
not found                          → false

Same as:  key in target
A property set to undefined still counts
target must be an object, or TypeError

Syntax

Pass an object and the name of the property to look for.

JavaScript
const user = { name: "Ann" };

console.log(Reflect.has(user, "name"));       // true
console.log(Reflect.has(user, "age"));        // false
console.log(Reflect.has(user, "toString"));   // true (inherited)
CallWhat it does
Reflect.has(obj, "a")Is there a property a in obj or its prototype chain?
Reflect.has(arr, 2)Is there an item at position 2 in the array?
"a" in objThe operator. It gives the same answer.
obj.hasOwnProperty("a")Only the object's own properties, not inherited ones.

A standard JavaScript static method (ES2015) of the Reflect object: call it as Reflect.has(). No import required. Siblings: Reflect.apply(), Reflect.construct(), Reflect.defineProperty(), Reflect.deleteProperty(), Reflect.get(), Reflect.getOwnPropertyDescriptor(), Reflect.getPrototypeOf(), Reflect.isExtensible(), Reflect.ownKeys(), Reflect.preventExtensions(), Reflect.set(), Reflect.setPrototypeOf().

Library declarations
JavaScript
// ECMAScript 2015 (ES6)
Reflect.has(target, propertyKey)

// target      : an object
// propertyKey : a string or a symbol
// returns     : true or false
// throws      : TypeError if target is not an object

Parameters

ParameterDescription
targetRequired. The object to look in. If it is not an object, a TypeError is thrown.
propertyKeyRequired. The name of the property: a string or a symbol. Numbers are turned into strings.

Return Value

Return ValueDescription
trueThe object, or something in its prototype chain, has the property.
falseThe property is nowhere in the chain.
TypeError (thrown)target is not an object.

JavaScript Examples

Example 1 — Check if a Property Exists

Look for properties in an object and in an array. A property that holds undefined still counts.

JavaScript
const user = { name: "Ann", nickname: undefined };

console.log("name: " + Reflect.has(user, "name"));
console.log("age: " + Reflect.has(user, "age"));
console.log("nickname: " + Reflect.has(user, "nickname"));
console.log("Value of nickname: " + user.nickname);

const list = ["a", "b"];
console.log("Position 1: " + Reflect.has(list, 1));
console.log("Position 5: " + Reflect.has(list, 5));
Try It Yourself

How It Works

  1. Found or not. name is in the object, age is not.
  2. Undefined still exists. nickname holds undefined, but the property is there, so has() returns true. Checking user.nickname === undefined could not tell the difference.
  3. Array positions. An array has properties named "0" and "1", so position 1 exists and position 5 does not.

Example 2 — Own and Inherited Properties

has() looks up the prototype chain. See how that differs from an own-property check.

JavaScript
const parent = { shared: 1 };
const child = Object.create(parent);
child.own = 2;

console.log("Has own: " + Reflect.has(child, "own"));
console.log("Has shared: " + Reflect.has(child, "shared"));
console.log("Has toString: " + Reflect.has(child, "toString"));

console.log("Own check for own: " + child.hasOwnProperty("own"));
console.log("Own check for shared: " + child.hasOwnProperty("shared"));
Try It Yourself

How It Works

  1. The whole chain. has() finds own on the child, shared on the parent, and toString on Object.prototype.
  2. Own only. hasOwnProperty() only looks at the child itself, so it finds own but not shared.
  3. Pick the right one. Use has() when inherited properties are fine, and an own check when the property must belong to this very object.

Example 3 — Symbols, Built-ins and Errors

Symbol keys work, and so do properties of built-in objects. A string is not an object, so it throws. The catch block prints the error type only.

JavaScript
const id = Symbol("id");
const item = { [id]: 123 };

console.log("Symbol key: " + Reflect.has(item, id));
console.log("Other symbol: " + Reflect.has(item, Symbol("id")));
console.log("Math has PI: " + Reflect.has(Math, "PI"));
console.log("Array has map: " + Reflect.has([], "map"));

try {
  Reflect.has("abc", "length");
} catch (err) {
  console.log("String target: " + err.name);
}
Try It Yourself

How It Works

  1. Symbol keys. The same symbol is found. A new Symbol("id") is a different symbol, even with the same description, so it is not found.
  2. Built-ins. Math has the property PI, and every array inherits map from Array.prototype.
  3. Only objects. A string is a primitive, so Reflect.has("abc", "length") throws a TypeError. The in operator also refuses a string on its right side.

Browser & Runtime Support

Reflect.has() is part of ES2015 (ES6), together with the Reflect object. Every current browser and Node.js has it.

✓ ES2015 · Widely supported

Reflect.has()

Supported in Chrome 49+, Edge 12+, Firefox 42+, Safari 10+, Opera 36+ and Node.js 6+. Internet Explorer never got it.

ES2015 Standard since
Google Chrome 49+ · Desktop & Mobile
Full support
Microsoft Edge 12+ · Chromium and legacy
Full support
Mozilla Firefox 42+ · Desktop & Mobile
Full support
Apple Safari 10+ · macOS & iOS
Full support
Opera 36+ · Chromium based
Full support
Samsung Internet Recent versions · Android
Supported
Android WebView 49+ · Chromium based
Supported
Node.js 6+ · Server runtime
Supported
Deno Supported · JavaScript runtime
Supported
Bun Supported · JavaScript runtime
Supported
Internet Explorer No native support
Not supported
Reflect.has() Excellent

Bottom line: Safe to use in every current browser and in Node.js. The only thing to plan for is Internet Explorer, which has no Reflect at all.

Frequently Asked Questions

It checks whether an object has a property and returns true or false. It is the function version of the in operator and it looks at inherited properties too.
Reflect.has() also finds properties that come from the prototype chain, such as toString. hasOwnProperty() and Object.hasOwn() only find properties that belong to the object itself.
Yes. The property exists, so the answer is true, even though its value is undefined. This is the main advantage over checking the value.
Yes. Array items are properties named "0", "1" and so on, so Reflect.has(array, 1) tells you if position 1 exists. It does not tell you whether an item equals a value. Use includes() for that.
A Proxy can intercept the in operator with a has trap. Inside the trap, return Reflect.has(target, key) to answer in the normal way, or return your own answer to hide some properties.

Next: Reflect.isExtensible()

Learn how to check whether new properties can still be added to an object.

Reflect.isExtensible() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful