Back to all solutions
#1118 - Number of Days in a Month
Problem Description
Given a year year and a month month, return the number of days of that month.
Solution
/**
* @param {number} year
* @param {number} month
* @return {number}
*/
var numberOfDays = function(year, month) {
return new Date(year, month, 0).getDate();
};