Confusing Instructions

Tell us what’s happening:
Ok, so either I’m totally missing the point or something is missing. I see nothing that is associating Dogs or Birds with Animal in any way. If this is being covered in future lessons, then ok, but I can’t see those lessons until I finish here and i don’t like moving forward till I understand something.

At this point I feel like I’m being told that if Susan and Bob have the same property, that I should create another prototype (a “superprototype”). I see no difference between a regular prototype and a super prototype though. This new prototype might be called people, but it could just as easily be called Tom.

So what’s the point? I can’t create the same object twice from two different constructors with what I’ve learned so far…

  **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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36

Challenge: Use Inheritance So You Don’t Repeat Yourself

Link to the challenge:

Hi,
Tom is a subset of people. There could be any other function that is mutual between people.
Here for the purpose of better understanding, we have the eating function with a simple console.log.
If you look at it in a broader sense there could be any other function. You just need to avoid repeating the same block of code by applying the principles of inheritence.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.