var me = new object();
me["name"] = "Faisal";
me["age"] = 17;
whats gone wrong? need help


The correct code is:-

var me = new Object();

me.name = "Faisal";
me.age = 17;


You need to write object with an uppercase "O"

var me = new Object();


the way he wrote it worked for me and his "O" is uppercase right it looks like it to me


Try this, 'Start next lesson' :smile: !!!

var me=new Object();

console.log( me.name="Jay");
console.log( me.age=22);


I didn't want to correct @gtbsg2k1's code but the OP's. I just wanted to emphasize the mistake because @gtbsg2k1 just provided the code.


I did this and it only prints out my age.


var me = new Object();
me.name = "Russik";
me.age = 27;
console.log (me); //{ name: 'Russik', age: 27 } I don't know why it looks like this but you can see your name and age


Actually this:

{ name: 'Russik', age: 27 }

is what you're object looks like in literal notation.


@aledavila did you manage to work out why it only prints out your age ? The reason I ask is that it has does exactly the same with me.


Experienced the same here.

Is this a bug or something? Did I do anything wrong?


One resolution to call both me objects:


the reason why it only print your age on screen is becuase you have to console.log it.
just like the previous one. :slightly_smiling:


One question.

Why in the demo code of this section, they didn't declare new Object.

What they wrote is only as following:

var photoEntry = {};

instead of

var photoEntry = new Object();