Back to Blueprint to Object
OOP Studio Ages 9-15

Object Builder

Students add properties and methods so each object can hold data and do actions.

20-25 min Ages 9-15 OOP Builder JavaScript
Code Editor

Build two objects from one class.

Example code
class RobotPet {
  constructor(name, color, energy) {
    this.name = name;
    this.color = color;
    this.energy = energy;
  }

  play() {
    this.energy -= 1;
    say(this.name + " plays. Energy: " + this.energy);
  }

  describe() {
    say(this.name + " is " + this.color);
  }
}

let bolt = new RobotPet("Bolt", "blue", 5);
let zara = new RobotPet("Zara", "green", 4);

bolt.describe();
bolt.play();
zara.describe();
Output

Program result

Robot ready to speak your strings

Type real JavaScript, then run it.