switchStatement.js
704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var grade='A';
console.log("Entering switch block");
switch (grade)
{
case 'A':
console.log("Good job");
break;
case 'B':
console.log("Pretty good");
break;
case 'C':
console.log("Passed");
break;
case 'D':
console.log("Not so good");
break;
case 'F': console.log("Failed");
break;
default:
console.log("Unknown grade")
}
console.log("Exiting switch block");
switch (grade)
{
case 'A':
console.log("Good job");
case 'B':
console.log("Pretty good");
case 'C':
console.log("Passed");
case 'D':
console.log("Not so good");
case 'F':
console.log("Failed");
default:
console.log("Unknown grade");
}
console.log("Exiting switch block");