Object.getOwnPropertyDescriptors() JavaScript JS

The Javascript Object getOwnPropertyDescriptors() method retrieves all own property descriptors of an object. It will return empty object if there is no property associated with Object.

Syntax:

Object.getOwnPropertyDescriptors(object)

Parameters:
object: It represents the object whose all own property descriptors have to be fetched.

Return:
All own property descriptors of the specified object.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
const obj = {  prop: 56  }  
const descript = Object.getOwnPropertyDescriptors(obj);    
document.write(descript.prop.enumerable + "<br>");  
document.write(descript.prop.value);   
</script>
</body>
</html>

Output:

true
56
Please Share