What's Wrong? It's All in the Genes


#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 = fuction(){
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

Hi @interact

There is a mistake line 8. (fuction)

Hold on :wink:


#3

This is my code and it works:

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