javascript - How to add object literal within object literal -


this question has answer here:

assuming have object literal looks this:

c = {"a":"a","b":"b","c":"c"}; 

and want add object this..

"d" : {"e":e} 

where e variable. , e = "valueofe" c have kind of value..

c = {"a":"a","b":"b","c":"c", "d" : { "e" : "valueofe"}}; 

how that?

the values in object literals can arbitrary expressions, means can contain other object literals, make use of existing variables, , on; if you're asking think are, can write:

c = { "a": "a", "b": "b", "c": "c", "d": { "e": e } }; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -