title: Returning values from Callback
body: <p>I don't have any previous javascript experience.</p>
  
  <p>I'm trying to implement the following function which I wish to use to return the values lat and lng:</p>
  
  <pre><code>function get_address() {
      var geocoder = new google.maps.Geocoder()
  
      geocoder.geocode({ address: "SE-17270 Sverige"}, 
      function(locResult) {
  
      var lat = locResult[0].geometry.location.lat();
      var lng = locResult[0].geometry.location.lng();
      alert(lat);
      alert(lng);
      })
  }
  </code></pre>
  
  <p>How do I do this?</p>
  
  <p>So what I want to do is something like this:</p>
  
  <pre><code>      function get_address(postcode)
        {
          var geocoder = new google.maps.Geocoder()
          var lat
          var lng
  
          geocoder.geocode({ address: "SE-"+postcode+"Sverige"}, 
          function(locResult) {
  
              lat = locResult[0].geometry.location.lat();
              lng = locResult[0].geometry.location.lng();
          })
          return lat,lng
        } 
  </code></pre>