Consider the following code:
var obj = {};
obj.bar = 'w00p!'; //works
obj.foo.bar = 'there it is'; //throws error because bar is not set
Could you ever make obj.foo.bar =
work if obj.foo
is not set?
Is there an elegant way to set a deep variable in an object in JavaScript? In the same spirit as mkdir's -p option: mkdir -p a/deep/dir