[solved]"It's all in the genes" code is functional, but it doesn't let me pass


I keep getting this error 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."

My code is fully functional and does exactly what it asked me to do but it won't let me pass. I tried refreshing it twice and it still didn't work

// create your Animal class here
var Animal = function(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);

Has anyone else had this problem?


It turns out my problem was that they didn't want me to have the comma I put after the "hi" in the console log.

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

I put the above when the correct answer is the line below.

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


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