File tree Expand file tree Collapse file tree 1 file changed +36
-16
lines changed Expand file tree Collapse file tree 1 file changed +36
-16
lines changed Original file line number Diff line number Diff line change 1+ let x ;
2+ console . log ( typeof x ) ; // "undefined"
13
4+ let y = 10 ;
5+ console . log ( typeof y ) ; // "number"
26
3- let x
4- console . log ( typeof x )
7+ let z = 10.25 ;
8+ console . log ( typeof z ) ; // "number"
59
6- let y = 10
7- console . log ( typeof y )
10+ let a = true ;
11+ console . log ( typeof a ) ; // "boolean"
812
9- let z = 10.25
10- console . log ( typeof z )
13+ let b = "nilaj" ;
14+ console . log ( typeof b ) ; // "string"
1115
12- let a = true
13- console . log ( typeof a )
16+ let c = null ;
17+ console . log ( typeof c ) ; // "object" ❗ (this is a JS quirk/bug )
1418
15- let b = "nilaj"
16- console . log ( typeof b )
19+ let d = BigInt ( 8 ) ;
20+ console . log ( typeof d ) ; // "bigint"
1721
18- let c = null
19- console . log ( typeof c )
22+ let e = Symbol ( "hi" ) ;
23+ console . log ( typeof e ) ; // "symbol"
2024
21- let d = BigInt ( 8 )
22- console . log ( typeof d )
2325
24- let e = Symbol ( "hi" )
25- console . log ( typeof e )
26+
27+
28+ console . log ( typeof NaN ) ; // "number" ❗ (NaN means "Not a Number", but still a number type)
29+
30+ console . log ( typeof Infinity ) ; // "number"
31+
32+ console . log ( typeof [ ] ) ; // "object" ❗ (Array is technically an object)
33+
34+ console . log ( typeof { } ) ; // "object"
35+
36+ console . log ( typeof function ( ) { } ) ; // "function" ✅ (Special case)
37+
38+ console . log ( typeof new Date ( ) ) ; // "object"
39+
40+ console . log ( typeof null ) ; // "object" ❗ (JS bug)
41+
42+
43+ console . log ( isNaN ( NaN ) ) ; // true
44+ console . log ( isNaN ( "hello" ) ) ; // true (because "hello" is not a number)
45+ console . log ( isNaN ( 123 ) ) ; // false
You can’t perform that action at this time.
0 commit comments