I am trying to return lat , lon for address it prints array on console.log but does not work in function return
var markers = new Array();
var cityCircles = new Array();
var polycordinates = new Array();
var previousepolygones = new Array();
var infoxboxs = new Array();
function initialize() {
var mapProp = {
center:new google.maps.LatLng(44.03121020078675, 23.41763112193103),
zoom: <?= (isset($zoom) and $zoom != '') ? $zoom : '7' ?>,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("googleMap"),mapProp);
console.log(getcountrylatlng("Romania"));
}
function getcountrylatlng(countryname){
var geocoder = new google.maps.Geocoder();
geocoder.geocode(
{'address': countryname},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
//var result = results[0].formatted_address;
//var city = result.split(" - ");
//console.log(results[0]);
return results[0];
}
}
}
);
}
on console.log it returns an object but if i return value as in above function it returns undefined
Need help with this ,