Update article.md
This commit is contained in:
parent
fa4a678d53
commit
32352a104f
1 changed files with 1 additions and 1 deletions
|
@ -174,7 +174,7 @@ alert( null == 0 ); // (2) false
|
|||
alert( null >= 0 ); // (3) *!*true*/!*
|
||||
```
|
||||
|
||||
Yeah, mathematically that's strange. The last result states that "`null` is greater than or equal to zero". Then one of the comparisons above must be correct, but they are both falsy.
|
||||
Yeah, mathematically that's strange. The last result states that "`null` is greater than or equal to zero". Then one of the comparisons above must be correct, but they are both false.
|
||||
|
||||
The reason is that an equality check `==` and comparisons `> < >= <=` work differently. Comparisons convert `null` to a number, hence treat it as `0`. That's why (3) `null >= 0` is true and (1) `null > 0` is false.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue