Marching penguins


#1



It gives me ok, but the code doesn't print any message


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);
    };

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


#2

I just copied and pasted your code in the lesson and it passed fine ( i see your message about it not printing anything) However, it also prints Hi my name is Captain Cook so as far as I can tell it works just as it is supposed to. Try refreshing?


#3

ok, still not printing but it's ok.
Was affraid might be some bug


#4

Yeah as long as the lesson is passing and you can move on it is at least for now its ok. You know you have the right code and you coded it well so you haven't like passed lesson with a "cheap" or "cheat" code. Maybe, try passing it again tomorrow a fresh just to see if it will pass once let a lone.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.