Skip to content

Commit c56693b

Browse files
committed
fixes
1 parent 14a882f commit c56693b

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

1-js/02-first-steps/12-while-for/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ while (i) { // when i becomes 0, the condition becomes falsy, and the loop stops
4949
}
5050
```
5151

52-
````smart header="Brackes are not required for a single-line body"
52+
````smart header="Brackets are not required for a single-line body"
5353
If the loop body has a single statement, we can omit the brackets `{…}`:
5454
5555
```js run

1-js/02-first-steps/13-switch/article.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ alert( "I don't know such values" );
9090
```
9191

9292
````smart header="Any expresion can be a `switch/case` argument"
93-
Both `switch` and case allow arbitrary expresions.
93+
Both `switch` and case allow arbitrary expressions.
9494

9595
For example:
9696

@@ -101,14 +101,15 @@ let b = 0;
101101
switch (+a) {
102102
*!*
103103
case b + 1:
104-
alert( 1 );
104+
alert("this runs, because +a is 1, exactly equals b+1");
105105
break;
106106
*/!*
107107

108108
default:
109-
alert('no-no, see the code above, it executes');
109+
alert("this doesn't run");
110110
}
111111
```
112+
Here `+a` gives `1`, that's compared with `b + 1` in `case`, and the corresponding code is executed.
112113
````
113114
114115
## Grouping of "case"
@@ -129,7 +130,7 @@ switch (a) {
129130
case 3: // (*) grouped two cases
130131
case 5:
131132
alert('Wrong!');
132-
alert('Why don't you take a math class?');
133+
alert("Why don't you take a math class?");
133134
break;
134135
*/!*
135136
@@ -144,7 +145,7 @@ The ability to "group" cases a side-effect of how `switch/case` works without `b
144145
145146
## Type matters
146147
147-
Let's emphase that the equality check is always strict. The values must be of the same type to match.
148+
Let's emphasize that the equality check is always strict. The values must be of the same type to match.
148149
149150
For example, let's consider the code:
150151
@@ -169,4 +170,4 @@ switch (arg) {
169170
170171
1. For `0`, `1`, the first `alert` runs.
171172
2. For `2` the second `alert` runs.
172-
3. But for `3`, the result of the `prompt` is a string `"3"`, which is not strictly equal `===` to the number `3`. So we've got a dead code in `case 3`! The `default` variant will execite.
173+
3. But for `3`, the result of the `prompt` is a string `"3"`, which is not strictly equal `===` to the number `3`. So we've got a dead code in `case 3`! The `default` variant will execute.

1-js/02-first-steps/14-function-basics/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ Few examples of breaking this rule:
372372
- `createForm` -- would be bad if it modifies the document, adding a form to it (should only create it and return).
373373
- `checkPermission` -- would be bad if displays the `access granted/denied` message (should only perform the check and return the result).
374374

375-
These examples assume common meanings of prefixes. What they mean for you is determined by you and your team. Maybe it's pretty normal for your code to behave differently. But you should to have a firm understanding what a prefix means, what a prefixed function can and what it can not do. All same-prefixed functions should obey the rules. And the team should share the knowledge.
375+
These examples assume common meanings of prefixes. What they mean for you is determined by you and your team. Maybe it's pretty normal for your code to behave differently. But you should have a firm understanding of what a prefix means, what a prefixed function can and what it cannot do. All same-prefixed functions should obey the rules. And the team should share the knowledge.
376376
```
377377

378378
```smart header="Ultrashort function names"

0 commit comments

Comments
 (0)