I have a master object, for example:
MasterObj = { property1: ... method1: ... }
and multiple other objects:
obj1 = { properties and methods... },
obj2 = { properties and methods... }
I need to make each object as a property of the master object, like:
MasterObj.obj1 = obj1; MasterObj.obj2 = obj2;
So that I can use the properties and methods of each little object in this way:
MasterObject.obj1.methodOfObj1(), etc...
and the original properties and methods of the MasterObject.
Is there any efficient way to add each object to the master, without having to do it for each object individually?
Thanks!
MasterObj.objects = [obj1, obj2, ...]
MasterObj.objects[i].propertyOrMethod
.