Clarify precedence of comma operator in article and add missing "let"…#3974
Clarify precedence of comma operator in article and add missing "let"…#3974Lk-ux wants to merge 1 commit into
Conversation
… keyword in code example
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05e2db28d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ```js | ||
| // three operations in one line | ||
| for (*!*a = 1, b = 3, c = a * b*/!*; a < 10; a++) { | ||
| for (*!*let a = 1, b = 3, c = a * b*/!*; a < 10; a++) { |
There was a problem hiding this comment.
Keep the loop initializer as a comma expression
Adding let changes this initializer from a comma expression into a lexical declaration containing three declarators, where the commas are separators rather than instances of the comma operator. Consequently, the section's final example no longer demonstrates the operator it claims frameworks use; declare the variables separately and retain the assignment expression in the initializer, or otherwise use an actual comma expression here.
Useful? React with 👍 / 👎.
… keyword in code example