This might have been asked before, but I didn't see exactly this question:
Is there a way to declare an object in javascript such that I can directly assign values in multiple levels of nesting (without declaring each level along the way)?
Example:
var obj = {};
obj["key1"]["key2"]["key3"] = "value";
obj["key1"]["key4"]["key5"] = "value2;
The above doesn't work for me, but since I'm creating the object dynamically, creating each level along the way for each key would be costly as I'd have to check for existence first..
ie:
if (!obj["key1"]) obj["key1"] = {};
elseif (!obj["key1"]["key2"]) !obj["key1"]["key2"] = {};
... etc
I hope that makes sense.