title: Javascript for loop behaviour outputting the same result each iteration
body: <p>I'll admit I'm a bit of a JS novice, and coming from a PHP background, my idea of scope is clearly different to Javascript's.</p>
  
  <pre><code>// There's a date set, so begin processing
  var original_date       = new Date($('input#tour_encoded_dates').val());
  var date_search_string  = ''; 
  var day_limit           = 14;
  var timestamp           = '';
  
  // Go forwards day_limit days
  for(var i = 0; i &lt; day_limit; i++) {
      timestamp = strtotime('+'+i+' days', original_date);
      calculated_date = new Date(timestamp).format('Y-m-d');
      date_search_string += calculated_date + ' ';
  }
  
  console.log(date_search_string);
  </code></pre>
  
  <p>The output from <code>console.log()</code> is:</p>
  
  <p><code>2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10 2013-10-10</code></p>
  
  <p>I would have expected each iteration to increase the date by one day, but they remain the same.</p>
  
  <p>For reference, if I change the final line of the loop to <code>date_search_string += timestamp + ' ';</code> the output is as follows:</p>
  
  <p><code>1381363200000 1381363286400 1381363372800 1381363459200 1381363545600 1381363632000 1381363718400 1381363804800 1381363891200 1381363977600 1381364064000 1381364150400 1381364236800 1381364323200</code></p>
  
  <p>So the issue is clearly with the <code>calculated_date</code> variable - right?</p>
  
  <p>Can someone explain the proper way to do this? Thanks.</p>