js write whether the year is a leap year

<!DOCTYPE html>
<html leng = 'en'>
 	<head>
  		<meta charset = 'UTF-8'/>
	 </head>
	 <body>
	  	<script>
			var year = parseInt(prompt('请输入想判断的年份'));
			function test(year1){
    
    
				if(year1 % 4 === 0 && year1 % 400 === 0 && year1 % 100 === 0){
    
    
					console.log('该年是闰年');
				}
			}
			test(year);
  		</script>
 	</body>
</html>

Guess you like

Origin blog.csdn.net/weixin_48727085/article/details/107704936