输入年份的,输入当前的2月份的天数
<script> // 用户输入年份,输出当前年份的2月份的天数 function backDay() { var year = prompt("请输入年份:"); if (run(year)) { alert("当前年份是闰年2月有29天"); } else { alert("当前年份是平年2月有28天"); } } backDay(); // 判断是否为闰年 function run(year) { let a = false; if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { a = true; } return a; } console.log(run(2000)); console.log(run(2021)); </script>

浙公网安备 33010602011771号