Skip to content

Commit 444e5bc

Browse files
committed
Add Basic of JavaScript
1 parent 2602c5f commit 444e5bc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

01_Basic/04_Comparison.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,21 @@
55
// console.log(2!=1);
66

77

8-
console.log("2" > 1);
9-
console.log("02" > 1);
8+
// console.log("2" > 1);
9+
// console.log("02" > 1);
10+
11+
// console.log(null >0) //false
12+
// console.log(null == 0) //false
13+
// console.log(null >= 0) //true
14+
15+
// The reason is that an equality check == and comparisons > < >= <= work differently.
16+
// Comparions convert null to a number, treating it as 0
17+
// That's why (3) null >=0 is true and (1) null >0 is false.
18+
19+
console.log(undefined ==0) //flase
20+
console.log(undefined >0) //false
21+
console.log(undefined <0) //false
22+
23+
// === =>strict check
24+
25+
console.log("2" === 2)

0 commit comments

Comments
 (0)