MENU
Accessibility
The following illustrates which statements/methods ignore Symbols and which do not.
var o = {a: 10};
var s = Symbol();
o[s] = 20;
// What ignore symbols:
for (p in o) console.log(o[p]);
console.log(JSON.stringify(o));
console.log(Object.entries(o));
console.log(Object.keys(o));
console.log(Object.values(o));
console.log(Object.getOwnPropertyNames(o));
// What do not ignore symbols:
console.log(s in o);
console.log(o.hasOwnProperty(s));
console.log(Object.getOwnPropertySymbols(o));
console.log(Object.getOwnPropertyDescriptor(o, s));
console.log(Object.getOwnPropertyDescriptors(o));10
{"a":10}
[["a",10],...]
["a"]
[10]
["a"]
true
true
[Symbol()]
{value: 20, writable: true, enumerable: true, configurable: true}
{a: Object, Symbol(): Object}