File tree 4 files changed +30
-55
lines changed
4 files changed +30
-55
lines changed Original file line number Diff line number Diff line change 1
- // Falsy value
1
+ // Truthy VS Falsy
2
+
3
+ // Falsy value: Any value which is treated as a false. Known as a falsy value.
2
4
// false
3
5
// 0
4
6
// -0
5
7
// BigInt 0n
6
- // ""
8
+ // Empty string: ""
7
9
// null
8
10
// undefined
9
11
// NaN
10
12
11
- // Truthy value
12
- // - Any value other than falsy.
13
+ if ( 0 ) {
14
+ console . log ( "code executed" ) ;
15
+ }
16
+
17
+ // Truthy value: Any value other than falsy.
13
18
// "0"
14
19
// "false"
15
- // " "
20
+ // String with white space: " "
16
21
// []
17
22
// {}
18
23
// function(){}
19
24
20
- // For CP and Interview
21
- // false == 0 -> true
22
- // false == "" -> true
23
- // 0 == "" -> true
24
-
25
25
const emptyArray = [ ] ;
26
26
if ( emptyArray . length === 0 ) {
27
27
console . log ( "Array is empty" ) ;
@@ -31,3 +31,16 @@ const emptyObject = {};
31
31
if ( Object . keys ( emptyObject ) . length === 0 ) {
32
32
console . log ( "Objet is empty" ) ;
33
33
}
34
+
35
+ // For Interview
36
+ // false == 0 -> true
37
+ // false == -0 -> true
38
+ // false == 0n -> true
39
+ // false == "0" -> true
40
+ // false == "" -> true
41
+
42
+ // false == null -> false
43
+ // false == undefine -> false
44
+ // false == NaN -> false
45
+ const result = false == NaN ;
46
+ console . log ( result ) ;
Original file line number Diff line number Diff line change 1
- // TODO: This example is connected to the closer concept which is the video number - 49.
1
+ // TODO: This example is connected to the closer concept which is the video number - 49.
2
2
// function outerRegularFunction() {
3
3
// const variable = "value";
4
4
// function innerRegularFunction() {
5
5
// console.log(this.variable);
6
6
// }
7
7
// console.log(innerRegularFunction());
8
8
// }
9
- // console.log(outerRegularFunction());
9
+ // console.log(outerRegularFunction());
10
+
11
+ const num = 1
12
+ if ( num ) {
13
+ console . log ( "hey" ) ;
14
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments