-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error in the code snippet for Symbol #33765
Conversation
The written instruction above the snippet says "Note that Symbol("foo") does not coerce the string "foo" into a Symbol." but the code snippet illustrates "Symbol("foo") === Symbol("foo"); // false" The intention seemed to have been "Symbol("foo") === "foo"; // false"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Also, congratulations on your first merged MDN content PR. Welcome to the team!
@estelle the previous content is correct. It is a demonstration for the following sentence: It creates a new symbol each time, because the result of the comparison is false. If a string has a unique coercion to a symbol then the result should be true (and indeed that's what I'm traveling this week, but I'll be happy if either of y'all could have a reverting PR ASAP; I will review it. Just so I don't forget to do it when I come back. |
reverted in #33782 |
* upstream/main: (55 commits) Replace `.` with `#` in example given selectors are `#ids` (mdn#33791) update info in cross browser testing strategies (mdn#33730) Clarify that `navigator.storage.persist()` depends on heuristics (mdn#33780) fix typo (mdn#33785) feat: improvements on Glossary/Hoisting (mdn#33787) CSS update: overview of shapes guide (mdn#33771) CSS update: Shapes from box values (mdn#33770) Fix issue 033506: correct droppedEntriesCount (mdn#33538) Revert "=== Symbol("foo")" (mdn#33782) docs(css): FF126 - Support for `shape()` function (mdn#33446) Bump lint-staged from 15.2.4 to 15.2.5 (mdn#33777) Bump ajv from 8.13.0 to 8.14.0 (mdn#33776) Add missing spaces for `subtlecrypto` (mdn#33774) fix: typo in `color_and_luminca` (mdn#33775) feat: improvments on gutters (mdn#33751) FF127Relnote- data: and javascript: URLS forbidden in base HREF (mdn#33738) update the content of SVG `<view>` element (mdn#33710) Clipboard.write() - log and fixes (mdn#33769) updated ClipboardItem and Clipboard documentation and examples using … (mdn#33262) Fix error in the code snippet for Symbol (mdn#33765) ...
My apologies, @estelle and @Josh-Cena . I realize that I mistakenly treated I now see the distinction between the two more clearly, based on what @Josh-Cena had commented, and based on the later section in the same doc:
I'm glad the error I introduced was reverted right away. Thank you and apologies again. One suggestion I have though, is somehow clarifying this statement a bit further:
Perhaps I'm a bit slow-witted than most other readers, but I think appending a clause like this might've clarified things for me a bit sooner:
|
Motivation
Correct the code snippet for demonstrating how a string won't get coerced into a symbol.
Additional details
In the reference doc for Symbol, under description section, the explanation above one of the snippet says:
However, the code snippet says:
Executing this statement in the Firefox dev console yields
true
notfalse
as the code snippet states:I'm guessing that the code snippet was intended to be:
Testing this new statement in the dev console:
Related issues and pull requests