当前位置:网站首页>JS use the switch statement to output the corresponding English day of the week according to 1-7

JS use the switch statement to output the corresponding English day of the week according to 1-7

2022-06-27 07:35:00 I am the sun?

Code :

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>switch Query day of week English </title>
	<script type="text/javascript">
		var week = +prompt(" Please enter 1-7:");
		switch(week){
			case 1:
				console.log("Monday");
				break;
			case 2:
				console.log("Tuesday");
				break;
			case 3:
				console.log("Wednesday");
				break;
			case 4:
				console.log("Thursday");
				break;
			case 5:
				console.log("Friday");
				break;
			case 6:
				console.log("Saturday");
				break;
			case 7:
				console.log("Sunday");
				break;
			default:
				console.log(" Not within the scope of the query ..");
				break;
		}	
	</script>
</head>
<body>
	
</body>
</html>

Running results :
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[I am the sun?]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206270720100142.html