mozilla
Your Search Results

    Reflect

    This is an experimental technology, part of the ECMAScript 6 (Harmony) proposal.
    Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.

    Summary

    Reflect is a built-in object that provides methods for interceptable JavaScript operations. The methods are the same as those of the proxy handlers. Reflect It is not a function object.

    Description

    Unlike the other 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 (like it is the case with the Math object).

    Methods

    The Reflect object provides the following static functions which have the same names as the proxy handler methods and also overlap with some of the Object methods:

    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).
    Reflect.defineProperty()
    Similar to Object.defineProperty(). Returns a Boolean.
    Reflect.deleteProperty()
    The delete operator as a function. Equivalent to calling delete target[name].
    Reflect.enumerate()
    Like the for...in loop. Returns an iterator with the enumerable own and inherited properties of the target object.
    Reflect.get()
    A function that returns the value of properties.
    Reflect.getOwnPropertyDescriptor()
    Similar to Object.getOwnPropertyDescriptor(). Returns a Boolean.
    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 strings with 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 6 (ECMA-262)
    The definition of 'Reflect' in that specification.
    Release Candidate Initial definition.

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support Not supported Not supported
    bug 987514
    12 Not supported Not supported
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support Not supported Not supported Not supported Not supported Not supported Not supported

    See also

    Document Tags and Contributors

    Contributors to this page: fscholz
    Last updated by: fscholz,