Class Animal holds the properties that are applicable to both cat and dogs. While CAT is a new instance of Animal and extends the Animal class with properties solely related to the Cat object
class Animal {
constructor(name) {
this._name = name;
this._behavior = 0;
}
get name() {
return this._name;
}
get behavior() {
return this._behavior;
}
incrementBehavior() {
this._behavior++;
}
}
class Cat extends Animal {
constructor(name, usesLitter) {
super(name);
this._usesLitter = usesLitter;
}
}