16 syntax error


#1

If I run the following code, I get an error message "Oops, try again. There was a problem with your syntax." Please help me.

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


#2

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

You can probably compare and find out the mistake you're making. The above code works fine.


#3

function Animal(name,numLegs)={ <------------THIS IS WRONG

function Animal(name,numLegs) { <-----------THIS IS RIGHT

THERE'S NO "=".


#4

Ok. Thank you very much.