Standard built-ins

Object.getOwnPropertyDescriptors()

Try the free JavaScript compiler

Returns an object mapping all own keys, including symbols and non-enumerable keys, to descriptor objects.

Formal Syntax & Structure

javascript syntaxjavascript
Object.getOwnPropertyDescriptors(obj)

Parameters & Attributes

NameTypeDescription
objObjectTarget object.

Return Value

Object

Mapping of descriptors.

Working Example

Example Snippetjavascript
const o={};Object.defineProperty(o,"id",{value:4});console.log(Object.getOwnPropertyDescriptors(o).id.value);
JavaScript Reference