19. Black (and white) penguin magic - won't print


#1

Hi all, I'm (kinda) stuck on exercise 19 of introduction to objects II.

The code passes fine (as in running it unlocks the next lesson), but the text doesn't log to the console. Can anyone help? I want to make sure I'm getting it right.

/ 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("Jorge")
penguin.sayName();


#2

check your semicolons one more time, then it should work


#3

That did it, thanks so much!


#4

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