From b29923405f80940a58ea18b4fcbdb6453823bd03 Mon Sep 17 00:00:00 2001 From: "Ruthie (they/them)" <102179075+mx-ruthie@users.noreply.github.com> Date: Mon, 30 Jan 2023 20:33:15 -0600 Subject: [PATCH] Update javascript-5-switch.md revised the challenges sections, removed projected time, inserted weekly questions keywords --- javascript/javascript-5-switch.md | 36 +++++++------------------------ 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/javascript/javascript-5-switch.md b/javascript/javascript-5-switch.md index f33777c52..c05ef2e90 100644 --- a/javascript/javascript-5-switch.md +++ b/javascript/javascript-5-switch.md @@ -1,12 +1,12 @@ # JavaScript 5 - Switch Statements -### Projected Time +### Week 3 Keywords and Questions -About 60 minutes +- What is a switch statement, when would I use one? +- Why a switch statement over an if/else? +- What is the syntax of a switch statement? +- What is the “break” part of a switch statement, and what will happen if no break statement is used? -- 15 minutes for lesson -- 30 minutes for Independent Practice -- 15 minutes for Check for Understanding ### Prerequisites @@ -16,12 +16,6 @@ About 60 minutes JavaScript is used on the frontend of almost every website. It's also a widely-used scripting language that be used on the backend as well. The JavaScript lessons set a solid foundation in JavaScript basics so we can use the language in more robust ways in later lessons. -### Objectives - -**Participants will be able to:** - -- Know when to use a switch statement instead of an if/else statement -- Write a switch statement using proper syntax ### Specific Things to Learn @@ -32,10 +26,6 @@ JavaScript is used on the frontend of almost every website. It's also a widely-u [JavaScript 5 (Video walkthrough of lesson slides)](https://drive.google.com/file/d/1x5U0jFgEZD-NjOnfoZ_mkYZpXoODbMIS/view?usp=sharing) -- Please watch the video the first time without working along with the demonstration. Just absorb the concepts. Then, you can watch the demonstration a second time and code with the instructor if you like. - -### Materials - [JavaScript 5 - Switch Statements (slides)](https://docs.google.com/presentation/d/1hmP5pOfrgexspDS827_cGkb3SNqhIJnbxrlnRFcHCGw/edit?usp=sharing) ### Common Mistakes / Misconceptions @@ -44,13 +34,6 @@ JavaScript is used on the frontend of almost every website. It's also a widely-u - **There is no comparison operator in a switch statement, but there is one in the if/else statement** -### Independent Practice - -Refer back to the [calculator activity](../javascript/javascript-1-variables.md#independent-practice) from the JavaScript 1 lesson. Refactor your code to replace your if/else statement(s) with switch statement(s). - -### Challenges - -Refer back to the [movie night activity](../javascript/javascript-3-conditionals.md#independent-practice) from the JavaScript 3 lesson. Refactor your code to replace your if/else statement(s) with switch statement(s). ### Supplemental Materials @@ -59,14 +42,11 @@ Refer back to the [movie night activity](../javascript/javascript-3-conditionals - [JavaScript switch statements (video)](https://www.youtube.com/watch?v=Z6O_XdfCBEo) - [Switch statement docs (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch) -### Check for Understanding +### Additional Challenges -- Write down the syntax of a switch statement in JavaScript. -- What will happen if break is not used in a switch statement? -- What is the advantage of using a switch statement over an if/else statement? -- Using a switch statement, write a program to accept a lower case letter. Create an alert with the text 'This letter is a vowel' if the letter is a vowel. +If you have previously completed it, refer back to the [calculator activity](../javascript/javascript-1-variables.md#independent-practice) from the JavaScript 1 lesson. Refactor your code to replace your if/else statement(s) with switch statement(s). -### Extensions +If you have previously completed it, refer back to the [movie night activity](../javascript/javascript-3-conditionals.md#independent-practice) from the JavaScript 3 lesson. Refactor your code to replace your if/else statement(s) with switch statement(s). Complete these HackerRank Challenges: