16/30 Nothing is being printed


#1

https://www.codecademy.com/courses/objects-ii/3/1?curriculum_id=506324b3a7dffd00020bf661

Codecademy says that the code is right. However, nothing is being printed on the console.


// create your Animal class here
function Animal(name, numLegs){
    this.name = name;
    this.numLegs = numLegs;
};


// create the sayName method for Animal

Animal.prototype.sayName = function(){
    console.log("Hi my name is" + " " + this.name);
};



// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();


#2

Codecademy environment is quite buggy and laggy. You can always test your code in the different environment -> https://repl.it/CyZm


#3

Thanks! It prints when I try it on that link.


#4

You're very welcome! :slight_smile:


#5

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