mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-02 03:03:23 -05:00
fix(curriculum): make logical AND/OR step more concise (#49965)
* Fix typos in js logical steps. * Consistency across both pages.
This commit is contained in:
@@ -11,7 +11,7 @@ dashedName: comparisons-with-the-logical-and-operator
|
||||
|
||||
Sometimes you will need to test more than one thing at a time. The <dfn>logical and</dfn> operator (`&&`) returns `true` if and only if the <dfn>operands</dfn> to the left and right of it are true.
|
||||
|
||||
The same effect could be achieved by nesting an if statement inside another if:
|
||||
The same effect could be achieved by nesting an `if` statement inside another `if`.
|
||||
|
||||
```js
|
||||
if (num > 5) {
|
||||
@@ -22,7 +22,7 @@ if (num > 5) {
|
||||
return "No";
|
||||
```
|
||||
|
||||
will only return `Yes` if `num` is greater than `5` and less than `10`. The same logic can be written as:
|
||||
This code will return `Yes` if `num` is greater than `5` and less than `10`. The same logic can be written with the <dfn>logical and</dfn> operator.
|
||||
|
||||
```js
|
||||
if (num > 5 && num < 10) {
|
||||
|
||||
@@ -13,7 +13,7 @@ The <dfn>logical or</dfn> operator (`||`) returns `true` if either of the <dfn>o
|
||||
|
||||
The <dfn>logical or</dfn> operator is composed of two pipe symbols: (`||`). This can typically be found between your Backspace and Enter keys.
|
||||
|
||||
The pattern below should look familiar from prior waypoints:
|
||||
The pattern below should look familiar from prior waypoints.
|
||||
|
||||
```js
|
||||
if (num > 10) {
|
||||
@@ -25,7 +25,7 @@ if (num < 5) {
|
||||
return "Yes";
|
||||
```
|
||||
|
||||
will return `Yes` only if `num` is between `5` and `10` (5 and 10 included). The same logic can be written as:
|
||||
This code will return `Yes` if `num` is between `5` and `10` (`5` and `10` included). The same logic can be written with the <dfn>logical or</dfn> operator.
|
||||
|
||||
```js
|
||||
if (num > 10 || num < 5) {
|
||||
|
||||
Reference in New Issue
Block a user