16. It's All in the Genes -- help!


#1


Despite the error message I'm getting below, the console prints the correct answer: Hi, my name is Captain Cook. I've refreshed my browser multiple times :frowning: Please help!


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


function Animal(name, numLegs) {
    this.name = name;
    this.numLegs = numLegs;
};

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

var penguin = new Animal("Captain Cook", 2);
penguin.sayName();


#2

from the instructions:

where [name] is the value of name

the value of name is this.name, so why use square brackets?


#3

Not sure, but taking the brackets out doesn't work either unfortunately.


#4

codecademy has this nasty habbit that strings have to be an exact match, you can't have a , after Hi


#5

Ahhh perfect! That was it! Thank you so much, could've sworn I checked that :wink:


#6