Tell us what’s happening:
Hey guys,
I don’t understand what makes the computer relate the supertype Animal and the subtypes Bird and Dog.
How is the describe method from the Animal prototype contained in the Dog and Bird prototypes if Animal isn’t mentioned in them?
Thanks In Advance
Code From Explanation
function Animal() { };
Animal.prototype = {
constructor: Animal,
describe: function() {
console.log("My name is " + this.name);
}
};
Bird.prototype = {
constructor: Bird
};
Dog.prototype = {
constructor: Dog
};
Challenge: Use Inheritance So You Don’t Repeat Yourself
Link to the challenge: