✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
class Animal {speak() {
return 'Some sound';
}
}
class Dog extends Animal {
speak() {
return 'Woof!';
}
}
class Cat extends Animal {
speak() {
return 'Meow!';
}
}
const animals = [new Dog(), new Cat(), new Animal()];
animals.forEach(a =\> console.log(a.speak()));