Tell us what’s happening:
How do we indicate in the code that ANIMAL is the supertype (parent) of DOG and BIRD? I can’t see this relationship.
Your code so far
function Cat(name) {
this.name = name;
}
Cat.prototype = {
constructor: Cat
};
function Bear(name) {
this.name = name;
}
Bear.prototype = {
constructor: Bear
};
function Animal() { }
Animal.prototype = {
constructor: Animal,
eat: function(){
console.log("nom nom nom");
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 OPR/69.0.3686.95
.
Challenge: Use Inheritance So You Don’t Repeat Yourself
Link to the challenge: