Implement Class Inheritance with Prototype Chain

Implement ES6 class inheritance without using the class keyword. This forces you to understand what class and extends actually compile to.

This ES6 class hierarchy:

class Animal {
  constructor(name, sound) { this.name = name; this.sound = sound; }
  speak() { return `${this.name} says ${this.sound}`; }
}

class Dog extends Animal {
  constructor(name) { super(name, "Woof"); }
  fetch() { return `${this.name} fetches the ball!`; }
}

Must be rewritten using constructor functions and prototype assignment.

Key Concepts

ES6 syntaxPre-ES6 equivalent
class Foo {}function Foo() {}
class Dog extends AnimalDog.prototype = Object.create(Animal.prototype)
super(args) in constructorAnimal.call(this, args)
super.method()Animal.prototype.method.call(this)
Examples
Input: ["speak","Lion","Roar"]
Output: "Lion says Roar"
Hints

Implement Class Inheritance with Prototype Chain

Desugar ES6 class inheritance — implement Animal and Dog using constructor functions and prototype chains, replicating `extends` and `super()` without using the `class` keyword.