I have a problem in my code



I have a problem in my code.

can anyone help me??


// create your Animal class here
class 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);

16, Its all in the genes

It looks like you have some Python, C or Java in your lexicon. However, the term class is a misnomer in ES5. It is the term we use to describe a function that acts as a model or template of an object class. I know this is confusing, but just go along with it, for now.


class Animal


function Animal


Thanks :slight_smile:

Already it works !!! :grin: