Marching PENGUINS


#1

There's syntax problem anyone can help??

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 = functon(){
console.log("Hi my name is" + this.name);
};

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


#2

@ankurlvv,

1

have a close look at

funtion

2

In you sayName-Method add an extra space in the console.log()-displayable-string
"Hi my name is " + this.name


#3

the error is on this line

Penguin.prototype.sayName = functon(){

should be

Penguin.prototype.sayName = function(){

#4

@leonhard_wettengmx_n @rydan thanks !!