- O: It refers to Object(this value). Object accepts the argument value. It converts the argument to an object value.
- P : It refers to a string key that is generated from the property (P). It refers to the name of the property that should be returned by the setter.
- Returns undefined if object O is null or IsAccessorDescriptor is false.
- If the object O is not null and IsAccessorDescriptor is true, the function bound as a setter to the specified property is returned.
Example 1: It returns a function named gfg().
Web standards no longer recommend this feature. Though it is still supported by some browsers, such as Google Chrome, it is being phased out. It should not be used in any new or old project. It is possible that pages or web apps that rely on it will fail any time.
It is recommended to use Object.getOwnPropertyDescriptor().set, which takes two parameters.
- Object in which the property should be sought.
- Name of the property from which the description is to be retrieved.
Note: It returns the function that serves as the property’s setter, or undefined if there is no setter.
- Google Chrome
- Internet Explorer
Note:This function has been DEPRECATED and no longer recommended.