Help pls 18/30


#1


https://www.codecademy.com/courses/objects-ii/3/3?curriculum_id=506324b3a7dffd00020bf661#


Oops, try again. The Penguin constructor should always set this.numLegs to 2. The constructor should only take a single parameter!


Replace this line with your code. 
function Penguin(name){
this.name = name;
this.numLegs = 2;
}

Penguin.prototype = new Animal();
Animal.prototype.sayName = function() {
console.log("Hi my name is " + this.name);
};

// create a Penguin constructor here

function Penguin(name, numLegs){
this.name = name;
this.numLegs = numLegs;
}
// create a sayName method for Penguins here

Penguin.prototype.sayName = function(){
console.log("Hi my name is " + this.name)
}
// our test code
var theCaptain = new Penguin("Captain Cook", 2);
theCaptain.sayName();


#2

i dont get it what did i do wrong


#3

where did your animal class go? which was at the beginning in the exercise


#4

@laytondalton, It looks like you were on the right track with your Penguin class. But remember, if you want your Penguin class to inherit from the Animal class, you must first build an Animal class.

Refer back to your old example for a guide to how to build this properly. Hint: It will look exactly like your Penguin class, except with one additional parameter, "numLegs".


#5

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