This is pure curiosity. Let's write an object:
var display = { res1:{ w:640, h:480 }, res2:{ w:320, h:240 }, nores:{} };
Now from this object, we're sending the nores property to a function. Since nores is an object, whatever we change in somefunction is going to be seen later in display.nores:
somefunction(display.nores);
Now here's the question. Does somefunction() has any form of access to display's other properties (res1 / res2) given that display is defined inside a closure and somefunction() was defined outside of that closure? I mean can it reference the whole display object just from its nores property that was passed as an argument?
Does somefunction() has any form of access to display's other properties (res1 / res2) given that display is defined inside a closure and somefunction() was defined outside of that closure?
No
I mean can it reference the whole display object just from its nores property that was passed as an argument?
There is no reverse relationship between the properties of an object and their values. The only way to find them would be to have access to the object and then to loop over it until you find a match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With