Reflect.get()
The static Reflect.get()
method works like getting a
property from an object (target[propertyKey]
) as a function.
Syntax
Reflect.get(target, propertyKey)
Reflect.get(target, propertyKey, receiver)
Parameters
target
- : The target object on which to get the property.
propertyKey
- : The name of the property to get.
receiver
optional- : The value of
this
provided for the call totarget
if a getter is encountered. When used withProxy
, it can be an object that inherits fromtarget
.
- : The value of
Return value
The value of the property.
Exceptions
A TypeError
, if target
is not an
Object
.
Description
The Reflect.get
method allows you to get a property on an object. It is like the
property accessor syntax as a function.