Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
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 | |
|---|---|---|
| 1let score = 0; | AThree statements are squashed onto one line. Put one statement per line so the code is easier to read. | |
| 2console.log(score); | BOne statement: a single instruction on its own line, ended with a semicolon | |
| 3Write one statement per line, with a semicolon at the end of each | Clet lives = 3; lives = lives - 1; | |
| 4A block in curly braces holds statements, and each statement inside still ends with a semicolon | DThe first statement is missing its semicolon at the end. It should be let points = 5; | |
| 5let name = "Sam"; let age = 13; console.log(name); | Eif (score > 10) { console.log("Win"); } | |
| 6let points = 5 console.log(points); | FA separate statement that shows the value of score in the console |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
let score = 0; — A statement is one instruction in JavaScript, usually written on its own line and ended with a semicolon (;). This line is one statement.let score = 0;let lives = 3;
console.log(lives);let a = 5;
let b = 7;
let total = a + b;if (score > 5) {
console.log("You win!");
}let total = 0;
total += 5;
console.log(total);