CKTIS / JavaScript
Reflect.get — read a property with an optional receiver
`Reflect.get` reads an object's property, including an inherited one. In ordinary lookup, the receiver is passed as the getter's `this` argument without changing where lookup begins.
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.get(target, propertyKey[, receiver])Reflect.get(target, propertyKey[, receiver]) performs the internal [[Get]] operation. For an ordinary object, it looks for the property on target, then along its prototype chain. A missing property produces undefined; an accessor without a getter also produces undefined.
If receiver is omitted, it defaults to target. In ordinary property lookup, receiver is passed as the this argument when a getter is called, including an inherited getter. This does not guarantee that this inside the getter equals receiver. A bound getter passes its bound this value to the underlying function instead of the supplied this argument. An arrow function used as a getter ignores the this argument and uses lexical this, even if it was defined in non-strict code. In a function with non-strict, non-lexical this binding, a this argument of null or undefined is replaced with the function's global this value, and other primitive values are boxed. The receiver does not replace target as the starting point for lookup. When reading an ordinary data property, the discovered value is returned, not a property from receiver.
target must be an object: a primitive, null, or undefined causes a TypeError, rather than automatic boxing of a primitive. propertyKey is converted to a string or symbol property key. Reading can execute getter code or a Proxy object's get trap; Reflect.get does not catch exceptions.
Use this method when you need explicit control over a getter's receiver. Reading alone is not an existence test: undefined can mean either that the property is missing or that it is the property's current value.
Examples
const prototype = {
get greeting() {
return `Hello, ${this.name}`;
}
};
const target = Object.create(prototype);
target.name = "Ada";
const receiver = { name: "Lin" };
console.log(Reflect.get(target, "greeting"));
console.log(Reflect.get(target, "greeting", receiver));
console.log(Reflect.get(target, "name", receiver));
console.log(Reflect.get(target, "missing"));Result
Hello, Ada Hello, Lin Ada undefined
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.