I am working with a javascript object and need to set a value deep in the object structure.
Lets say:
a.b.c.d.e.f.g = "some value";
I don't know if all of these objects are created yet, so I end up doing:
a = a || {};
a.b = a.b || {};
a.b.c = a.b.c || {};
a.b.c.d = a.b.c.d || {};
a.b.c.d.e = a.b.c.d.e || {};
a.b.c.d.e.f = a.b.c.d.e.f || {};
a.b.c.d.e.f.g = "some value";
Surely there is a better way to do this right?