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
-
curlyDev4698yPeople never read documentation.
But null is made into int and becomes 0 because of the >= . -
arekxv10528yI've yet to see someone ranting about JS for something other than implicit conversions. ☺
-
curlyDev4698y@Sully because == doesn't change types randomly. It tries strings to int and some other types specified in documentation
For example '0' == 0 true because it will transform the string to number.
'0' == null is false
'0' >= null is true because it forces them into int both.
Null isn't the same as in any language. -
MunzMan3058ythink of it like this .... the operator is just a function that returns a boolean value for 2 arguments , true if those arguments are from the same value & type and false if not.
-
I seriously don't know any language which treats null and null-alike types in an intuitive and consistent manner. Ducktyped languages seem intuitive but inconsistent in certain edge cases due to conversions, stricter languages are consistent but have somewhat more difficult structures to deal with it like optional/maybe types.
I think it's mostly just because nothingness is not a simple thing for humans to think about.
I really don't mind Javascript being a bit quirky, she's quite easygoing and only shows her crazy side if you push her too far on purpose.
Javascript in a nutshell
undefined