title: Google MAP API v3: Center & Zoom on displayed markers
body: <p>I use the following code to set markers on my map:</p>
  
  <pre><code>  var latLngs = []
    $.each(locations.markers, function(i, m){
     var myLatLng = new google.maps.LatLng(m.latitude, m.longitude);
     latLngs[i] = myLatLng                                          
     var marker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      shadow: shadow,
      icon: image,
      shape: shape,
      title: m.city,
      zIndex: i
     });
    }) 
  </code></pre>
  
  <p>The markers show up on my map. Now I would like to center &amp; zoom the map on these markers. How can I accomplish this?
  I have tried:</p>
  
  <pre><code>map.fitBounds(getBoundsForLatLngs(latLngs));
  </code></pre>
  
  <p>The console.log of latLngs gives out:</p>
  
  <pre><code> [(46.793182, 7.146903) { b=46.793182,  more...}, (46.8077779, 7.1709386) { b=46.8077779,  more...}]
  </code></pre>
  
  <p>But it doesn't seem to work, and I get no error in the console. What am I doing wrong?</p>