Skip to content

Latest commit

 

History

History
68 lines (40 loc) · 2.49 KB

javascript-5.md

File metadata and controls

68 lines (40 loc) · 2.49 KB

JavaScript 5

Projected Time

About 90 minutes

  • 10 minutes for video walkthrough of slides
  • 75 minutes for Independent Practice

Prerequisites

"JavaScript 4" lesson

Motivation

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 Teach

  • when to use a switch statement
  • switch syntax

Supplemental Materials

Lesson

JavaScript 5 (Video walkthrough of lesson slides)

  • 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.

JavaScript 5 (slides)

Common Mistakes / Misconceptions

  • You need a break statement at the end of each case.

  • There is no comparison operator in a switch statement, but there is one in the if/else statement

Demonstration

Instructor demonstrates in the video walkthrough how to work with numbers and strings in JavaScript.

Independent Practice

Techtonica staff will assign pairs.

Activity #1
Complete this HackerRank challenge which deals with a simple switch statement.

Activity #2
Refer back to the calculator activity from the JavaScript 1 lesson. Refactor your code to replace your if/else statement(s) with switch statement(s).

Activity #3
Refer back to the movie night activity from the JavaScript 3 lesson. Refactor your code to replace your if/else statement(s) with switch statement(s).

Challenge

Check for Understanding