Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. var bounds = new google.maps.LatLngBounds();
  2. cities.forEach(function (value, index) {
  3. var myLatLng = new google.maps.LatLng(value.lat, value.lng);
  4. bounds.extend(myLatLng);
  5.  
  6. var marker = new google.maps.Marker({
  7. position: myLatLng,
  8. map: map,
  9. title: "My Town"
  10. });
  11. });
  12. map.fitBounds(bounds);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement