ES proposal: Object.getOwnPropertyDescriptors()
The ECMAScript proposal “ Object.getOwnPropertyDescriptors() ” by Jordan Harband and Andrea Giammarchi is part of ECMAScript 2017 . This blog post explains it. Overview Object.getOwnPropertyDescriptors(obj) accepts an object obj and returns an object result : For each own (non-inherited) property of obj , it adds a property to result whose key is the same and whose value is the the former property’s descriptor . Property descriptors describe the attributes of a property (its value, whether it is writable, etc.). For more information, consult Sect. “ Property Attributes and Property Descriptors ” in “Speaking JavaScript”. This is an example of using Object.getOwnPropertyDescriptors() : const obj = { [Symbol('foo')]: 123, get bar() { return 'abc' }, }; console.log(Object.getOwnPropertyDescriptors(obj)); // Output: // { [Symbol('foo')]: // { value: 123, // writable: true, // enumerable: true, ...