Use Inheritance So You Don't Repeat Yourself

I get that we should define a certain method only once instead of twice of thrice in every object to use the DRY principle. But where do we include the other prototype in the various objects? So, in the challenge given where do we include the Animal prototype in the cat or bear prototype? How does JS know that Animal is a supertype?

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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself/

This challenge is part 1 of 2 challenges related to the same code. You will learn what you seek in the next challenge.

oh got it. My bad. In the next part, I dont understand the difference between new and create. There is no explanation. Can you please tell me

Have you tried googling it?
For example there is this documentation:

@iehleen I did google it, but I got confused as to what was said about binding and that new binds and create doesnt.

So from what you sent, create allows for inheritance whereas new does not. Am I right