Javascript Switch case practice code
//switch case and make a short program of daysvar day=parseInt(prompt("Enter your day number"));switch (day){case 0:document.write("<h1> <br/>Today is monday");break;case 1:document.write("<h1> <br/>Today is tuesday");break;case 2:document.write("<h1> <br/>Today is wednesday");break;case 3:document.write("<h1> <br/>Today is Thusrday");break;case 4:document.write("<h1> <br/>Today is friday");break;case 5:document.write("<h1> <br/>Today is saturday");break;case 6:document.write("<h1> <br/>Today is sunday");break;default:document.write("<h1> <br/>Your day value is invalid");break;}
//switch case and make a short program of days
var day=parseInt(prompt("Enter your day number"));
switch (day){
case 0:
document.write("<h1> <br/>Today is monday");
break;
case 1:
document.write("<h1> <br/>Today is tuesday");
break;
case 2:
document.write("<h1> <br/>Today is wednesday");
break;
case 3:
document.write("<h1> <br/>Today is Thusrday");
break;
case 4:
document.write("<h1> <br/>Today is friday");
break;
case 5:
document.write("<h1> <br/>Today is saturday");
break;
case 6:
document.write("<h1> <br/>Today is sunday");
break;
default:
document.write("<h1> <br/>Your day value is invalid");
break;
}
<script>
//switch case and make a short program of daysvar day=parseInt(prompt("Enter your day number"));
switch (day){
case 0:
document.write("<h1> <br/>Today is monday");
break;
case 1:
document.write("<h1> <br/>Today is tuesday");
break;
case 2:
document.write("<h1> <br/>Today is wednesday");
break;
case 3:
document.write("<h1> <br/>Today is Thusrday");
break;
case 4:
document.write("<h1> <br/>Today is friday");
break;
case 5:
document.write("<h1> <br/>Today is saturday");
break;
case 6:
document.write("<h1> <br/>Today is sunday");
break;
default:
document.write("<h1> <br/>Your day value is invalid");
break;
}
</script>
x