-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperators 1.html
More file actions
63 lines (53 loc) · 1.45 KB
/
operators 1.html
File metadata and controls
63 lines (53 loc) · 1.45 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
<!-- Increment & Decrement Operator -->
<script>
let a=10;
document.write(a++);//actually it is 11 but shows o/p : 10
document.write("<br/>");
document.write(++a);//o/p:12
document.write("<br/>");
document.write(a++);//o/p:12 but (13)
document.write("<br/>");
document.write(++a);//o/p:14
document.write("<br/>");
document.write(--a);//o/p:13
document.write("<br/>");
document.write(++a);//o/p:14
document.write("<br/>");
document.write(a--);//o/p:14 but (13)
document.write("<br/>");
document.write(a++);//o/p:13 but (14)
document.write("<br/>");
document.write(--a);//o/p:13
// output:
// 10
// 12
// 12
// 14
// 13
// 14
// 14
// 13
// 13
</script>
<!-- Comparison operator -->
<script>
let comp1=25;
let comp2="25";
document.write(comp1 == comp2);
document.write("<br/>");
document.write(comp1 != comp2);
document.write("<br/>");
document.write(comp1 === comp2);
document.write("<br/>");
document.write(comp1 !== comp2);
// output:
// true
// false
// false
// true
</script>
<!-- Ternary Operator -->
<script>
let age=prompt("What's Your Age ?");
document.write("You can",((age-8)<18?" not Drive" : " Drive"));
</script>