← ACARA Digital Technologies Years 9–10

Methods calling other methods

Inside a class, a method calls another method of the same object by writing this. before its name, such as this.isPassing(). Forgetting this. causes a ReferenceError.

Understanding Methods calling other methods in ACARA Digital Technologies Years 9–10

What it does: isPassing() does one job only: it returns true or false. Other methods can reuse it by calling this.isPassing(). report() uses this.getGrade() to run a different method belonging to the same object. Inside a class, a method must use this. before another method's name. Writing isPassing() alone looks for a normal function and causes a ReferenceError. Methods are not found by their bare name. The fix is return this.average();. Calling a single-job method avoids repeated code. If the pass mark changes, you only fix it in one method. The method calls this.getTotal() to reuse that work instead of repeating the code, then divides the returned value.

Common mistakes: isPassing() is a method of the object, so calling it without this. causes a ReferenceError. It should be this.isPassing(). One method calling another must use this. before the name. Plain pass() looks for a separate function and causes a ReferenceError. It should be this.pass().

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 743–781) and word search (Modules 743–809).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Inside the Student class, how do you call the isPassing method from another method?
this.isPassing()isPassing()
Matches
report() { return isPassing(); }
↓
The call is missing this. so JavaScript looks for a normal function called isPassing and throws a ReferenceError. It should be this.isPassing().
Applying
Meanings
Term
this.methodName()
Meaning
Inside a class, a method calls another method of the same object by writing this. before its name, such as this.isPassing(). Forgetting this. causes a ReferenceError.
Practice
class Student {
Testing
Gaps
report() { return this.(); }
Check Answer
Spots
1 report() {
2 if (isPassing()) {

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

The 'Cosmic Dragon' badge — Orbit Master, 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. Inside the Student class, how do you call the isPassing method from another method?
A. this.isPassing() ✓
B. isPassing()
Inside a class, a method must use this. before another method's name. Writing isPassing() alone looks for a normal function and causes a ReferenceError.
2. Which line is the correct way to call the method getTotal from inside another method of the same class?
A. let t = getTotal();
B. let t = this.getTotal(); ✓
this.getTotal() tells JavaScript to run the getTotal method on the current object. Without this., JavaScript can't find it.
3. A method contains the line: return average(); and average is a method in the same class. What happens when it runs?
A. It calls the average method correctly
B. ReferenceError: average is not defined ✓
Methods are not found by their bare name. The fix is return this.average();
4. Which is a good example of a small single-job method?
A. isPassing() returns true if the mark is 50 or more ✓
B. doEverything() calculates marks, prints reports and checks passes
Small methods that do one job are easier to test, reuse and call from other methods with this.methodName().
5. Which method body correctly uses another method? report() { ... }
A. if (this.isPassing()) { console.log('Pass'); } ✓
B. if (this.isPassing) { console.log('Pass'); }
Without the brackets, this.isPassing is just the method itself, not its result. The brackets run the method and give back true or false.

Match the Pairs

if (this.isPassing()) { → Calls the isPassing method on the same object and uses its true or false result in the if condition
return this.getTotal() / 3; → Gets the total from another method of the same object, then divides it by 3 to give an average
A small single-job method checks one thing, so other methods can call it with this. → isPassing() { return this.mark >= 50; }
One method can call another method of the same class by writing this. before the method name. → report() { return this.getGrade(); }
report() { return isPassing(); } → The call is missing this. so JavaScript looks for a normal function called isPassing and throws a ReferenceError. It should be this.isPassing().
if (this.isPassing) { return 'Pass'; } → The brackets are missing, so the method is not called. this.isPassing is just the function itself, which is always truthy. It should be this.isPassing().

Key Term

this.methodName()
Inside a class, a method calls another method of the same object by writing this. before its name, such as this.isPassing(). Forgetting this. causes a ReferenceError.

Fill in the Blanks

1. isPassing() { return this.mark >= 50; } report() { return this.isPassing(); }
Hint: Type the name of the method, defined on the line above, that checks whether the mark is a pass.
2. isPassing() { return this.mark >= 50; } status() { return this.isPassing(); }
Hint: Type the keyword that tells JavaScript the method belongs to the same object.
3. total() { return this.a + this.b; } average() { return this.total() / 2; }
Hint: Type the name of the small method that adds the two values, so average() can reuse it.
4. addBonus(n) { this.points += n; } win() { this.addBonus(10); }
Hint: Type the name of the method that adds an amount to points. win() calls it with the value 10.
5. status() { return this.isPassing() ? "Yes" : "No"; }
Hint: Type the keyword that sends the result of the method call back to whoever called status().

Spot the Error

Question 1
A report() {
B if (isPassing()) {
C return 'Pass';
D }
E }
Line B — isPassing() is a method of the object, so calling it without this. causes a ReferenceError. It should be this.isPassing().
Question 2
A ok() { return pass(); }
B pass() {
C return this.mark >= 50;
D }
Line A — One method calling another must use this. before the name. Plain pass() looks for a separate function and causes a ReferenceError. It should be this.pass().
Question 3
A summary() {
B let n = this.name;
C let p = this.isPassing;
D return n + ' ' + p;
E }
Line C — Without the brackets the method is not called. p would hold the function itself instead of true or false. It should be this.isPassing().
Question 4
A report() {
B let n = this.name;
C let m = this.mark;
D let p = this.ispassing();
E return n + m + p;
F }
Line D — JavaScript is case sensitive. The method is called isPassing, so this.ispassing() is not a function and causes a TypeError. It should be this.isPassing().
Question 5
A summary() {
B let n = this.name;
C let m = this.mark;
D let g = Student.grade();
E return n + m + g;
F }
Line D — Student is the class, but grade() belongs to each object made from it. Inside a method, call it on the current object with this.grade().

Student with a class code? Join your class →