19/30. I can't figure out which part isn't right


#1

// the original Animal class and sayName method
function Animal(name, numLegs) {
this.name = name;
this.numLegs = numLegs;
}
Animal.prototype.sayName = function() {
console.log("Hi my name is " + this.name);
};

// define a Penguin class
function Penguin(name){
this.name = name;
this.numLegs= 2;
// set its prototype to be a new instance of Animal
Penguin.prototype = new Animal();
}

var penguin = new Penguin("Waddler");

penguin.sayName();


#2

Hey @oliveoil7! Simple fix! when you set your Penguin class as a prototype of Animal class, you accidently put it in the Class here:

Just put it out and youll be fine like this:

function Penguin(name){
this.name = name;
this.numLegs= 2;
// set its prototype to be a new instance of Animal

}
Penguin.prototype = new Animal();
var penguin = new Penguin("Waddler");

penguin.sayName();

Hope this helped!


#3

thanks so much it worked !!!!