rse / es6-features

ECMAScript 6: Feature Overview & Comparison

Home Page: https://rse.github.io/es6-features/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in Symbol Type example

bamoqi opened this issue · comments

In http://es6-features.org/#SymbolType
Object.getOwnPropertySymbols(obj) // [ foo, bar ]
Should be
Object.getOwnPropertySymbols(obj) // [ Symbol(), Symbol() ]

In http://es6-features.org/#GlobalSymbols
shoud be
Object.getOwnPropertySymbols(obj) // [ Symbol(app.foo), Symbol(app.bar) ]

Sorry for the dump question, but WHY? Your [ Symbol(), Symbol() ] represents an array of completely new symbols but getOwnPropertySymbols returns an array of exactly the symbols one placed as keys into the object AFAIK. That's what I wanted to express with [ foo, bar ] because these are the constants the symbols were assigned to beforehand in the examples. Why is this wrong?

Yes now I see it is correct. I misunderstood that you meant to show the printed representation of the array, which would be [ Symbol(), Symbol() ] . Sorry for the wrong report and not communicating clearly.