Jason Knight
Jan 2, 2021

--

Actually the null vs. zero is more complex than that. and it is NOT "more than zero". Always build a truth table.

null > 0 === false

null < 0 === false

null == 0 === false

null === 0 === false

null >= 0 === true

null <= 0 === true

There's something "special" about <= and >=, and a lot of times what it does makes no sense no matter how you look at it. What's triggering both the greater than and less than with equal is that it's not equal, which triggers a form of short-circuit eval.

A number of your other things could be combined down just because of the nature of loose comparisons.

--

--

Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse