Black (and White) Penguin Magic


#1

// 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
var penguin = function(name, numLegs) {
this.name = name;
this.numLegs = 2;
};

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

var Penguin = new penguin("Bobby");

Penguin.sayName();

It's telling me: Your code threw the following error: TypeError: Right-hand side of 'instanceof' is not callable
Can somebody help me?

The code worked btw, but it's just telling me this error.


#2

var penguin = new Penguin("Boddy");

penguin.sayName();


#3

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