OOJS Question

V

vunet.us

This may be a silly question to ask but I play around with objects and
I want to confirm if these are the same things or is the second one
correct in syntax:

function initializer(){
var item = new Object();
item.subitem = "subvalue";
this.item = item;
}

and

function initializer(){
var item = new Object();
this.item = item;
this.item.subitem = "subvalue";
}
 
M

Manish Tomar

This may be a silly question to ask but I play around with objects and
I want to confirm if these are the same things or is the second one
correct in syntax:

function initializer(){
var item = new Object();
item.subitem = "subvalue";
this.item = item;

}

and

function initializer(){
var item = new Object();
this.item = item;
this.item.subitem = "subvalue";

}

I think both are same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top