Page 94 - PortGPT_V2.1_C8_Flipbook
P. 94
Program 8: To check whether a student’s performance is good, better or best.
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE> Switch Statement2 </TITLE>
</HEAD>
<BODY>
<SCRIPT>
var choice = parseInt(prompt("Enter 1 for Good / 2 for better / 3 for
best"));
switch(choice)
{
case 1:
document.write("Good");
break;
case 2:
document.write("better");
break;
case 3:
document.write("best");
break;
default:
document.write("invalid");
}
92 Premium Edition-VIII

