Animal prototype example not working


#1


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


Oops, try again. It looks like your Animal.prototype.sayName method does not properly log to the console 'Hi my name is [name]' where [name] is the name of the Animal


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

You are going to be really annoyed at this solution...

But there is only supposed to be one space here. You have two spaces after the word is.

Let me know if that worked.


#3

LOL. Yes thanks that worked.


#4

Please mark my reply as the solution so this thread can be closed :slight_smile:


#5

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