-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6-switch_case.html
55 lines (38 loc) · 1.49 KB
/
6-switch_case.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>switch case in javaScript</title>
</head>
<body>
<script>
//the working of if_else condition and switch case are same so you can use whatever you want
let totalPercentage =40;
switch (totalPercentage) {
case ( totalPercentage<50):
console.log("ups sorry.. \n you are not pass");
break;
case (totalPercentage>50 && totalPercentage<60):
console.log("congratulation \n you are pass with grade C");
break;
case (totalPercentage>=60 && totalPercentage<70):
console.log("congratulation \n you are pass with grade B");
break;
case (totalPercentage>70 && totalPercentage<85):
console.log("congratulation \n you are pass with grade A");
break;
case (totalPercentage>=85 && totalPercentage<=100):
console.log("congratulation \n you are pass with grade A+");
break;
case (totalPercentage>=50 && totalPercentage<=60):
console.log("congratulation \n you are pass with grade C");
break;
default:
console.log("please input number less then 100 ")
break;
}
</script>
</body>
</html>