Looking at the following code, does theme[sprite].img get nested inside result[definition].data (as theme[sprite].img is inside theme[sprite]) as well as .img becoming its own element in result[definition]?
result[definition].data = theme[sprite];
result[definition].img = theme[sprite].img;
And if that is the case, what would happen if result[definition].data.img was deleted, would that also delete result[definition].img and even theme[sprite].img?
Thanks.
If you delete
result[definition].data.img, thentheme[sprite].imgwill be deleted too, becauseresult[definiton].dataandtheme[sprite]are exactly the same single object.result[definition].imgwill retain its value beacuseresult[definition]is separate object that have in its.imgproperty copy of.imgfrom another object.This is not related in any way to nesting though. You simply reference the same object.