Method does not properly log to the console


#1

Despite having the console print exactly what the author desires, I keep receiving a prompt that the method does not properly log to the console. Here's my code:

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

A very, VERY confusing thing, but it's a problem.

Change this:

To this:

console.log("Hi my name is" + " " +this.name);

They want you to do it that way, even though it's the same.:smiley:


#3

I did. I still get the same message:

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

:confused:


#4

never mind. I noticed I had a comma after 'Hi", which was the issue.