Reflect.getOwnPropertyDescriptor() JavaScript

The JavaScript Reflect.getOwnPropertyDescriptor() method returns the descriptor of the property of an object. It is similar to Object.getOwnPropertyDescriptor(). I
Syntax:

Reflect.getOwnPropertyDescriptor(target, propertyKey)

Parameters:
target: It represents the object in which to look for the property.
propertyKey: It represents the name of the property whosee descriptor have to be fetched.

Return:
It returns the descriptor of the specified property if it exists on the object otherwise returns undefined.

Note: It throws TypeError, if target is not an Object.

Example 1:

<!DOCTYPE html>
<html>
<body>
<script>
const obj = {prop:1000};  
document.write(Reflect.getOwnPropertyDescriptor(obj,'prop').value);  
</script>
</body>
</html>

Output:

1000

Example 2:

<!DOCTYPE html>
<html>
<body>
<script>
 
const object1 = {
  property1: 542
};
 
document.write(Reflect.getOwnPropertyDescriptor(object1, 'property1').value);
document.write("</br>");
document.write(Reflect.getOwnPropertyDescriptor(object1, 'property2'));
document.write("</br>");
document.write(Reflect.getOwnPropertyDescriptor(object1, 'property1').writable);
</script>
</body>
</html>

Output:

542
undefined
true
Please Share