Test of adding child objects to a parent object.
This should allow defining process units in separate files, then adding them to parent processUnits object.
But does this leave child in memory too?
I can set it to null after putting into parent, but does JS garbage collection free memory?
See https://javascript.info/garbage-collection
------- SCRIPT -----------
var myParent ={};
var child01 = {name : 'joe', age : 10};
var child02 = {name : 'ann', age : 12};
myParent['child01'] = child01;
myParent['child02'] = child02;
// WARNING: have to use " around strings with ' below
document.write("<br> child02['name'] = " + child02['name'] );
document.write("<br> myParent['child02']['name'] = " + myParent['child02']['name'] );
child02 = 0;
document.write("<br> after zeroing child02, child02['name'] = " + child02['name'] );
document.write("<br> after zeroing child02, myParent['child02']['name'] = " + myParent['child02']['name'] );
------- OUTPUT -----------