19. Black (and White) Penguin Magic


hey i get it accepted but i can get it to log anything.

// 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('bob');


Hello @mathewvirgen,

Your code should work, it has the correct syntax for everything. Try reloading your page... that sometimes fixes the problem.

Barry Allen


@bartholomewallen thanks, that worked. I just have to do that every time something isn't working. I thought i was blind :stuck_out_tongue:


Haha, yeah Codecademy is a great tool, but it's definitely not a perfect one. Keep coding hard :laughing:!

Barry Allen


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