title: Google Maps : function returns undefined value works fine in console.log
body: <p>I am trying to return lat , lon for address  it prints array on console.log but does not work in function return </p>
  
  <pre><code>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: &lt;?= (isset($zoom) and $zoom != '') ? $zoom : '7' ?&gt;,
          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];
                  }
              }
          }
      );
  }
  </code></pre>
  
  <p>on console.log it returns an object but if i return value as in above function it returns  <code>undefined</code> </p>
  
  <p>Need help with this , </p>