Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4669027yNull is neither true or false or a number so no, you can’t compare it.
Null is a black hole that can’t be measured but we know it’s there, well not there actually. -
D--M22667y5 seconds of google would get you:
"
In Summary:
Relational Comparison: if both values are not type String, ToNumber is called on both. This is the same as adding a + in front, which for null coerces to 0.
Equality Comparison: only calls ToNumber on Strings, Numbers, and Booleans.
" -
Root797617yWhy are you comparing values with something that, by definition, is the lack of a value?
You're the purple plastic pancake, not JS. -
@olback its false in any language its the IEEE 754 specification that any NaN comparison is false.
-
py2js27657yNope don't blame it on JavaScript. I know it's not the best language but it's something you should know about the language
-
Astatos2657ySince nobody explains the stuff with larger than and smaller than:
< and > check if the value is in the requested range
I.e. Null > 0 is false because null is not in the range of greater than zero
>= and <= check if the value is missing in the opposite range
I.e. Null <= 0 is true because null is not in the range of greater than zero -
Grexius14647y@Astatos
On one end I feel like that makes a lot of sense, but on another end I feel like that makes absolutely no fuckin' sense. -
So....try to query a db & it will also not know what to do with null values..
& try looking for javascript fibonaccy function made of arrays & objects, only brackets nonsense but it works..
Related Rants
OH FUCK YOU TOO JAVASCRIPT
rant
all your base are not belong to us
js
wtf