Object.getOwnPropertyDescriptor() JavaScript JS

The Javascript Object getOwnPropertyDescriptor() method retrieves a property descriptor for the specified property of the specified object.


Object.getOwnPropertyDescriptor(object, property)

Parameters: object: It represents the object whose property descriptor has to be fetched.

Return: A property descriptor for the specified property.


<!DOCTYPE html>
const obj = { prop: 56 }
const descript = Object.getOwnPropertyDescriptor(obj,'prop');
document.write(descript.enumerable + "<br>");
Please follow and like us:
Content Protection by DMCA.com