var getLastDays = function(){
var now = new Date;
now.setMonth(now.getMonth() - 1);
now.setDate(1);
var next = new Date;
next.setDate(1);
var arr = [];
while(now < next){
arr.push(now.getDate());
now.setDate(now.getDate() + 1);
}
return arr;
}
console.log(getLastDays());