I need to iterate through an object that has Symbols for keys. The following code returns an empty array.
const FOO = Symbol('foo');
const BAR = Symbol('bar');
const obj = {
[FOO]: 'foo',
[BAR]: 'bar',
}
Object.values(obj)
How can I iterate the values in obj
so that I get ['foo', 'bar']
?
Object.getOwnPropertySymbols(obj)
– Shahaptian