Philip
Philip

Reputation: 7166

Javascript - Object that relies on other objects

var config = {
  xxx : 'foo'
}

var env = {
 foo : {

 },
 bar : {

}
}

How can I use an objects value to retrieve values from another object?

like:

env.config.xxx?

Upvotes: 0

Views: 69

Answers (1)

user1796666
user1796666

Reputation:

var object1 = { value : 'hello' }
var object2 = { o : object1 }

alert(object2.o.value);

Upvotes: 4

Related Questions