Marching Penguins


Hi! I just want know why it's working. My code:
    function Animal(name, numLegs) { = name;
         this.numLegs = numLegs;
     Animal.prototype.sayName = function() {
         console.log("Hi my name is " +;

     // create a Penguin constructor here
     var Penguin = Animal;
     // our test code
     var theCaptain = new Penguin("Captain Cook", 2);


Hi in this lesson they aske you to

// create a Penguin constructor here

// create a sayName method for Penguins here

a constructor look like that
a constructor of Cat for example

function Cat(name, lastname) { = name;
    this.lastname = lastname;

for the method you could look the one for Animal.