16, Need some explanations


#1

https://www.codecademy.com/courses/objects-ii/3/1?curriculum_id=506324b3a7dffd00020bf661#

Why is this code wrong?

// create your Animal class here
Var Animal=function(name, numLegs)
{
    this.name=name;
    this.numLegs=numLegs;
};
Animal.prototype.sayName=function()
{
    console.log("Hi my name is"+" "+ this.name);
};


// create the sayName method for Animal





// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

And this one right?..

// create your Animal class here
function Animal(name, numLegs)
{
    this.name=name;
    this.numLegs=numLegs;
};
Animal.prototype.sayName=function()
{
    console.log("Hi my name is"+" "+ this.name);
};


// create the sayName method for Animal





// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

#2

You use Var
which should be var all-lowercase.


#3

As @leonhard_wettengmx_n mentioned. "Var" is suppose to be "var". Code is a very tricky system that takes values of the letters you use so that it can translate those values into code. Basically meaning if you don't use the same values every time the code will look at you like you're speaking a completely different language than it is. Take your time and look over your code to make sure that you don't have any extra letters, or letters that are capitalized incorrectly. These are the most common errors in coding, but luckily, some of the easiest errors to fix.