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 | |
|---|---|---|
| 1total += price; | Acount+ is not a valid operator. To add 1 you need two plus signs, count++, or you can write count += 1. | |
| 2count--; | Bcount++; | |
| 3Add 1 to the variable count using the shortest form | CThe symbols are the wrong way round. =+ just assigns a positive price to total instead of adding it. It should be +=. | |
| 4Write score = score - 5 in its shorthand form | Dscore -= 5; | |
| 5total =+ price; | EAdds the value of price to total and stores the answer back in total | |
| 6let count = 0; count+; | FTakes 1 away from count |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
total += price — A shorthand update. Operators like +=, -=, ++ and -- change a variable using its own value, so total += price means total = total + price. count++ adds 1 and count-- takes away 1.let total = 0;
total += 5;
console.log(total);let lives = 3;
lives--;
console.log(lives);let count = 0;
count = count + 1;
count++;const price = 8;
let money = 20;
money -= price;const price = 6;
let total = 0;
total += price;