function daysOfMonth(year, month) {
const date = new Date(year, month, 1);
const dates = [];
while (date.getMonth() === month) {
dates.push(new Date(date));
date.setDate(date.getDate() + 1);
}
return dates;
}
console.log(daysOfMonth(2023, 1));