Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This else Statements 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 | |
|---|---|---|
| 1} else { ... } | Aelse | |
| 2if (score >= 70) { ... } else { ... } | BWrong - 'else' must be lowercase | |
| 3Acts as the final fallback in a conditional chain | CRuns the else block only if score < 70 | |
| 4Has no condition of its own | DWrong - else never takes a condition in parentheses | |
| 5} Else { console.log("Fail"); } | ERuns when every earlier condition in the chain was false | |
| 6} else (age < 18) { ... } | F} else { |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
else — Runs a block of code when every earlier if or else if condition was false.} else {if (age >= 18) {
} else {
console.log("Minor");
}if (n === 1) {
} else {
console.log("other");
}if (temp > 30) {
} else {
console.log("Cool");
}if (isOpen) {
} else {
console.log("Closed");
}