17. Marching Penguins // Introduction to objects ||


#1

Please can someone advise what is wrong with this code.

I do not get what could be wrong.

Yes linter is telling me instructions but I just do not understand

Code as follows.

function Animal(name, numLegs) {
this.name = name;
this.numLegs = numLegs;
}
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)
}
var smallBird= new Penguin("Bird",2);

// our test code
var theCaptain = new Penguin("Captain Cook", 2);
theCaptain.sayName();
smallBird.sayName();


#2

@r2d2_12,

Have a close look at

numlegs