How do classes help us?


#1



How do classes help us?

name is getting printed but error is - make sure you created a person called me.
My code...

// make a person called me with your name and age
// then use printPersonName to print your name
function me(name,age){
this.name=name;
this.age=age;
}
var printPersonName = function(me){
console.log(me.name);
};
var me = new me("Mehul Jain",20);
printPersonName(me);


Replace this line with your code.


#2

@microrunner06083

How do classes help us?

As in JS classes or this class? In what context?

A link to the lesson would help but iirc you are supposed to make me using the Person Class Object constructor.


#3

I believe this is in reference to this lesson:
https://www.codecademy.com/en/courses/objects-ii/2/3?curriculum_id=506324b3a7dffd00020bf661#

The instructions don't ask you to recreate the Person class and printPersonName as "Me", only to create a Person (using the constructor) called me to add yourself into the mix.

Therefore,
var me = new Person("Mehul Jain",20);
printPersonName(me);

Hopefully, that should work.


#4

@jocegonz Thanks, I checked after I posted, too. But I wouldn't've had to if OP included a link :wink: