Introduced in ES8, the Object.getOwnPropertyDescriptors() method will return all the property descriptors for a given object. What does that mean exactly? Let's take a look:
const details = { get food1() { return 'tasty'; }, get food2() { return 'bad'; }};Object.getOwnPropertyDescriptors(details);
The output produced is:
{ food1: { configurable: true, enumerable: true, get: function food1(){}, //the getter function set: undefined }, food2: { configurable: true, enumerable: true, get: function food2(){}, //the getter function set: undefined }}