JS: Object.getOwnPropertySymbols

JS: Object.getOwnPropertySymbols

New in ES2015.

Object.getOwnPropertySymbols ( O )

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 JS: Symbol Tutorial]

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

[see JS: List Properties]

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. CSS
  3. JavaScript
  4. JS Obj Ref
  5. DOM
  6. SVG
  7. Blog