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


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);


from the instructions:

where [name] is the value of name

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


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


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


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