title: Google Maps - Array
body: <p>Hey guys I just started a new project with google maps. I'm a newbie in both javascript and google maps API.</p>
  
  <p>UPDATED:
  What I'm trying to do is to add a informationWindow to each marker with different content. So when the marker is clicked, the content for that specific marker pops up.</p>
  
  <p>Right now only the 4th element pops up. I need so that every marker pops up with information.</p>
  
  <p>Is there any other way of doing this?</p>
  
  <p>Thanks in advance,</p>
  
  <p>UPDATED:</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Google Maps JavaScript API v3 Example: Marker Animations Loop&lt;/title&gt;
      &lt;link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet"&gt;
      &lt;script src="https://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
      &lt;script&gt;    
  
  
       var myLatlng = new google.maps.LatLng(53.014783, -95.097656);
  
       var iterator = 0;
  
       var neighborhoods = new Array(
           new Array("test1","49.165206","-122.665443"),
           new Array("test2","49.14476","-121.98544"),
           new Array("test3","49.162063","-122.667675"),
           new Array("test4","48.455005","-123.54155"),
           new Array("test5","51.038156","-114.035339") 
       );
  
       var markers = [];
  
       function initialize()
       {        
          var mapOptions = {
             zoom: 4,
             center: myLatlng,
             mapTypeId: google.maps.MapTypeId.ROADMAP
          };
  
          var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);               
  
  
           /*for (var i = 0; i &lt; neighborhoods.length; i++)
           {
               markers[iterator] = new google.maps.Marker(
                   {
                       position: neighborhoods[iterator],
                       map: map,
                       title: 'Hello World!'
                   }
               );        
               iterator++;
           };*/
  
  
          var infowindow = new google.maps.InfoWindow({
  
          });         
  
          for(var i = 0; i &lt; neighborhoods.length; i++)
          {
  
              var marker = new google.maps.Marker(
                   {
                       position: new google.maps.LatLng(neighborhoods[i][1], neighborhoods[i][2]),
                       map: map,
                       title: neighborhoods[i][0]
                   }
               );
  
              var test = neighborhoods[i][0];
  
              google.maps.event.addListener(marker, 'click', function(e) {
                  infowindow.open(map,marker);                
                  infowindow.setContent(test);
              });
          } 
  
       };   
  
  
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body onload="initialize();"&gt;
      &lt;div id="map_canvas" style="width: 1000px; height: 700px;"&gt;map div&lt;/div&gt;
      &lt;!--button id="drop" onclick="drop()"&gt;Drop Markers&lt;/button--&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>