How do I pass a variable from Google maps geocoder to another function?
<p>How could I get the value from test2 variable passed on to another function? I've been trying with global variables and by chaining functions, as suggested in another thread I found, but couldn't get those to work.  </p>

<pre><code>function codeAddress(addresstocode) {

var test2 = ['123','321'];

geocoder.geocode( { 'address': addresstocode}, function(results, status) {

    if(status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);

        coded_lat = results[0].geometry.location.Ka;
        coded_long = results[0].geometry.location.La;

        //coded_location = [{"latitude" : coded_lat, "longitude" : coded_long}];

        //test2 = returnAddress(coded_location);

        test2 = [coded_lat,coded_long];

        //coded_lat = coded_location[0].latitude;
        //coded_long = coded_location[0].longitude;
        //returnAddress(coded_location);
    }

});

console.log('test2: '+test2);

return test2;


}
</code></pre>
