I am unsure how javascript stores objects, and references them. So, I don't know if my plan will cause bad performance. Any insight would be appreciated.
I have many divs on a website, and each has a unique id. I have an object constructor:
function box_object(box_id){
this.the_box = document.getElementById(box_id);
this.related_boxes = new Array();
}
Each box object contains a property 'the_box', which is a div on the page. Also, each box has an array called related_boxes which would be filled with other box_objects.
The reason I am concerned is because if there are 50 divs on the page, each one could have 10 related boxes. I think / hope that javascript is just storing objects in the array 'by reference' and the memory usage is small. The code obviously does more, but I tried to condense it into this example for a short question.
Does anyone have experience doing something with a lot of objects like this?
Thanks