title: returning GMap location object from function
body: <p>I'm trying to do a simple geocode function for a map tool. I get the geocode fine, but I'm hoping to pass the location object back as the return value for the geocode function.</p>
  
  <p>Something like this:</p>
  
  <pre><code>function codeAddress(address) {
      geocoder.geocode( { 'address': address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
              var location = results[0].geometry.location;
              console.dir(location);
              return location;
          } else {
              return false;
          }
      });
  }
  </code></pre>
  
  <p>the console.dir of the location item shows the expected location object, so the function is being called and is successfully returning data.</p>
  
  <p>this function is called by another process, which would then build the markers.</p>
  
  <pre><code>if (coordinates = codeAddress(myaddress){
      // do stuff
  }
  </code></pre>
  
  <p>However, the <code>coordinates</code> variable always evaluates as undefined, so the condition to "do stuff" is never met.</p>
  
  <p>I know I'm probably missing something really obvious about the definition of the coordinates var, but I'm not sure what it is.</p>
  
  <p>Thanks for help.</p>
  
  <p>Basic code at: <a href="http://jsfiddle.net/2TXZ4/3/" rel="nofollow">http://jsfiddle.net/2TXZ4/3/</a> though the map isn't getting drawn for whatever reason.</p>