JavaScript: Object.getOwnPropertySymbols

By Xah Lee. Date: . Last updated: .

New in JS2015.

Object.getOwnPropertySymbols( obj )
Return a array of all own symbol key properties . (including non-enumerable ones).
const x = Symbol("x");
const obj = {};
obj[x] = 3;

console.log( obj[x] ); // 3

// get a array of all symbol key properties
console.log( 
 Object.getOwnPropertySymbols ( obj )
);
// [ Symbol(x) ]

[see Symbol Tutorial]

// get a array of all symbol key properties
console.log( Object.getOwnPropertySymbols ( Array.prototype ) );
// prints
// [ Symbol(Symbol.unscopables), Symbol(Symbol.iterator) ]

[see List Properties]

JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Object Object

prototype