programming-examples/js/Date/Write a JavaScript function to get the last day of a month..js
2019-11-15 12:59:38 +01:00

6 lines
177 B
JavaScript

var lastday = function(y,m){
return new Date(y, m +1, 0).getDate();
}
console.log(lastday(2014,0));
console.log(lastday(2014,1));
console.log(lastday(2014,11));