How to get list of months javascript

Since you should be using moment to deal with dates anyway, you might as well use it here too! ;)

moment.months() or moment.monthsShort() (both added in 2.3.0):

const moment = require('moment');
moment.locale('en'); // sets words language (optional if current locale is to be used)
moment.months() // returns a list of months in the current locale (January, February, etc.)
moment.monthsShort() // returns abbreviated month names (Jan, Feb, etc.)

As far as I know, you can only get the array by hard-coding it.

var monthNames = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];

Or you can use some javascript library which has this list hard-coded.