Skip to main content
Version: 3.27.2

Reflect.set()

The static Reflect.set() method works like setting a property on an object.

Syntax

Reflect.set(target, propertyKey, value)
Reflect.set(target, propertyKey, value, receiver)

Parameters

  • target
    • : The target object on which to set the property.
  • propertyKey
    • : The name of the property to set.
  • value
    • : The value to set.
  • receiver optional
    • : The value of this provided for the call to the setter for propertyKey on target. If provided and target does not have a setter for propertyKey, the property will be set on receiver instead.

Return value

A Boolean indicating whether or not setting the property was successful.

Exceptions

A TypeError, if target is not an Object.

Description

The Reflect.set method allows you to set a property on an object. It does property assignment and is like the property accessor syntax as a function.