Black (and White) Penguin Magic


Oops, try again. Make sure you create a new instance of Penguin called penguin. Your code threw the following error: ReferenceError: penguin is not defined

code works properly
but this error make the exercise incomplete

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

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

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

var ashile = new Penguin("ashile")


your penguin is called ashile, should be called penguin


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