1var date = new Date();
2var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
3var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
1var lastday = function(y,m){
2return new Date(y, m +1, 0).getDate();
3}
4console.log(lastday(2014,0));
5console.log(lastday(2014,1));
6console.log(lastday(2014,11));
7
8