Question 23
Consider the below JavaScript program.
class Animal { constructor(name) { this.name = name; }
speak() { console.log(`${this.name} makes a noise.`); }}
class Dog extends Animal { speak() { console.log(`${this.name} barks`); }}
const d = new Dog('Rex');d.speak();console.log(d.__proto__ === Dog.prototype);console.log(d.__proto__.__proto__ === Animal.prototype);What will be the output of the above program?
Rex barks
true
trueRex barks
false
trueRex barks.
true
falseRex barks.
false
false