Reading an error message and its line number
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.
Understanding Reading an error message and its line number in ACARA Digital Technologies Years 7–8
What it does: TypeError is the error name and the text after it is the description, here telling you a const value was changed. The missing ] is on line 1, but JavaScript only notices the problem on line 2 when it reaches console, so the error points to line 2. Start at the reported line. If it looks fine, check the line before it, because the real mistake may be earlier. The description explains the problem in words. A ReferenceError means a name was used that JavaScript does not know. The message gives you clues. Read it carefully before changing any code.
Common mistakes: The closing bracket is missing, so JavaScript reports a SyntaxError and gives line 3 as the place to look. It should be console.log(score + bonus);. The closing quote after Hi is missing, so the string never ends. The SyntaxError (Invalid or unexpected token) points to line 2. It should be console.log("Hi " + name);.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 611–623) and word search (Modules 611–634).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
script.js:3Fill in the Blanks
Spot the Error
Student with a class code? Join your class →