JS: 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 ss = Symbol("ss");
const jj = {};
jj[ss] = 3;

console.log(jj[ss] === 3);

/* get a array of all symbol key properties */
console.log(Object.getOwnPropertySymbols(jj));
/* Symbol(ss) */
/* 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

JavaScript, List Object Properties (to Array)