-
Notifications
You must be signed in to change notification settings - Fork 0
/
51JSIfElse.html
71 lines (61 loc) · 1.72 KB
/
51JSIfElse.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!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>If Else</title>
</head>
<body>
<div>
<ul>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
<li>Item5</li>
<li>Item6</li>
<li>Item7</li>
<li>Item8</li>
</ul>
</div>
<script>
var string1 = "My name is Chintan Patel";
var string1 = "Hello my name is Chintan Patel";
console.log(string1);
let a = "u"; {
console.log(a);
}
// It was throw error because str is constant declare
const str = "This cannot be changed";
// str = "I am changing";
console.log(str);
let age = 24;
if (age > 18) {
console.log("You can drive a car");
} else if (age < 18) {
console.log("You cannot drive a car");
} else {
console.log("Please enter the valid age");
}
const value = 3;
switch (value) {
case 1:
console.log("The value of cups is 1");
break;
case 2:
console.log("The value of cups is 2");
break;
case 3:
console.log("The value of cups is 3");
break;
case 4:
console.log("The value of cups is 4");
break;
default:
console.log("The value of cups is 1, 2, 3 and 4");
break;
}
</script>
</body>
</html>