16/30


#1

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

I got a pass from code academy. However my code did not print the desired sentence to console. I would like help on finding out why that is. i tried dot notation and brack notation inside of the console log portion. Please help. Thank you


#2

it works. maybe browser?


#3

That could possibly be it. I read in other topics that others were having the same issue. But thank you for confirming that on your end.