Arrays and Objects: 11, Creating a new object


#1

I don't understand what to do. Here is a copy and paste of the instructions:
Recreate your me object in the editor, but this time, use the object constructor. Once you make it, use either the [] notation or the . notation to give it a name property with a string value (your name) and an age property with a number value (your age).

i don't understand it, thanks in advance!


#2

Just as you did in the previous exercises you have to make an object. This time however you have to use something you have done before and in case you have forgotton what the 'object constructor' was, here is a quick refresher:

The object constructor uses a single line to create an object and it looks like this

var me = new Object();

the special thing about the constructor is that you don't have to put anything between brackets or so; You refer to this new made object by its name: 'me'
If you want to add something to this object you call the objects name and add a property with its name and value.

me.name = repsaj2000;

You are actually making a new variable and automatically putting it in the object "me".
I hope this helped you :wink:


#3

yes, lots, thank you so much!