@@ -22,7 +22,60 @@ let checkIt = Number(isMarried);
22
22
let check = "" ; // false
23
23
24
24
let checkBolean = Boolean ( check ) ;
25
- console . log ( checkBolean ) ; //it will give me true
25
+ // console.log(checkBolean); //it will give me true
26
26
27
27
// 1 => true , 0 => false
28
28
// "hello" => true ,"" => false
29
+
30
+ //*************************************** Operations ****************************************************** */
31
+
32
+ let str1 = "waseem" ;
33
+ let str2 = "akram" ;
34
+ let str3 = str1 + str2 ;
35
+ //console.log(str3);
36
+
37
+ //console.log(typeof ("1" + 2)); //string
38
+ //console.log(3 + 3 + "3"); //string 63
39
+
40
+ //console.log("4" + 4 + 4); // string. 444
41
+
42
+ //console.log(3 + ((4 * 5) % 2)); //3+(20%2)=>3+0=>3;
43
+ //console.log(true); //give us true
44
+ //console.log(+true); //1
45
+ // console.log(true+); // which is not valid .
46
+
47
+ let num1 , num2 , num3 ;
48
+ num1 = num2 = num3 = 3 + 3 ;
49
+ //console.table([num1, num2, num3]); // 6,6,6
50
+
51
+ let gameInit = 200 ;
52
+ gameInit ++ ;
53
+ //console.log(gameInit); //201
54
+
55
+ //Must study Prefix and postfix ..
56
+
57
+ let x = 3 ;
58
+ const y = x ++ ;
59
+ //console.log(`x: ${x} y: ${y}`); //x:4 y:3 it will increment the value of only x but y will remain only x ;
60
+ //If used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value before incrementing.
61
+
62
+ let a = 4 ;
63
+ const b = ++ a ;
64
+ //console.log(`a : ${a} b : ${b}`); // a:5 b:5
65
+
66
+ //If used prefix, with operator before operand (for example, ++x), the increment operator increments and returns the value after incrementing.
67
+
68
+ //++(++x); // this is invalid..
69
+
70
+ /************************** Examples of Postfix & prefxix **************************** */
71
+ //Postfix
72
+ let x2 = 3n ;
73
+ const y2 = x2 ++ ;
74
+
75
+ //console.log(`x2: ${x2} y2 : ${y2}`); // x2 is 4n; y2 is 3n
76
+
77
+ //Prefix
78
+ let x4 = 3n ;
79
+ const y4 = ++ x4 ;
80
+
81
+ console . log ( `x4:${ x4 } y4:${ y4 } ` ) ; // x4 is 4n; y4 is 4n
0 commit comments