← JavaScript

OOP – Methods

A function declared inside a class body, called on an instance using dot notation.

Understanding OOP – Methods in JavaScript

What it does: This is exactly how a method is written inside a class body. this lets a method access that instance's own properties. Methods define behavior that instances of the class can use. Methods are written as name() { ... }, without 'function'. myDog.bark() calls the bark method on the myDog instance. Without (), you're only referring to the method, not calling it. this.name refers to the current instance's name property. bark() and Bark() would be treated as two different names.

Common mistakes: Method names are case-sensitive - it should be bark(), not Bark(). Calling a method needs parentheses: myCat.meow().

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 41–52) and word search (Modules 21–52).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Is a method a function declared inside a class body?
YesNo
Matches
function bark() { console.log("woof"); }
↓
Wrong - class methods don't use the 'function' keyword
Applying
Meanings
Term
method
Meaning
A function declared inside a class body, called on an instance using dot notation.
Practice
class Dog {
Testing
Gaps
() {
Check Answer
Spots
1myDog.Bark();
2let myDog = new Dog();

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

The 'Puffin' badge — Definition Diver, 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. Is a method a function declared inside a class body?
A. No
B. Yes ✓
Methods define behavior that instances of the class can use.
2. Do class methods use the 'function' keyword?
A. Yes
B. No ✓
Methods are written as name() { ... }, without 'function'.
3. Is a method called on an instance using dot notation?
A. Yes ✓
B. No
myDog.bark() calls the bark method on the myDog instance.
4. Does calling a method require parentheses?
A. Yes ✓
B. No
Without (), you're only referring to the method, not calling it.
5. Can 'this' be used inside a method to access the instance's properties?
A. Yes ✓
B. No
this.name refers to the current instance's name property.

Match the Pairs

bark() { console.log(this.name + " says woof"); } → Declares a method that prints the dog's name and a sound
myDog.bark(); → Calls the bark method on the myDog instance
A function declared inside a class, without 'function' → show() { ... }
Refers to the instance a method is called on → this
function bark() { console.log("woof"); } → Wrong - class methods don't use the 'function' keyword
myDog.bark; → Wrong - calling a method needs parentheses

Key Term

method
A function declared inside a class body, called on an instance using dot notation.

Fill in the Blanks

1. bark() { console.log(this.name + " says woof"); }
Hint: Type the method name declared inside the class.
2. myDog.bark();
Hint: Type the method name being called on myDog.
3. show() { console.log(this.color); }
Hint: Type the method name declared inside the class.
4. myCar.show();
Hint: Type the method name being called on myCar.
5. console.log(this.name + " says woof");
Hint: Type the keyword that refers to the current instance.

Spot the Error

Question 1
A myDog.Bark();
B let myDog = new Dog();
C class Dog {
D bark() { console.log(1); }
E }
Line A — Method names are case-sensitive - it should be bark(), not Bark().
Question 2
A myCat.meow;
B let myCat = new Cat();
C class Cat {
D meow() { console.log(2); }
E }
Line A — Calling a method needs parentheses: myCat.meow().
Question 3
A class Bird {
B function sing() {
C console.log("tweet");
D }
E }
Line B — Class methods skip the 'function' keyword - just write sing() {.
Question 4
A class Duck {
B function quack() {
C console.log("quack");
D }
E }
Line B — Class methods skip the 'function' keyword - just write quack() {.
Question 5
A class Fish {
B swim() {
C console.log("splash")
D }
E }
Line C — This line is missing a semicolon, but that's not required in JS.

Student with a class code? Join your class →