17 Marching Penguins


#1

The following code is throwing the error "Penguin is not defined" and I'm not sure why, any help is much appreciated!

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 Pengiun(name, numLegs) {
this.name = name;
this.numLegs = numLegs;
}

// create a sayName method for Penguins here
Pengiun.prototype.sayName = function() {
console.log("Hi my name is " + this.name);
};

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


#2

Spelling...

function Penguin(name, numLegs) {

Note that Penguin inherits from Animal, which already has a numLegs property so we can leave that property out.