JS: Reflect

By Xah Lee. Date: . Last updated: .

New in ES2015.

Reflect is the value of the property key "Reflect" of the global object. [JS: the Global Object]

console.log ( window["Reflect"] === Reflect ); // true

Type

Type of Reflect is object.

[see JS: Data Types]

// type of Reflect
console.log ( typeof Reflect === "object" ); // true
console.log ( Object.prototype.toString.call(Reflect) === "[object Object]" ) // true

Parent

Parent of Reflect is Object.prototype. [see JS: Prototype and Inheritance] [see JS: Object.prototype]

console.log ( Reflect.getPrototypeOf ( Reflect ) === Object.prototype); // true

Purpose

The Reflect object is used as namespace to host a group of static functions. (like the Math object. [see JS: Math] )

Reflect's methods typically:

[see JS: Object Object]

[see JS: Function Object]

Properties

Reference

ECMAScript 2015 §Reflection#sec-reflect-object

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

Ask me question on patreon