-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssignment-Operator.html
86 lines (54 loc) · 1.94 KB
/
Assignment-Operator.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!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>Assignment-Operator</title>
</head>
<body>
<script>
let j = 2 == "2"; // just check equal value
console.log(j);
let k = "2" === 2; // check datatype + value equal strict equality
// === (Triple equals) is a strict equality comparison operator in JavaScript, which returns false for the values which are not of a similar type. This operator performs type casting for equality. If we compare 2 with “2” using ===, then it will return a false value.
console.log(k);
let y = 9;
// y++;
// y = y + 1;
// y--;
// y = y-1;
y += 320; // (best method)
console.log("value of y is = " , y);
y-=30;
console.log("value of y is = " , y);
y*=20;
console.log("value of y is = " + y);
y/=20;
console.log("value of y is = " + y);
y%=20;
console.log("value of y is = " , y);
let check = y % 2 == 0;
console.log("value is = " , check );
// ( Assignment Operator )
// (Arithmetic + Assignment)
// Types of Assignment Operator
/* 1. Simple Assignment =
2. Addition Assignment += // c = c+1 , c +=1 .. c=c+1
3. Subtraction Assignment -= // c = c-1 , c -=1 .. c=c-1
4. Multiplication Assignment += // c = c*1 , c *=1 .. c=c*1
5. Division Assignment /= // c = c/1 , c /=1 .. c=c/1
6. Modulus Assignment %= // c = c%1 , c %=1 .. c=c%1
*/
// ( Relational + Arithmetic +Assignment)
let a = 7 , g = 9;
let f= (a>=7) + (g<=9);
console.log("Value of f is = " , f);
// Boolean Operator
let b= true;
let c = false;
let d= !(b&&c) || (!c || b);
console.log( " value is = " , d );
</script>
</body>
</html>