From ea416b6dc25b59b8e4f745ff976202fc35a3f83f Mon Sep 17 00:00:00 2001 From: HenMoshe <91905102+HenMoshe@users.noreply.github.com> Date: Wed, 23 Feb 2022 19:58:42 +0200 Subject: [PATCH] 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 Co-authored-by: Naomi Carrigan --- .../comparison-with-the-equality-operator.md | 10 ++++------ .../comparison-with-the-greater-than-operator.md | 10 ++++------ ...son-with-the-greater-than-or-equal-to-operator.md | 10 ++++------ .../comparison-with-the-inequality-operator.md | 12 +++++------- .../comparison-with-the-less-than-operator.md | 12 +++++------- ...arison-with-the-less-than-or-equal-to-operator.md | 12 +++++------- .../comparison-with-the-strict-equality-operator.md | 6 ++---- ...comparison-with-the-strict-inequality-operator.md | 8 +++----- 8 files changed, 32 insertions(+), 48 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 7a1df6b20c5..8ef2dc27b8e 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -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 data types (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`. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 63f28cd07aa..544d9f86fdb 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -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. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index a4933c2f84f..3c0c64a793b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -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. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index c148479b6e5..c8260cfe2fe 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -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`. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 578b5b80ee1..8b7c5158fd8 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -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. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 0bc8945dc88..55db0c27c7a 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -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. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 1aa8b25fe72..d0d14f64778 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -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-- diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 4ab65c634bd..9d2266e4636 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -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`