ReferenceError: a name that is not defined
An error shown when code uses a variable or function name that has not been declared, often from a typo, wrong capital letter, wrong scope or using it before declaring it.
Understanding ReferenceError: a name that is not defined in ACARA Digital Technologies Years 7–8
What it does: bonus only exists inside the curly braces of the if block, so it is not defined when logged outside. The line that logs lives runs before the let declaration, so the name is not available yet. JavaScript is case-sensitive, so Score and score are different names. Only score was declared, so Score causes a ReferenceError. The name live was never declared. It is a misspelling of lives, so JavaScript cannot find it. The capital N matters. Typing the name exactly as it was declared removes the ReferenceError.
Common mistakes: scor is a misspelt name. The variable was declared as score, so JavaScript throws ReferenceError: scor is not defined. It should be console.log(score);. JavaScript is case sensitive, so Score and score are different names. Only score was declared, so Score causes a ReferenceError. Use score.
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 624–634) 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
ReferenceErrorFill in the Blanks
Spot the Error
Student with a class code? Join your class →