Our volunteers haven't translated this article into ไทย yet. Join us and help get the job done!
You can also read the article in English (US).

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.

Description

Unlike most global objects, Reflect is not a constructor. You cannot 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).

Methods

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()
Calls a target function with arguments as specified by the args parameter. See also Function.prototype.apply().
Reflect.construct()
 The new operator as a function. Equivalent to calling new target(...args). Provides also the optional possibility to specify a different prototype.
Reflect.defineProperty()
Similar to Object.defineProperty(). Returns a Boolean.
Reflect.deleteProperty()
The delete operator as a function. Equivalent to calling delete target[name].
Reflect.get()
A function that returns the value of properties.
Reflect.getOwnPropertyDescriptor()
Similar to Object.getOwnPropertyDescriptor(). Returns a property descriptor of the given property if it exists on the object,  undefined otherwise.
Reflect.getPrototypeOf()
Same as Object.getPrototypeOf().
Reflect.has()
The in operator as function. Returns a boolean indicating whether an own or inherited property exists.
Reflect.isExtensible()
Same as Object.isExtensible().
Reflect.ownKeys()
Returns an array of the target object's own (not inherited) property keys.
Reflect.preventExtensions()
Similar to Object.preventExtensions(). Returns a Boolean.
Reflect.set()
A function that assigns values to properties. Returns a Boolean that is true if the update was successful.
Reflect.setPrototypeOf()
A function that sets the prototype of an object.

Specifications

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.
Draft Reflect.enumerate has been removed.

Browser compatibility

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
Basic supportChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
applyChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
constructChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
definePropertyChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
deletePropertyChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
enumerate
DeprecatedNon-standard
Chrome No support NoEdge No support ? — 15Firefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
getChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
getOwnPropertyDescriptorChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
getPrototypeOfChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
hasChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
isExtensibleChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
ownKeysChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
preventExtensionsChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
setChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0
setPrototypeOfChrome Full support 49Edge Full support 12Firefox Full support 42IE No support NoOpera Full support 36Safari Full support 10WebView Android Full support 49Chrome Android Full support 49Edge Mobile Full support YesFirefox Android Full support 42Opera Android Full support 36Safari iOS Full support 10Samsung Internet Android Full support 5.0nodejs Full support 6.0.0

Legend

Full support  
Full support
No support  
No support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.

See also

Document Tags and Contributors

ป้ายกำกับ: 
ผู้มีส่วนร่วมกับหน้านี้: mamacdon, pascallothar, fscholz, jameshkramer, kdex, bsara, dgashmdn, gingerik, tschneidereit, m_gol, DevelX, claudepache, Sheppy, evilpie, Tiddo_Langerak, SphinxKnight, loganfranken
อัปเดตล่าสุดโดย: mamacdon,