Skip to content
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

Operators page doesn't mention . or ?. #33215

Open
blmatthews opened this issue Apr 22, 2024 · 4 comments
Open

Operators page doesn't mention . or ?. #33215

blmatthews opened this issue Apr 22, 2024 · 4 comments
Labels
accepting PR Feel free to open a PR to resolve this issue Content:JS JavaScript docs

Comments

@blmatthews
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators

What specific section or headline is this issue about?

Doesn't really fit the existing sections, maybe a new "Chaining operators" section?

What information was incorrect, unhelpful, or incomplete?

The Expressions and operators page doesn't seem to mention . or ?. at all. Elsewhere (for example, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) they're both called operators, so it seems they should be on the operators page. While . is pretty obvious and used in even the introduction, at least for completeness, it should be on the operators page. ?. isn't as obvious and is (relatively) new, so should definitely be there.

Also, ?? is mentioned in the text in the short-circuiting section in the Logical operators section, but not in any of the operator tables.

What did you expect to see?

At least ?. and probably . as well on the operators page.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@blmatthews blmatthews added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Apr 22, 2024
@github-actions github-actions bot added the Content:JS JavaScript docs label Apr 22, 2024
@stephenlf
Copy link

To be clear, you mean calling methods (.), optional chaining (?), and nullish coalescing (??), right?

@blmatthews
Copy link
Author

Maybe I’m confused or I’m using the terminology wrong, but . isn’t calling methods is it? Math.random doesn’t call the random property of the Math object. And isn’t optional chaining ?.? That’s what it says here and here (which I just discovered and does include ?., ??, and ??=, unlike the guide page).

@Josh-Cena
Copy link
Member

?. should be mentioned on this page because it also involves ?.() and ?.[]. ?.property and ?.[] should additionally be mentioned briefly in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_objects#accessing_properties.

@Josh-Cena Josh-Cena added accepting PR Feel free to open a PR to resolve this issue and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 5, 2024
@hamishwillee
Copy link
Collaborator

@blmatthews Would you like to create a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PR Feel free to open a PR to resolve this issue Content:JS JavaScript docs
Projects
None yet
Development

No branches or pull requests

4 participants