Monday, November 9, 2015

Javascript Tutorial For Beginners 9 # JavaScript Switch Statement





<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>javascript</title>
</head>
<body >

<p id="demo"></p>

<script type="text/javascript">
var score = 95;
var result ;

switch (score) {
case 100:
case 95:
case 90:
 result = "very good";
 break;

case 60:
 result = "good";
 break;

case 40:
 result = "ok";
 break;
default:
 result = "unknown";
}


document.getElementById("demo").innerHTML= result ;

</script>
</body>
</html>








No comments:

Post a Comment