Page 149 - Computer Software Application TP - Volume 1
P. 149
COMPUTER SOFTWARE APPLICATION - CITS
TASK 5 : Using switch statement
1 Open the text editor
2 Write the following codes
<html >
<head>
<title> switch statement </title>
</head>
<body>
<script>
const day = “Wednesday”;
switch (day)
{
case “Monday”: console.log(“Start of the week!”);
break;
case “Friday”: console.log(“TGIF!”);
break;
case “Weekend”: console.log(“Time to relax!”);
break;
default: console.log(“Another day in the week.”);
}
</script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Go to the browsers console tab and verify the output.
134
CITS : IT & ITES - Computer Software Application - Exercise 39