Skip to content
dreamcode
dreamcode
Lesson
Practice · Classes & OOP
  1. Predict
  2. Arrange
  3. Fill in
+20 XP on finish
PREDICT · READ BEFORE YOU WRITE

What does this program print?

Trace the program the way the computer would, then make your call before running anything.

class Cloud {
  constructor(type) {
    this.type = type;
  }
  getType() {
    return this.type;
  }
}
class StormCloud extends Cloud {
  constructor(type, severity) {
    super(type);
    this.severity = severity;
  }
  getType() {
    return 'Stormy ' + super.getType();
  }
}
const nimbus = new StormCloud('cumulus', 'high');
console.log(nimbus.getType());