Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This switch Statement worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1switch (day) { | AWrong - case labels need a colon after the value | |
| 2case 3: | BMatches when the switch value equals 3 | |
| 3Stops the code from falling into the next case | CCompares day against each case label | |
| 4Runs when no case value matches | DWrong - 'break' must be lowercase | |
| 5case 1 | Edefault: | |
| 6Break; | Fbreak; |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
switch — Compares a value against multiple case labels and runs the code block for the matching case.switch (day) {case 1:
console.log("Monday");
break;case 2:
console.log("Two");
break;default:
console.log("Fallback");case 5:
console.log("Five");
break;