17.Marching Penguins


#1

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

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

ERRRORR :cry: SyntaxError: Unexpected token {


#2

Ooops i know the error : fuction >> function thats the error :sweat: