Javatpoint Logo
Javatpoint Logo

JavaScript Reflect.set() method

The static Reflect.set() method is used to set the value of an object's property. It returns true if the property was successfully set. Otherwise, it returns false.

Syntax:

Parameters:

Obj: It is the target object on which to set the property.

Key: It is the name of the property to set.

value: It is the value to set.

Receiver: It is the value of this provided for the call to target if a setter is encountered.

Return value:

This method returns a Boolean which indicates whether or not setting the property was successful.

Exceptions:

A TypeError, if the target is not an Object.

Browser Support:

Chrome 49
Edge 12
Firefox 42
Opera 36

Example 1

Output:

"gosse"

Example 2

Output:

32

Example 3

Output:

7
4
Next TopicJavaScript Reflect





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA