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 | |
|---|---|---|
| 1// console.log(total); | Aconsole.log(total); | |
| 2/* let bonus = 5; score += bonus; */ | BThis line is commented out, so JavaScript skips it and does not print total. | |
| 3To test if a line is causing a bug, switch it off by putting // in front of it. | CThe block comment is never closed. It needs */ at the end, or the rest of the program is swallowed and an error appears. | |
| 4After you finish testing, restore the code by removing the // so the line runs again. | DOnly one slash was typed. A comment needs two slashes //, so JavaScript sees a syntax error instead of a skipped line. | |
| 5/ console.log(total); | EA block comment that switches off several lines at once so none of them run. | |
| 6/* let bonus = 5; score += bonus; | F// score = score * 2; |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
// console.log(total); — Putting // in front of a line makes JavaScript skip it, so you can switch code off to find a bug. Remove the // to switch it back on.// console.log(total);let total = 0;
// total = total - 5;
console.log(total);/* console.log(a);
console.log(b); *//* total = total - 5; */
console.log(total);let total = 4 * 5;
// Line below is switched back on
console.log(total);