<html>
<body>
<h2>Switch case, generates system date </h2>
<p id="demo"></p>
<script>
let day;
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
document.getElementById("demo").innerHTML = "Today is " + day;
</script>
</body>
</html>________________________________________________________________________________________________________________
<!DOCTYPE html>
<html>
<body>
<h1>choose</h1>
<button onclick="myFunction()">CLICK HERE</button>
<p id="demo"></p>
<script>
function myFunction()
{
let text;
let favHero=prompt("Who is your favorite character","Tobey");
switch(favHero)
{
case "Tobey":
text=”Excellent Choice, Tobey Maguire is Classic”;
break;
case "Andrew":
text="Andrew Garfield is Amazing";
break;
case "Tom":
text="All time Fav?";
break;
default:
text="I have never heard of that SuperHEro";
}document.getElementById("demo").innerHTML=text;
}
</script>
</body>
</html>