Skip to content

Commit 2aad40b

Browse files
authored
Merge pull request #2134 from vsemozhetbyt/1.2.11
Address some possible issues in 1.2.11
2 parents 5c388dd + 64f3015 commit 2aad40b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

1-js/02-first-steps/11-logical-operators/6-check-if-in-range/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ importance: 3
44

55
# Check the range between
66

7-
Write an "if" condition to check that `age` is between `14` and `90` inclusively.
7+
Write an `if` condition to check that `age` is between `14` and `90` inclusively.
88

99
"Inclusively" means that `age` can reach the edges `14` or `90`.

1-js/02-first-steps/11-logical-operators/7-check-if-out-range/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ importance: 3
44

55
# Check the range outside
66

7-
Write an `if` condition to check that `age` is NOT between 14 and 90 inclusively.
7+
Write an `if` condition to check that `age` is NOT between `14` and `90` inclusively.
88

99
Create two variants: the first one using NOT `!`, the second one -- without it.

1-js/02-first-steps/11-logical-operators/9-check-login/solution.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
```js run demo
44
let userName = prompt("Who's there?", '');
55

6-
if (userName == 'Admin') {
6+
if (userName === 'Admin') {
77

88
let pass = prompt('Password?', '');
99

10-
if (pass == 'TheMaster') {
10+
if (pass === 'TheMaster') {
1111
alert( 'Welcome!' );
12-
} else if (pass == '' || pass == null) {
12+
} else if (pass === '' || pass === null) {
1313
alert( 'Canceled' );
1414
} else {
1515
alert( 'Wrong password' );
1616
}
1717

18-
} else if (userName == '' || userName == null) {
18+
} else if (userName === '' || userName === null) {
1919
alert( 'Canceled' );
2020
} else {
2121
alert( "I don't know you" );

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The OR `||` operator does the following:
8484

8585
A value is returned in its original form, without the conversion.
8686

87-
In other words, a chain of OR `"||"` returns the first truthy value or the last one if no truthy value is found.
87+
In other words, a chain of OR `||` returns the first truthy value or the last one if no truthy value is found.
8888

8989
For instance:
9090

@@ -101,9 +101,9 @@ This leads to some interesting usage compared to a "pure, classical, boolean-onl
101101

102102
1. **Getting the first truthy value from a list of variables or expressions.**
103103

104-
For instance, we have `firstName`, `lastName` and `nickName` variables, all optional.
104+
For instance, we have `firstName`, `lastName` and `nickName` variables, all optional (i.e. can be undefined or have falsy values).
105105

106-
Let's use OR `||` to choose the one that has the data and show it (or `anonymous` if nothing set):
106+
Let's use OR `||` to choose the one that has the data and show it (or `"Anonymous"` if nothing set):
107107

108108
```js run
109109
let firstName = "";
@@ -115,7 +115,7 @@ This leads to some interesting usage compared to a "pure, classical, boolean-onl
115115
*/!*
116116
```
117117

118-
If all variables were falsy, `Anonymous` would show up.
118+
If all variables were falsy, `"Anonymous"` would show up.
119119

120120
2. **Short-circuit evaluation.**
121121

@@ -223,7 +223,7 @@ The precedence of AND `&&` operator is higher than OR `||`.
223223
So the code `a && b || c && d` is essentially the same as if the `&&` expressions were in parentheses: `(a && b) || (c && d)`.
224224
````
225225
226-
````warn header="Don't replace `if` with || or &&"
226+
````warn header="Don't replace `if` with `||` or `&&`"
227227
Sometimes, people use the AND `&&` operator as a "shorter way to write `if`".
228228
229229
For instance:
@@ -244,7 +244,7 @@ let x = 1;
244244
if (x > 0) alert( 'Greater than zero!' );
245245
```
246246
247-
Although, the variant with `&&` appears shorter, `if` is more obvious and tends to be a little bit more readable. So we recommend using every construct for its purpose: use `if` if we want if and use `&&` if we want AND.
247+
Although, the variant with `&&` appears shorter, `if` is more obvious and tends to be a little bit more readable. So we recommend using every construct for its purpose: use `if` if we want `if` and use `&&` if we want AND.
248248
````
249249
250250

0 commit comments

Comments
 (0)