Tell us what’s happening:
Hello again!
I’m trying to do this exercise, but I don’t understand how the supertype is linked to the rest of the code?
Your code so far
function Cat(name) {
this.name = name;
}
Cat.prototype = {
constructor: Cat,
eat: function() {
console.log("nom nom nom");
}
};
function Bear(name) {
this.name = name;
}
Bear.prototype = {
constructor: Bear,
eat: function() {
console.log("nom nom nom");
}
};
function Animal() { }
Animal.prototype = {
constructor: Animal,
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0.
Challenge: Use Inheritance So You Don’t Repeat Yourself
Link to the challenge: