Skip to content

Commit 9d01019

Browse files
committed
minor
1 parent d2e7804 commit 9d01019

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: 1-js/02-first-steps/07-operators/article.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ Why are unary pluses applied to values before the binary ones? As we're going to
127127
128128
## Operator precedence
129129
130-
If an expression has more than one operator, the execution order is defined by their *precedence*, or, in other words, the implicit priority order of operators.
130+
If an expression has more than one operator, the execution order is defined by their *precedence*, or, in other words, the default priority order of operators.
131131
132132
From school, we all know that the multiplication in the expression `1 + 2 * 2` should be calculated before the addition. That's exactly the precedence thing. The multiplication is said to have *a higher precedence* than the addition.
133133

134-
Parentheses override any precedence, so if we're not satisfied with the implicit order, we can use them to change it. For example: `(1 + 2) * 2`.
134+
Parentheses override any precedence, so if we're not satisfied with the default order, we can use them to change it. For example, write `(1 + 2) * 2`.
135135
136136
There are many operators in JavaScript. Every operator has a corresponding precedence number. The one with the larger number executes first. If the precedence is the same, the execution order is from left to right.
137137
@@ -199,9 +199,9 @@ alert( a ); // 3
199199
alert( c ); // 0
200200
```
201201
202-
In the example above, the result of `(a = b + 1)` is the value which is assigned to `a` (that is `3`). It is then used to subtract from `3`.
202+
In the example above, the result of expression `(a = b + 1)` is the value which was assigned to `a` (that is `3`). It is then used for further evaluations.
203203
204-
Funny code, isn't it? We should understand how it works, because sometimes we see it in 3rd-party libraries, but shouldn't write anything like that ourselves. Such tricks definitely don't make code clearer or readable.
204+
Funny code, isn't it? We should understand how it works, because sometimes we see it in JavaScript libraries, but shouldn't write anything like that ourselves. Such tricks definitely don't make code clearer or readable.
205205
````
206206

207207
## Remainder %
@@ -427,10 +427,10 @@ Here, the first expression `1 + 2` is evaluated and its result is thrown away. T
427427
```smart header="Comma has a very low precedence"
428428
Please note that the comma operator has very low precedence, lower than `=`, so parentheses are important in the example above.
429429
430-
Without them: `a = 1 + 2, 3 + 4` evaluates `+` first, summing the numbers into `a = 3, 7`, then the assignment operator `=` assigns `a = 3`, and finally the number after the comma, `7`, is not processed so it's ignored.
430+
Without them: `a = 1 + 2, 3 + 4` evaluates `+` first, summing the numbers into `a = 3, 7`, then the assignment operator `=` assigns `a = 3`, and the rest is ignored. It's like `(a = 1 + 2), 3 + 4`.
431431
```
432432
433-
Why do we need an operator that throws away everything except the last part?
433+
Why do we need an operator that throws away everything except the last expression?
434434
435435
Sometimes, people use it in more complex constructs to put several actions in one line.
436436
@@ -443,4 +443,4 @@ for (*!*a = 1, b = 3, c = a * b*/!*; a < 10; a++) {
443443
}
444444
```
445445
446-
Such tricks are used in many JavaScript frameworks. That's why we're mentioning them. But, usually, they don't improve code readability so we should think well before using them.
446+
Such tricks are used in many JavaScript frameworks. That's why we're mentioning them. But usually they don't improve code readability so we should think well before using them.

0 commit comments

Comments
 (0)