Black (and White) Penguin Magic


Whats wrong with my code? Its giving Syntax Error.

It asked me "Create a Penguin object with the variable name penguin and any name you'd like.Then call penguin.sayName();."

// 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, numLegs){ = name;
this.numLegs = 2;

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


the error is in

Penguin penguin = new Object();

as you supposed to write:

var penguin = new Penguin("Billy or other Penguin's name");

delete the firts one and write the second one... :+1:

#3 is working now.......