JavaScript Reflect Object
Reflect is a namespace of methods for low-level operations on objects, such as getting, setting and defining properties. It is often used inside Proxy handlers.
Description
The Reflect object provides static methods that perform the same internal operations JavaScript uses for things like property access, assignment and function calls: Reflect.get(), Reflect.set(), Reflect.has(), Reflect.deleteProperty(), Reflect.ownKeys(), Reflect.apply(), Reflect.construct() and more. It is not a constructor.
Its methods have the same names and arguments as the Proxy handler traps, so inside a handler you can call the matching Reflect method to carry out the default behavior. Some also give friendlier results than their Object equivalents, such as returning false instead of throwing when a property can't be defined.
Reflect methods are also useful outside proxies. Reflect.ownKeys() lists every own property key, including non-enumerable and symbol keys, which Object.keys() leaves out. Reflect.has() works like the in operator as a function, and Reflect.construct() calls a constructor with an array of arguments, which is handy when the constructor is chosen at run time.
Syntax
Reflect.method(target, ...args)Example
Browser Support
The following information will show you the current browser support for the Reflect object. Hover over a browser icon to see the version that first introduced support for this object.
Desktop





Tablets & Mobile





