Penguin Magic


Penguin magic distinctly lacking for me, getting the error message "ReferenceError: penquin is not defined" but surely it's defined under var penguin (or am I missing something?)

// 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 penguin = new Penguin("Pingu");


Witness the spelling error. It's the only thing wrong that I can see.


Aaaarggghh! Thanks MTF


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