Skip to content

Commit 7890fb8

Browse files
authored
Moar spaces in 07-operators.
Added moar spaces to 07-operators.
1 parent 66145f5 commit 7890fb8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ This notation can be shortened using operators `+=` and `*=`:
381381
382382
```js run
383383
let n = 2;
384-
n += 5; // now n=7 (same as n = n + 5)
385-
n *= 2; // now n=14 (same as n = n * 2)
384+
n += 5; // now n = 7 (same as n = n + 5)
385+
n *= 2; // now n = 14 (same as n = n * 2)
386386
387387
alert( n ); // 14
388388
```
@@ -409,18 +409,18 @@ For example:
409409
410410
```js run
411411
*!*
412-
let a = (1+2, 3+4);
412+
let a = (1 + 2, 3 + 4);
413413
*/!*
414414
415-
alert( a ); // 7 (the result of 3+4)
415+
alert( a ); // 7 (the result of 3 + 4)
416416
```
417417
418-
Here, the first expression `1+2` is evaluated, and its result is thrown away, then `3+4` is evaluated and returned as the result.
418+
Here, the first expression `1 + 2` is evaluated, and its result is thrown away, then `3 + 4` is evaluated and returned as the result.
419419
420420
```smart header="Comma has a very low precedence"
421421
Please note that the comma operator has very low precedence, lower than `=`, so parentheses are important in the example above.
422422
423-
Without them: `a=1+2,3+4` evaluates `+` first, summing the numbers into `a=3,7`, then the assignment operator `=` assigns `a=3`, and then the number after the comma `7` is not processed anyhow, so it's ignored.
423+
Without them: `a = 1 + 2, 3 + 4` evaluates `+` first, summing the numbers into `a = 3, 7`, then the assignment operator `=` assigns `a = 3`, and then the number after the comma `7` is not processed anyhow, so it's ignored.
424424
```
425425
426426
Why do we need such an operator which throws away everything except the last part?

0 commit comments

Comments
 (0)