Black and white penguin magic


#1


im am not getting an error message. in fact it says i passed the exercise but nothing prints out on the console screen. am i doing something wrong?


// the original Animal class and sayName method
function Animal(name, numLegs) {
    this.name = name;
    this.numLegs = numLegs;
}
Animal.prototype.sayName = function() {
    console.log("Hi my name is " + this.name);
};

// define a Penguin class
function Penguin(name) {
    this.name = name;
    this.numLegs = 2;
}

// set its prototype to be a new instance of Animal
Penguin.prototype = new Animal();

var penguin = new Penguin("Spike");
penguin.sayName();


#2

The code appears to be all in order and works as expected in the lab.

Hi my name is Spike

Did your session perhaps time out? Try to refresh the page and submit again.


#3

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