OOP – Classes & Objects, online

Six activities your students do on their own devices. See who's finished, and their scores.

OOP – Classes & Objects in one minute

What students need to know

class is exactly the keyword used to define this blueprint. new is the keyword that builds a new object from a class.

class defines the shape and behavior that objects will share. JavaScript is case-sensitive, so 'class' must be lowercase.

Mistakes students make

  • 'class' must be lowercase - a capital C causes an error.
  • This line is missing a semicolon, but that's not required in JS.
  • The class body must close with }, not ].
  • 'new' must be lowercase - a capital N causes an error.

Discover other journeys with this module

What students will learn in this module

Every question in Module 47

Quick questions

  1. Does class declare a blueprint for creating objects?AYesBNo
  2. Does new create an instance of a class?ANoBYes
  3. Must 'class' be written in lowercase?AYesBNo
  4. Must 'new' be written in lowercase?AYesBNo
  5. Is 'Class' with a capital C valid JavaScript syntax?AYesBNo

Key terms

Students type the meaning of:

  • class

Match the pairs

class Dog { name = "Rex"; }Match it to what it does
new Dog()Match it to what it does
Declares a reusable blueprint for creating objectsMatch it to what it does
Creates an instance of a classMatch it to what it does
Class Dog { name = "Rex"; }Match it to what it does
let d = New Dog();Match it to what it does

Fill in the blanks

  1. _____ Dog {

    Hint: Type the keyword that declares a class.

  2. let myDog = ___ Dog();

    Hint: Type the keyword that creates a new instance of a class.

  3. class Cat _

    Hint: Type the symbol that opens the class body.

  4. let c = ___ Cat();

    Hint: Type the keyword that creates a new instance of a class.

  5. class Bird _

    Hint: Type the symbol that opens the class body.

Spot the error

Question 1

AClass Dog {Bname = "Rex";C}

Question 2

Aclass Cat {Bname = "Tom"C}

Question 3

Aclass Bird {Bname = "Tweety";C]

Question 4

Aclass Fish {Bname = "Nemo";C}Dlet f = New Fish();

Question 5

Aclas Dog {Bname = "Rex";C}