fix(curriculum): add result of comparison expression evaluation to the inline comment (#45224)
* Add result of comparison expression evaluation in the inline comment #45183 * Apply suggestions from code review thanks! Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com> Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>pull/45229/head
parent
2586503f9c
commit
ea416b6dc2
|
@ -25,14 +25,12 @@ function equalityTest(myVal) {
|
|||
If `myVal` is equal to `10`, the equality operator returns `true`, so the code in the curly braces will execute, and the function will return `Equal`. Otherwise, the function will return `Not Equal`. In order for JavaScript to compare two different <dfn>data types</dfn> (for example, `numbers` and `strings`), it must convert one type to another. This is known as Type Coercion. Once it does, however, it can compare terms as follows:
|
||||
|
||||
```js
|
||||
1 == 1
|
||||
1 == 2
|
||||
1 == '1'
|
||||
"3" == 3
|
||||
1 == 1 // true
|
||||
1 == 2 // false
|
||||
1 == '1' // true
|
||||
"3" == 3 // true
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `true`, `false`, `true`, and `true`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the equality operator to the indicated line so that the function will return the string `Equal` when `val` is equivalent to `12`.
|
||||
|
|
|
@ -16,14 +16,12 @@ Like the equality operator, the greater than operator will convert data types of
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
5 > 3
|
||||
7 > '3'
|
||||
2 > 3
|
||||
'1' > 9
|
||||
5 > 3 // true
|
||||
7 > '3' // true
|
||||
2 > 3 // false
|
||||
'1' > 9 // false
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `true`, `true`, `false`, and `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the greater than operator to the indicated lines so that the return statements make sense.
|
||||
|
|
|
@ -16,14 +16,12 @@ Like the equality operator, the greater than or equal to operator will convert d
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
6 >= 6
|
||||
7 >= '3'
|
||||
2 >= 3
|
||||
'7' >= 9
|
||||
6 >= 6 // true
|
||||
7 >= '3' // true
|
||||
2 >= 3 // false
|
||||
'7' >= 9 // false
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `true`, `true`, `false`, and `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the greater than or equal to operator to the indicated lines so that the return statements make sense.
|
||||
|
|
|
@ -14,15 +14,13 @@ The inequality operator (`!=`) is the opposite of the equality operator. It mean
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
1 != 2
|
||||
1 != "1"
|
||||
1 != '1'
|
||||
1 != true
|
||||
0 != false
|
||||
1 != 2 // true
|
||||
1 != "1" // false
|
||||
1 != '1' // false
|
||||
1 != true // false
|
||||
0 != false // false
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `true`, `false`, `false`, `false`, and `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the inequality operator `!=` in the `if` statement so that the function will return the string `Not Equal` when `val` is not equivalent to `99`.
|
||||
|
|
|
@ -14,15 +14,13 @@ The less than operator (`<`) compares the values of two numbers. If the number t
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
2 < 5
|
||||
'3' < 7
|
||||
5 < 5
|
||||
3 < 2
|
||||
'8' < 4
|
||||
2 < 5 // true
|
||||
'3' < 7 // true
|
||||
5 < 5 // false
|
||||
3 < 2 // false
|
||||
'8' < 4 // false
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `true`, `true`, `false`, `false`, and `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the less than operator to the indicated lines so that the return statements make sense.
|
||||
|
|
|
@ -14,15 +14,13 @@ The less than or equal to operator (`<=`) compares the values of two numbers. If
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
4 <= 5
|
||||
'7' <= 7
|
||||
5 <= 5
|
||||
3 <= 2
|
||||
'8' <= 4
|
||||
4 <= 5 // true
|
||||
'7' <= 7 // true
|
||||
5 <= 5 // true
|
||||
3 <= 2 // false
|
||||
'8' <= 4 // false
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `true`, `true`, `true`, `false`, and `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the less than or equal to operator to the indicated lines so that the return statements make sense.
|
||||
|
|
|
@ -16,12 +16,10 @@ If the values being compared have different types, they are considered unequal,
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
3 === 3
|
||||
3 === '3'
|
||||
3 === 3 // true
|
||||
3 === '3' // false
|
||||
```
|
||||
|
||||
These conditions would return `true` and `false` respectively.
|
||||
|
||||
In the second example, `3` is a `Number` type and `'3'` is a `String` type.
|
||||
|
||||
# --instructions--
|
||||
|
|
|
@ -14,13 +14,11 @@ The strict inequality operator (`!==`) is the logical opposite of the strict equ
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
3 !== 3
|
||||
3 !== '3'
|
||||
4 !== 3
|
||||
3 !== 3 // false
|
||||
3 !== '3' // true
|
||||
4 !== 3 // true
|
||||
```
|
||||
|
||||
In order, these expressions would evaluate to `false`, `true`, and `true`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the strict inequality operator to the `if` statement so the function will return the string `Not Equal` when `val` is not strictly equal to `17`
|
||||
|
|
Loading…
Reference in New Issue