0Pricing
JavaScript Academy · Lesson

The Reflect API

Forward operations with Reflect methods.

What Is Reflect?

Reflect is a built-in object with methods that perform the default low-level operations on objects: getting, setting, deleting, and more.

Its methods mirror the proxy traps one-to-one, which makes it the ideal partner for writing correct proxies.

Reflect.get

Reflect.get(target, prop) reads a property, the same as target[prop], but as a clean function call.

const obj = { name: 'Ada', age: 36 };

console.log(Reflect.get(obj, 'name'));
console.log(Reflect.get(obj, 'age'));

All lessons in this course

  1. Creating a Proxy
  2. get and set Traps
  3. The Reflect API
  4. Practical Proxy Use Cases
← Back to JavaScript Academy