JavaScript: Get property descriptors of object
10 April 2023 (Updated 12 April 2025)
const obj = {
name: "John",
age: 30
}
const propertyDescriptors = Object.getOwnPropertyDescriptors(obj)
console.log(propertyDescriptors)
Output:

Sources
Tagged:
JavaScript recipes
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment