企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 一个月中的天数 ``` If (moth = 1)Then days = 31 Else If (month = 2) Then days = 28 Else If (month = 3) Then days = 31 ... ``` 使用表驱动 ``` DIm DaysPerMonth() As Interger = {31,28,31,30,31,30,31,31,30,31,30,31} days = daysPermonth(month -1) ``` ## 星期几 bad ``` const day = new Date().getDay() let day_zh; if(day === 0){ day_zh = '星期日' }else if(day === 1) { day_zh = '星期一' } ... else{ day_zh = '星期六' } ``` good ``` const week = ['星期日', '星期一',..., '星期六'] const day = new Date().getDay( const day_zh = week[day] ```