16 Object II


#1

Can somebody explane what wrong. I work on Mac, Maybe it should be different syntax

// create your Animal class here
function Animal(name, numLegs){
this.name = name;
this.numLegs = numLegs;
}
// create the sayName method for Animal
Animal.prototype.sayName = functon(){
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

Watch your spelling !


#4

1

2

As @dondabreraozemail_co mentioned...."Watch your spelling !"

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

variable-name's should be starting with =lowercase=


#5

I did the same mistake ----- forgot a space. You should add a space after the text "is".
Change
console.log("Hi my name is" + this.name);
into
console.log("Hi my name is " + this.name);


#6

What's wrong with this.

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


#7

The var keyword is in all-lower-case....!!