javascript-tutorial / javascript-tutorial/en.javascript.info
Misleading Explanation About Comma Operator Precedence
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 25.5k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I've come across a section in the documentation (https://javascript.info/operators#comma) that explains the precedence of the comma operator.
However, it seems to have an error in its explanation. The example provided suggests that a = 1 + 2, 3 + 4 should result in a being assigned the value 3, whereas in reality, it correctly returns 7.
I believe this discrepancy could lead to confusion among learners, and the explanation might need clarification to reflect the actual behavior of the comma operator. Thank you for your attention to this matter!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the comma operator section linked in the issue and verify the example against JavaScript's operator precedence and evaluation behavior. Clarify the explanation so the documented result and assignment behavior are unambiguous, then confirm the revised text matches the language behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100