当前位置:网站首页>JS-Bom-while(计算闰年)
JS-Bom-while(计算闰年)
2022-08-08 14:24:00 【(-^_^-)】
计算是否是闰年:
非整百年:能被4整除的为闰年。
整百年:能被400整除的是闰年。

function hanshu(){
var n1 =document.getElementById('1');
var n2 =document.getElementById('2');
var n=0;
year=parseInt(n1.value);
while(n<10){//计算10次
if((year%4==0&&year%400!=0)||year%400==0)
{
//非整百年:能被4整除的为闰年。
//整百年:能被400整除的是闰年。
n++;
n2.innerHTML+=year+",";
}
year++;
}
}边栏推荐
猜你喜欢

Pretraining Weekly Issue 56: Long Text Understanding, Instant Question Answering, Mask Self-Supervision

代码随想录笔记_动态规划_322零钱兑换

浅谈 Redis 的底层数据结构

OpenInfra Days China 2022 |StreamNative 翟佳、刘德志受邀分享

华为云会议的优势【华为云至简致远】

See how three years of CRUD programmers solve database deadlocks

浅学一下二叉树链式存储结构的遍历

30K成功入职京东:拿到京东offer经验分享「面试经历+面试真题」

HackTheBox | Horizontall

【os.path】的相关用法(持更)
随机推荐
如何成为团队核心?从写出不可维护的代码开始
设计一个跨平台的即时通讯系统(采用华为云ECS服务器作为服务端 )【华为云至简致远】
接口测试,
2022-08-07 第五小组 顾祥全 学习笔记 day31-集合-Map集合
Tsinghua | GLM-130B: An Open Bilingual Pre-training Model
我凭借这份pdf成功拿到了阿里,腾讯,京东等六家大厂offer
shell------常用小工具,sort,uniq,tr,cut
Full of dry goods, Yu Jingxin class of the Institute of Information Technology, Chinese Academy of Sciences will help you get academic research and thesis writing skills
flutter 身兼数职的getx —— 简介
HackTheBox | Previse
[Redis] Bitmap and usage scenarios of bitmap (statistics of online people and user online status)
【电路基础2】电容
OrderedDict构建函数模块的不常见写法
qtwebapp库的编译及简单使用
Talking about the underlying data structure of Redis
路由器——交换机——网络交换机:区别
shell三剑客-----sed命令
30K成功入职京东:拿到京东offer经验分享「面试经历+面试真题」
6.【opencv鼠标回调事件】
See how three years of CRUD programmers solve database deadlocks