Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fc7bfbb

Browse files
Update article.md
1 parent 9c74908 commit fc7bfbb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎1-js/02-first-steps/08-operators/article.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,22 +194,22 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en-U
194194
| Precedence | Name | Sign |
195195
|------------|------|------|
196196
| ... | ... | ... |
197-
| 16 | unary plus | `+` |
198-
| 16 | unary negation | `-` |
199-
| 15 | exponentiation | `**` |
200-
| 14 | multiplication | `*` |
201-
| 14 | division | `/` |
202-
| 13 | addition | `+` |
203-
| 13 | subtraction | `-` |
197+
| 15 | unary plus | `+` |
198+
| 15 | unary negation | `-` |
199+
| 14 | exponentiation | `**` |
200+
| 13 | multiplication | `*` |
201+
| 13 | division | `/` |
202+
| 12 | addition | `+` |
203+
| 12 | subtraction | `-` |
204204
| ... | ... | ... |
205-
| 3 | assignment | `=` |
205+
| 2 | assignment | `=` |
206206
| ... | ... | ... |
207207

208-
As we can see, the "unary plus" has a priority of `16` which is higher than the `13` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
208+
As we can see, the "unary plus" has a priority of `15` which is higher than the `13` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
209209
210210
## Assignment
211211
212-
Let's note that an assignment `=` is also an operator. It is listed in the precedence table with the very low priority of `3`.
212+
Let's note that an assignment `=` is also an operator. It is listed in the precedence table with the very low priority of `2`.
213213

214214
That's why, when we assign a variable, like `x = 2 * 2 + 1`, the calculations are done first and then the `=` is evaluated, storing the result in `x`.
215215

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /