Syntax errors: missing quotes, brackets and braces
An error shown when code breaks JavaScript's rules, like a missing quote, bracket or brace. JavaScript can't read the code, so the program won't run until you fix it.
Understanding Syntax errors: missing quotes, brackets and braces in ACARA Digital Technologies Years 7–8
What it does: This code has its opening brace and closing brace paired up, so JavaScript can read the whole if block. The string starts and ends with a double quote, so it is a complete string and there is no SyntaxError. Every opening { needs a matching closing }. Without it you get a SyntaxError such as 'Unexpected end of input'. A SyntaxError is about broken rules, like a missing quote, bracket or brace. A program that runs but gives wrong answers has a logic error. An unexpected token means JavaScript found a symbol where it didn't expect one. Check the reported line and the lines just above it.
Common mistakes: The string "Hi " is missing its closing quote, so JavaScript throws a SyntaxError (unclosed string). It should be console.log("Hi " + name);. The block that opened with { must be closed with a closing brace }, not a bracket ). This causes a SyntaxError. Line 4 should be }.
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
SyntaxErrorFill in the Blanks
Spot the Error
Student with a class code? Join your class →