Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This If 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 | |
|---|---|---|
| 1if (age >= 12) { ... } | A{ } | |
| 2if (score > 50) { ... } | BRuns the block only if age is 12 or more | |
| 3Wraps the condition being tested | CRuns the block only if score is greater than 50 | |
| 4Wraps the code that runs when the condition is true | DWrong - the condition needs parentheses | |
| 5if age >= 12 { console.log("Hi"); } | EWrong - use === for comparison, not = for assignment | |
| 6if (x = 5) { console.log(x); } | F( ) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
if — Runs a block of code only when the condition inside its parentheses is true.if (age >= 12) {if (score > 50) {if (name === "Sam") {if (isReady) {
console.log("Go");
}if (temp < 0) {