// 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();
It allow me pass but did not display any result. Why is it so? i Understand that the penguin class have inherit the Animal class. My result came out this way. Please can someone explain more.