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 = 10; | AA single = assigns 5 to x instead of comparing. The condition should use === to ask 'is x equal to 5?' | |
| 2score === 10 | BStores the value 10 in the variable score (score becomes 10) | |
| 3Read = as 'becomes' when you store a value in a variable | CChecks if score is equal to 10 and gives true or false | |
| 4Use === inside an if to ask 'is it equal to?' | Dif (lives === 0) { | |
| 5if (x = 5) { | Elet lives = 3; | |
| 6let age === 13; | F=== compares values, so it cannot store 13 in age. A single = is needed to assign the value. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
= vs === — A single = stores a value in a variable (x becomes 5). Triple === compares two values and gives true or false (x is equal to 5). Writing if (x = 5) is a bug.let score = 10;let score = 10;
if (score === 10) console.log("Win");let lives = 0;
console.log(lives === 0);let isReady = false;
isReady = true;
console.log(isReady);let n = 7;
if (n === 7) { console.log("Lucky"); }