Background: Recently I have been working overtime quite seriously, and I have been writing code without eating or sleeping every day. I don’t know what day it is today. There are many ways to implement it

html:

<! DOCTYPEhtml>
<html>
	<head>
		<meta charset="utf-8">
		<title>Sun Called beast test switch statement</title>
	</head>
	<body>
		<p>Click the button below to test what day it is today</p>
		<button onclick="myFunction()">Am I</button>
		<p id="demo"></p>
		<script>
			function myFunction(){
				var x;
				var d=new Date().getDay();
				switch (d){
					case 0:x="Today is Sunday.";break;
					case 1:x="It's Monday.";break;
					case 2:x="Today is Tuesday.";break;
					case 3:x="It's Wednesday.";break;
					case 4:x="It's Thursday.";break;
					case 5:x="It's Friday.";break;
					case 6:x="It's Saturday.";break;
				}
				document.getElementById("demo").innerHTML=x;
			}
		</script>
	</body&g
Copy the code