Black (and White) Penguin Magic


According to the code given bleow, It should print the penguin name in the output screen but there in no output....Why???

// 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("jack");


Codecademy environment is quite buggy and laggy. Try to execute your code in the different environment, example ->

Output of your code is:

Hi my name is jack


Again thankyou....:slight_smile:


You're very welcome, again :slight_smile:


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