I feel like I've done this about a thousand times, but my brain can't
seem to wrap around this one. Can someone give it a nudge in the right
direction?

I have an object:
test = { key1: { original: "90210", decode: ""}, key2: { original:
"53207", decode: ""} };

I want to loop through it, decode the "original" value and store the
point result in "decode".

So:

geocoder = new GClientGeocoder();
for (key in test) {
    geocoder.getLatLng(test[key].original, function(point) {
        if(!point) { test[key].decode = false; } else {
            test[key].decode = point;
        }
    }
}

Of course the problem is that the call back function has no knowledge
of 'key' (test is a global var). I tried passing it (function(point,
key)) but that didn't work. I feel like I've done this a million times
before, but I'm just not seeing it today.

Any help is appreciated.

Nate

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to