Reflect is a built-in object that provides methods for interceptable JavaScript operations. The methods are the same as those of proxy handlers. Reflect
is not a function object, so it's not constructible.
Unlike most global objects, Reflect
is not a constructor. You can not use it with a new
operator or invoke the Reflect
object as a function. All properties and methods of Reflect
are static (just like the Math
object).
The Reflect
object provides the following static functions which have the same names as the proxy handler methods. Some of these methods are the same as corresponding methods on Object
.
Reflect.apply()
args
parameter. See also Function.prototype.apply()
.Reflect.construct()
new
operator as a function. Equivalent to calling new target(...args)
.Reflect.defineProperty()
Object.defineProperty()
. Returns a Boolean
.Reflect.deleteProperty()
delete
operator as a function. Equivalent to calling delete target[name]
.Reflect.get()
Reflect.getOwnPropertyDescriptor()
Object.getOwnPropertyDescriptor()
. Returns a property descriptor of the given property if it exists on the object, undefined
otherwise.Reflect.getPrototypeOf()
Object.getPrototypeOf()
.Reflect.has()
in
operator as function. Returns a boolean indicating whether an own or inherited property exists.Reflect.isExtensible()
Object.isExtensible()
.Reflect.ownKeys()
Reflect.preventExtensions()
Object.preventExtensions()
. Returns a Boolean
.Reflect.set()
Boolean
that is true
if the update was successful.Reflect.setPrototypeOf()
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Reflect' in that specification. | Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262) The definition of 'Reflect' in that specification. | Living Standard | Reflect.enumerate has been removed. |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 49 | 12 | 42 | No | 36 | 10 |
apply |
49 | 12 | 42 | No | 36 | 10 |
construct |
49 | 12 | 42 | No | 36 | 10 |
defineProperty |
49 | 12 | 42 | No | 36 | 10 |
deleteProperty |
49 | 12 | 42 | No | 36 | 10 |
enumerate |
No | No | No | No | No | No |
get |
49 | 12 | 42 | No | 36 | 10 |
getOwnPropertyDescriptor |
49 | 12 | 42 | No | 36 | 10 |
getPrototypeOf |
49 | 12 | 42 | No | 36 | 10 |
has |
49 | 12 | 42 | No | 36 | 10 |
isExtensible |
49 | 12 | 42 | No | 36 | 10 |
ownKeys |
49 | 12 | 42 | No | 36 | 10 |
preventExtensions |
49 | 12 | 42 | No | 36 | 10 |
set |
49 | 12 | 42 | No | 36 | 10 |
setPrototypeOf |
49 | 12 | 42 | No | 36 | 10 |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | 49 | 49 | Yes | 42 | No | 36 | 10 |
apply |
49 | 49 | Yes | 42 | No | 36 | 10 |
construct |
49 | 49 | Yes | 42 | No | 36 | 10 |
defineProperty |
49 | 49 | Yes | 42 | No | 36 | 10 |
deleteProperty |
49 | 49 | Yes | 42 | No | 36 | 10 |
enumerate |
No | No | No | No | No | No | No |
get |
49 | 49 | Yes | 42 | No | 36 | 10 |
getOwnPropertyDescriptor |
49 | 49 | Yes | 42 | No | 36 | 10 |
getPrototypeOf |
49 | 49 | Yes | 42 | No | 36 | 10 |
has |
49 | 49 | Yes | 42 | No | 36 | 10 |
isExtensible |
49 | 49 | Yes | 42 | No | 36 | 10 |
ownKeys |
49 | 49 | Yes | 42 | No | 36 | 10 |
preventExtensions |
49 | 49 | Yes | 42 | No | 36 | 10 |
set |
49 | 49 | Yes | 42 | No | 36 | 10 |
setPrototypeOf |
49 | 49 | Yes | 42 | No | 36 | 10 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect