class Animal {
constructor(name) { this.name = name; }
}
class Dog extends Animal {
constructor(name, breed) {
super(name);
this.breed = breed;
}
}Call super() first in the child constructor to initialize the parent's state.
When a subclass has its own constructor, you must call super() to call the parent's constructor. This initializes the parent's properties. Without super(), the parent properties won't be set up.
Challenge: Create a subclass constructor that calls the parent constructor using super().