...

/

Object.getOwnPropertyDescriptors

Object.getOwnPropertyDescriptors

the behavior of value, writable, get, set, configurable and enumerable

We'll cover the following...

Object.getOwnPropertyDescriptors returns all property descriptors of its first argument:

Press + to interact
let player = {
cards: [ 'Ah', 'Qc' ],
chips: 1000
};
let descriptors =
Object.getOwnPropertyDescriptors( player );
console.log( descriptors );
console.log();
console.log( descriptors.cards );

Object.getOwnPropertyDescriptors returns all property descriptors in an object with the same keys as the keys of the original object. The following four property descriptors are returned (source: ...