Purpose of Reflect: Invoke Functions and Access Prototypes

Learn about the built-in methods of the Reflect class used to invoke the functions and access the prototypes.

We’ve used a few methods of Reflect so far in this course. Now, it’s time to step back and take a fresh look at this class.

Purpose of Reflect

Reflect has two main purposes:

  1. It’s a go-to place for various meta-operations on objects. For example, Reflect provides methods to get and set an object’s prototype and to check whether a property exists in an object, just to mention a couple.
  2. The Proxy class, which you’ll see soon, routes its methods to methods of Reflect by default. Then, when using a proxy, we can override only select operations and conveniently leave the rest to the default implementations.

There are about two dozen methods in Reflect.

Get hands-on with 1400+ tech skills courses.