Arrays and objects 11, pls help


heres my code

var me = { = "Katherine";
me.age = 13;
var me = new Object();


I'm not sure about the

var me = new Object();

part but you're using literal notation which means it should be this.

var me = {
name: "Katherine", <--- use just variable name with : instead of = and a , instead of a ;
age: 13 <--- same as above, but no semi colon.
}; <--- semi colon goes here


oh i did not know that


its still not working


Can you send a link to your lesson that you're on? and what error messages are you getting?



error: missing } after property list


Okay I misunderstood. This is what your code should look like.

var me = new Object(); = "Katherine";
me.age = 13;

var me = new Object(); creates the object and calls it "me". It has no parameters or properties or attributes.

then wherever you want you would use (only for constructor, not literal, as in this case) the dot seperater or bracket. = "Katherine"; (don't forget semicolon!
me["name"] = "Katherine"; also works. Similar to age.


so should i do [] to age or keep what im doing


It doesn't matter for this particular object.

you can still use me.age = 13, etc.

Later on there is a difference so keep the [ ] notation in mind.


now i got this error

error missing : after property id


You ONLY need to use the code

var me = new Object(); = "Katherine";
me.age = 13;

nothing else. It works for me. Try refreshing your browser.


thanks that really help


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