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) ]
// get a array of all symbol key properties
console.log( Object.getOwnPropertySymbols ( Array.prototype ) );
// prints
// [ Symbol(Symbol.unscopables), Symbol(Symbol.iterator) ]
BUY
ΣJS
JavaScript in Depth

JS Obj Reference

Object Object

prototype