diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 4f3f5a22701..8da0d106e95 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -2590,7 +2590,8 @@ "review-javascript-comparisons-and-conditionals": { "title": "JavaScript Comparisons and Conditionals Review", "intro": [ - "Review the JavaScript Comparisons and Conditionals concepts to prepare for the upcoming quiz." + "Before you are quizzed on working with conditionals, you first need to review.", + "Open up this page to review how to work with switch statements, other types of conditionals and more." ] }, "quiz-javascript-comparisons-and-conditionals": { diff --git a/curriculum/challenges/english/25-front-end-development/review-javascript-comparisons-and-conditionals/6723c554025f449f4f39c3f5.md b/curriculum/challenges/english/25-front-end-development/review-javascript-comparisons-and-conditionals/6723c554025f449f4f39c3f5.md index 1aa8566273c..0c66d51a192 100644 --- a/curriculum/challenges/english/25-front-end-development/review-javascript-comparisons-and-conditionals/6723c554025f449f4f39c3f5.md +++ b/curriculum/challenges/english/25-front-end-development/review-javascript-comparisons-and-conditionals/6723c554025f449f4f39c3f5.md @@ -9,7 +9,56 @@ dashedName: review-javascript-comparisons-and-conditionals Review the concepts below to prepare for the upcoming quiz. +## Comparisons and the `null` and `undefined` Data Types +- **Comparisons and `undefined`**: A variable is `undefined` when it has been declared but hasn't been assigned a value. It's the default value of uninitialized variables and function parameters that weren't provided an argument. `undefined` converts to `NaN` in numeric contexts, which makes all numeric comparisons with `undefined` return `false`. + +```js +console.log(undefined > 0); // false +console.log(undefined < 0); // false +console.log(undefined == 0); // false +``` + +- **Comparisons and `null`**: The `null` type represents the intentional absence of a value. When using the equality operator, `null` and `undefined` are considered equal. However, when using the strict equality operator (`===`), which checks both value and type without performing type coercion, `null` and `undefined` are not equal: + +```js +console.log(null == undefined); // true +console.log(null === undefined); // false +``` + +## `switch` Statements + +- **Definition**: A `switch` statement evaluates an expression and matches its value against a series of `case` clauses. When a match is found, the code block associated with that case is executed. + +```js +const dayOfWeek = 3; + +switch (dayOfWeek) { + case 1: + console.log("It's Monday! Time to start the week strong."); + break; + case 2: + console.log("It's Tuesday! Keep the momentum going."); + break; + case 3: + console.log("It's Wednesday! We're halfway there."); + break; + case 4: + console.log("It's Thursday! Almost the weekend."); + break; + case 5: + console.log("It's Friday! The weekend is near."); + break; + case 6: + console.log("It's Saturday! Enjoy your weekend."); + break; + case 7: + console.log("It's Sunday! Rest and recharge."); + break; + default: + console.log("Invalid day! Please enter a number between 1 and 7."); +} +``` # --assignment--