//封装
const getDay = (month)=>{
//获取当前年份
let yeat = new Date().getFullYear()
let day = new Date(yeat,month,0).getDate()
let monthDay = []
for(let i = 1; i <= day; i++){
monthDay.push(i)
}
return monthDay
}
const num = getDay(1) //打印出来为数组
根据月份获取当前天数
最新推荐文章于 2023-05-12 15:13:07 发布