title: Loop overring variable each time
body: <p>I'm looping through to get a load of long/lats from google directions. However, longArr and latArr only ever have one result in at the end, it's as if the var is getting cleared out each time</p>
  
  <pre><code> function showSteps(directionResult) {
              // For each step, place a marker, and add the text to the marker's
              // info window. Also attach the marker to an array so we
              // can keep track of it and remove it when calculating new
              // routes.
              var myRoute = directionResult.routes[0].legs[0];
              var longArr = "";
              var latArr = "";
              for (var i = 0; i &lt; myRoute.steps.length; i++) {
                  var Long = myRoute.steps[i].lat_lngs[0].B;
                  var Lat = myRoute.steps[i].lat_lngs[0].k;
                  longArr = Long + Long + "|";
                  latArr = Lat + Lat + "|";
                  alert(longArr);
                  var marker = new google.maps.Marker({
  
                      position: myRoute.steps[i].start_location,
                      map: map
                  });
                  attachInstructionText(marker, myRoute.steps[i].instructions);
  
                  markerArray[i] = marker;
              }
  
              $('.long').val(longArr);
              $('.lat').val(latArr);
  
          }
  </code></pre>