Skip to content

Symbol.for accepting string #4945

Answered by Trott
fedeci asked this question in Q&A
Jun 8, 2022 · 0 comment · 1 reply
Discussion options

You must be logged in to vote

The first step in the algorithm in the spec section you link to is to convert key to a string value.

  1. Let stringKey be ? ToString(key).

Symbol.for() is implemented in V8, not in Node.js code. So, if there was a bug, it needs to be opened against V8.

That said, this does not appear to be a bug. The Firefox REPL exhibits the same behavior. So does the Chrome REPL. And the spec seems to indicate that key should be converted to a string.

Replies: 0 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Trott
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants