-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut26.htm
More file actions
95 lines (75 loc) · 1.96 KB
/
tut26.htm
File metadata and controls
95 lines (75 loc) · 1.96 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!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>Scope, And conditionals</title>
</head>
<body>
<!-- div>ul>li{Item-$}*7 -->
<div>
<ul>
<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>
<li>Item-4</li>
<li>Item-5</li>
<li>Item-6</li>
<li>Item-7</li>
</ul>
</div>
<script>
var str1="This is a string";
var str1="This is a string2";
console.log(str1)
// // Here the scope of a ="u" is only inside the curly bracket
// // Scope is inside the block only
// let a ="u";
// // let a ="tr" This will show an error
// {
// // Here a = u6 can only be identified between the brackets
// let a = "u6";
// console.log(a)
// }
// console.log(a);
// You can't change the const
const a ="This can not be changed";
// a =" whyThis can not be changed";
// console.log(a)
let age = 6;
if (age>=18) {
console.log("You can drink coldrink");
}
else if(age==2) {
console.log("Age is two");
}
else if(age==5) {
console.log("Age is 5");
}
else {
console.log("You can drink water");
}
const cups = 2;
// We can't write cups = 456 or anything but we can change is value in a program like case
// If there would be no break it will print all cases at a same time
switch (cups) {
case 4:
console.log("The value of cups in 4")
break;
case 41:
console.log("The value of cups in 41")
break;
case 43:
console.log("The value of cups in 43")
break;
case 45:
console.log("The value of cups in 45")
break;
default:
console.log("The value of cup is none of 4,41,43,45 ");
break;
}
</script>
</body>
</html>