Skip to content

Commit f9ad719

Browse files
authored
Fix Typo in logical operators
true || alert("printed") false || alert("not printed") This is confusing to a student as the first won't be printed, but the second will print "not printed". I've reversed it to this so it makes much more sense to a learner: true || alert("not printed") false || alert("printed")
1 parent 24224dc commit f9ad719

File tree

1 file changed

+2
-2
lines changed
  • 1-js/02-first-steps/11-logical-operators

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ This leads to some interesting usage compared to a "pure, classical, boolean-onl
128128
In the example below, the first message is printed, while the second is not:
129129
130130
```js run no-beautify
131-
*!*true*/!* || alert("printed");
132-
*!*false*/!* || alert("not printed");
131+
*!*true*/!* || alert("not printed");
132+
*!*false*/!* || alert("printed");
133133
```
134134
135135
In the first line, the OR `||` operator stops the evaluation immediately upon seeing `true`, so the `alert` isn't run.

0 commit comments

Comments
 (0)