Creat a new object consturctor


#1

https://www.codecademy.com/courses/javascript-beginner-en-9Sgpi/2/3?curriculum_id=506324b3a7dffd00020bf661#

Hi, I have to create a new object constructor, I tried many time unsuccessful. I need some help, thanks.

var MyConstructor = function(){};

var me = new MyConstructor();
me.name = "Alex";
me.age = 27;

#2

When you use the constructor, the syntax looks like this:

var myObj = new Object();

where myObj is the name of your object


#3

Thanks.

var me = new Object();

me.name = “Alex”;
me.age = 27;


#4

this bit:

was part of the information section of the exercise, i just copied pasted it

you’re welcome :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.