Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Reading an error message and its line number worksheet is part of the ACARA Digital Technologies Years 7–8 — Programming with Control Structures and Functions (JavaScript) 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 | |
|---|---|---|
| 1script.js:3 | AThe closing } is missing. JavaScript reports the error at the end of the file (Unexpected end of input), not on line 1 where the function started. | |
| 2ReferenceError: score is not defined | BThe file name and line number where JavaScript noticed the error. Check line 3 first, but the real mistake may be a line earlier. | |
| 3An error message names the type of error and describes what went wrong | CTypeError: Assignment to constant variable. | |
| 4The real mistake may be a line earlier than the line number in the error message | DThe message says ReferenceError: agee is not defined at line 2. The variable name is misspelled and should be age. | |
| 5let age = 12; console.log(agee); | Elet nums = [1, 2 console.log(nums); | |
| 6function hi() { console.log("Hi"); hi(); | FThe error name and description: JavaScript cannot find anything called score, so check for a typo or a missing let. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
script.js:3 — Part of an error message: the file and line number where JavaScript noticed the error. Check that line first, but the real mistake may be a line earlier.console.log(scoree);
// ReferenceError: scoree is not definedlet age = 12;
age = ;
// Error is reported at script.js:2const max = 5;
max = 6;
// TypeError
: Assignment to constant variable.// Error at script.js:5
// Check line 5 first, then line 4console.log(x);
// script.js:1 ReferenceError