javascript-tutorial / javascript-tutorial/en.javascript.info

Misleading Explanation About Comma Operator Precedence

未關閉
#3,667 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
HTML
星號
25.5k
分支
4k
PR 合併指標
30 天內沒有已合併 PR

描述

Hi there,

I've come across a section in the documentation (https://javascript.info/operators#comma) that explains the precedence of the comma operator.
image

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.
image

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!

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

查看 issue 中連結的逗號運算子部分,並根據 JavaScript 的運算子優先順序和評估行為驗證範例。釐清說明,使文件中記載的結果和指派行為明確無歧義,然後確認修訂後的文字與該語言的行為一致。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript
領域
documentation
Issue 類型
文件
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。