class Animal { greet() { return 'Hello from animal'; } }
class Dog extends Animal {
greet() { return super.greet() + ' and dog'; }
}
new Dog().greet(); // 'Hello from animal and dog'super.method() calls the parent's version of an overridden method.
The super keyword can be used to call parent methods, not just the constructor. This is useful when you want to extend parent behavior instead of replacing it completely.
Challenge: Override a method but call the parent's version from within the override using super.method().