← ACARA Digital Technologies Years 9–10

Reading and changing an object's properties

Reads a property of an object, like rex.age. To change it, assign a new value: rex.age = 4. Each object keeps its own values.

Understanding Reading and changing an object's properties in ACARA Digital Technologies Years 9–10

What it does: Using object.property inside console.log reads the property and shows its value. Each object keeps its own values, so milo.age stays the same when rex.age is changed. A single = assigns a new value. == only compares two values and changes nothing. Assigning to a property replaces the old value, so rex.age is now 4. Properties are read with dot notation: object.property. Round brackets are for calling functions. const stops rex from being reassigned to a different object, but the properties inside the object can still be changed. The object name comes first, then a dot, then the property: rex.name. You must assign to rex.age. Writing just age creates or changes a separate variable, not the property of rex.

Common mistakes: Property names are case-sensitive. rex.Age does not exist, so it prints undefined. It should be rex.age. == compares two values and does not change anything. To change the property, use the assignment operator: rex.age = 4;.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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.

Learning
Duo
Dog class: const rex = new Dog('Rex', 3). Which line reads Rex's age?
console.log(Dog.age);console.log(rex.age);
Matches
rex.age == 4;
↓
== compares values instead of assigning. It should be rex.age = 4; to change the property.
Applying
Meanings
Term
object.property
Meaning
Reads a property of an object, like rex.age. To change it, assign a new value: rex.age = 4. Each object keeps its own values.
Practice
class Dog {
Testing
Gaps
console.log(.age);
Check Answer
Spots
1const rex = new Dog("Rex", 3);
2console.log(rex.Age);

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Abyssal Dragon' badge — Deep Sea Legend, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Dog class: const rex = new Dog('Rex', 3). Which line reads Rex's age?
A. console.log(Dog.age);
B. console.log(rex.age); ✓
Use the object's name, a dot, then the property name. rex.age reads the age stored in the rex object.
2. Which line changes rex's age to 4?
A. rex.age = 4; ✓
B. rex.age == 4;
A single = assigns a new value. == only compares two values and changes nothing.
3. rex.age is 3. After rex.age = 4; runs, what does console.log(rex.age) print?
A. 4 ✓
B. 3
Assigning to a property replaces the old value, so rex.age is now 4.
4. const rex = new Dog('Rex', 3); const fido = new Dog('Fido', 5); rex.age = 4; What is fido.age?
A. 4
B. 5 ✓
Each object keeps its own values. Changing rex does not change fido.
5. Which is the correct way to read the name property of an object called fido?
A. fido.name ✓
B. fido(name)
Properties are read with dot notation: object.property. Round brackets are for calling functions.

Match the Pairs

rex.age → Reads the age property of the object stored in rex
rex.age = 4; → Changes rex's age property to the new value 4
Print the value of a property stored in an object called rex → console.log(rex.name);
Changing one object's property does not change another object's copy → rex.age = 4; console.log(milo.age);
rex.age == 4; → == compares values instead of assigning. It should be rex.age = 4; to change the property.
console.log(rex(age)); → Brackets are used instead of a dot. It should be rex.age to read the property.

Key Term

object.property
Reads a property of an object, like rex.age. To change it, assign a new value: rex.age = 4. Each object keeps its own values.

Fill in the Blanks

1. const rex = new Dog("Rex", 3); console.log(rex.age);
Hint: Type the name of the variable that holds the dog object whose age is being read.
2. const rex = new Dog("Rex", 3); rex.age = 4; console.log(rex.age);
Hint: Type the operator that stores a new value in the property.
3. const rex = new Dog("Rex", 3); const mia = new Dog("Mia", 5); mia.age = 6; // rex.age is still 3
Hint: Each object keeps its own values. Type the object variable that is changing, based on the comment.
4. const rex = new Dog("Rex", 3); rex.age = rex.age + 1; console.log(rex.age); // 4
Hint: Type the property name that is read to work out Rex's new value.
5. const rex = new Dog("Rex", 3); rex.age = 4; // Rex is now 4 years old console.log(rex.age);
Hint: Type the property name that stores how many years old the dog is.

Spot the Error

Question 1
A const rex = new Dog("Rex", 3);
B console.log(rex.Age);
C rex.age = 4;
Line B — Property names are case-sensitive. rex.Age does not exist, so it prints undefined. It should be rex.age.
Question 2
A const rex = new Dog("Rex", 3);
B console.log(rex.age);
C rex.age == 4;
D console.log(rex.age);
Line C — == compares two values and does not change anything. To change the property, use the assignment operator: rex.age = 4;
Question 3
A const mia = new Cat("Mia", 2);
B mia.age = age + 1;
C console.log(mia.age);
Line B — age on its own is not a variable, so this causes a ReferenceError. Read the property through the object: mia.age + 1.
Question 4
A let rex = Dog("Rex", 3);
B let zed = new Dog("Zed", 5);
C rex.age = 4;
D console.log(zed.age);
Line A — An object is created from a class with the new keyword. It should be let rex = new Dog("Rex", 3);
Question 5
A let rex = new Dog("Rex", 3);
B let zed = new Dog("Zed", 5);
C rex.age = 4;
D console.log(zed.age());
Line D — age is a property, not a method, so it is read without brackets. zed.age() causes a TypeError. Use zed.age, which prints 5.

Student with a class code? Join your class →