118
The JavaScript type coercion algorithm
(lemmy.ml)
Post funny things about programming here! (Or just rant about your favourite programming language.)
To make it even worse
Mh, '0' is a nonempty string, so !'0' returns false. Then of course !(!'0') would return true. I'd absolutely expect this, Python does the same.
And the second thing is just JavaScript's type coercion shenanigans. In Python
Knowing that JavaScript does a lot of implicit type conversions, stuff like that doesn't strike me as very surprising.
wait hang on...