title: JavaScript: Print previous 12 months -- "March" prints twice?
body: <p>I'm trying to write a script that prints the names of the previous 12 months. Since this month is January, it should print: December
  November
  October
  September
  August
  July
  June
  May
  April
  March
  February
  January</p>
  
  <p>Instead, it prints March twice. <a href="http://jsfiddle.net/h69gm04g/2/" rel="noreferrer">http://jsfiddle.net/h69gm04g/2/</a></p>
  
  <p>November
  October
  September
  August
  July
  June
  May
  April
  March
  March
  February</p>
  
  <p>HTML</p>
  
  <pre><code>    &lt;div id="test"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>    monthNames = [ "January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December" ];
      d = new Date();
  
      for (i = 0; i &lt; 12; i++) {  
          d.setMonth(d.getMonth() - 1);      
          monthName = monthNames[d.getMonth()];       
          $('#test').append(monthNames[d.getMonth()] + "&lt;br&gt;");       
      }
  </code></pre>
  
  <p>What am I doing wrong?</p>