title: Can't get google maps computeDistanceBetween() to return a value
body: <p>The <code>computeDistanceBetween()</code> function in google maps geometry library will not return a value for me. Using the <code>alert</code> function it says the distance is "[object, Object]". Can anyone see where I'm going wrong? here are the important parts of the code in question:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=geometry"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" &gt;
  
      var myArray1= [['location1', lat1, lng1], ['location2', lat2, lng2], ...];
      var myArray2= [['locationA', latA, lngA], ['locationB', latB, lngB], ...];
      var arrays = [myArray1, myArray2];
  
      function codeStart() {
        var orig;
        var startAddress = document.getElementById("start").value;
        geocoder.geocode( { 'address': startAddress}, function(results, status) {
              if (status == google.maps.GeocoderStatus.OK) {
                  var i = 0;
                  var input = results[0].geometry.location;
                  while (i &lt; arrays.length) {             
                      orig = closest(input, arrays[i]);
                  }
              }
        });
      }
  
      function closest(latlng, array){
        var distance;
        var c = 0;
        while (c &lt; array.length){
            var location = array[c];
            var locationlatlng = new google.maps.LatLng(location[1],location[2]);
            distance = new google.maps.geometry.spherical.computeDistanceBetween(latlng, locationlatlng);
            alert(distance);  // popup box says "[object, Object]"
            c++;
        }
      }
  
  &lt;/script&gt;
  </code></pre>