I am trying to get the values of longitude and latitude in to an array..
function codeAddress(address) {
var place;
var lines=[];
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
geocoder.geocode( { 'address': address}, function(results, status) {
place=results[0].geometry.location;
str=place.lng();
lines.push(place.lng());
lines.push(place.lat());
});
console.log(lines);
console.log(lines.length);
return lines;
}
but lines.length is shown as zero.. when i try to print the array lines, when i check it using firebug, it shows empty array []
bt when i try click on the [], it shows opens and shows
[]
0 1.32323
1 125.12323
i'm not sure what is wrong..
when i try to console.log(results[0].geometry.location)
it shows R { ib=1.32323, jb=125.12323, toString=function(), more...}