-
Notifications
You must be signed in to change notification settings - Fork 22.4k
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
equivalence of x &&= y and x && ( x = y ) #29524
Comments
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR_assignment
has the same issue |
Yep, these three pages share the same structure, and I have a script to check that. So whoever updates one of them will be reminded by me that the rest should be updated (or if the PR is merged by someone else ahead of me, I can send a followup) Actually I think this should be mentioned on every single compound assignment page: |
Hi @Josh-Cena, I would like to work on this issue. I believe the fix is that the documentation should specify that x or whichever variable comes first is only run once, right? |
On all compound assignment operator pages, there is a sentence like:
Your job is to make it read:
|
Hi @Josh-Cena, can I work on this issue?? |
No need to ask. If anyone wants to send a PR, please do it right away. |
Personally, I think it is better to use |
@skyclouds2001 they mean different things. The paragraph below are exactly to illustrate why |
* equivalence of x &&= y and x && ( x = y ) #29524 * Equivalence of operators * Delete .vscode/settings.json * Apply suggestions from code review --------- Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
MDN URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND_assignment
What specific section or headline is this issue about?
Description
What information was incorrect, unhelpful, or incomplete?
Worth mentioning that x &&= y is equivalent to x && ( x = y ) except that x is only evaluated once.
What did you expect to see?
Elaboration that x is evaluated only once in x &&= y.
Do you have any supporting links, references, or citations?
Caveat that in x &&= y, x is evaluated only once, contrary to x && ( x = y ).
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/javascript/reference/operators/logical_and_assignment
The text was updated successfully, but these errors were encountered: