javascript - How do you loop backwards through the months starting with the current one? -


I am using javascript, am trying to fill a barchart. The last line on the chart is the current month (November 2014 at the time of writing, or 10 if you use the date of javascript). GetMonth () method). It starts counting when using getMonth () in the next month (December 2013, or 11) of last year

My question: 12 months through the time starting from 11 months before the present time What is the most effective way of loop?

My favorite output will be:

  • December 2014
  • February 2014
  • ...
  • November 2014

You can use for loop and by the current date Decrease months. As shown below:

  & lt; Prior id = "output" & gt; & Lt; / Pre & gt;  

This code will want to create an array by date strings by you.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -