My code doesn't log anything to the console. Why?


#1


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


It doesn't log anything to the console and I followed all instructions to the latter. Please help me find the error.


// 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

Wow, that's surprising. I just ran your code and it worked perfectly. Refresh page.


#3

I refreshed and it worked. Thanks


#4

Okay!

You're welcome. Have fun coding! :slight_smile:


#5

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