The this keyword in a class
Inside a class, this means the object being worked on, so this.name is that object's own name property. Leaving out this causes a ReferenceError.
Understanding The this keyword in a class in ACARA Digital Technologies Years 9–10
What it does: this.score attaches the score to the particular object being built, so each object has its own score. Inside greet(), this.name looks up the name of the object that greet() was called on. Properties are not plain variables. You need this.score to reach the property. Plain score is only a variable name, and none exists. The property must be on the left of =, so the value is saved on the object.
Common mistakes: A constructor parameter must be a plain name like name. this.name belongs inside the constructor body, where it stores the value on the object. It should be constructor(name). == compares two values, so nothing is stored. To give the object its own name property you need the assignment operator: this.name = 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 728–742) and word search (Modules 710–742).
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
this.nameFill in the Blanks
Spot the Error
Student with a class code? Join your class →