title: How to loop through months in Javascript
body: <p>I'm trying to generate a list of string dates in months 
  (i.e. ["Oct 2014", "Nov 2014",... "Jan 2015" ]) 
  using the code here: </p>
  
  <pre><code>var resultList = [];
  var date = new Date("October 13, 2014");
  var endDate = new Date("January 13, 2015");
  var monthNameList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  
  while (date &lt;= endDate)
  {
      var stringDate = monthNameList[date.getMonth()] + " " + date.getFullYear();
      resultList.push(stringDate);
      date.setDate(date.getMonth() + 1);
  }
  
  return resultList;
  </code></pre>
  
  <p>But when I run the code, the screen was frozen (like it was endless loop or something).
  I never have this problem when I generate daily date (i.e. date.getDate() +1 ). 
  Am I missing something here?</p>