title: How to get previous 6 months date from current date in javascript
body: <p>I am trying get last six months date from current date .</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var d = new Date();
  var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
  alert(months[d.getMonth()-6]);</code></pre>
  </div>
  </div>
  </p>
  
  <p>but i am getting <code>udefined</code></p>