Prototype Object

Prototype Object
0

#1

This quesiton is related to Object Oriented Programming: Add Methods After Inheritance.

I would like to create the dog.prototype object (like show in a previous challenge) but I don’t see how in include in this prototype object the inheritance to animal. I would have imagine something like that

Dog.prototype={
Object.create(Animal.prototype),
constructor:Dog,
bark:function(){ console.log(“woaf”);}
};

But cannot make it work. SO how one introduce the inheritance in the prototype object without having to put

Dog.prototype =Object.create(Animal.prototype);
Dog.prototype.constructor=Dog;
Dog.prototype.bark=function(){ console.log(“woaf”);}

Thanks a lot!


#2

Which previous example?


#3

Hi, thank you for coming back to me.The challenge name was:

Object Oriented Programming: Change the Prototype to a New Object.

Best