How To Use Switch Case in Javascript

How To Use Switch Case in Javascript


<html>
<head>
<title> this is my second java script programe
</title>

<script language="javascript" type="text/javascript">
var s=prompt("enter a no ","");

s=parseInt(s);
switch(s)
{
case 1:
document.write("You have to press one ");
break;
case 2:
document.write("you have to press two");
break;
case 3:
document.write("you have to press three");
break;
case 4:
document.write("you have to press four");
break;
default:
document.write("you have to wrong choice");
break;
}
</script>
</head>
<body>
<p>
</p>
</body>
</html>

No comments:

Post a Comment

Thank You For Your Great Contribution

Featured Post

how to post formdata or http.context.form data from angular 6 to asp.net mvc web api or api using Token based authentication with header

how to post formdata or http.context.form data from angular 6 to asp.net mvc web api or api using Token based authentication with header  ...

Popular Posts