Quiz · Classes and prototypes · lesson 6 of 12
Quiz — an overridden method
What does the program print?
class Animal {
speak() {
return "Hi";
}
}
class Dog extends Animal {
speak() {
return super.speak() + " Woof";
}
}
const d = new Dog();
console.log(d.speak());Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.