function isNil(value)
We instead have function isNullOrUndefined(value) ...
instead, but it does the same thing.
It's especially lame since you can't just do if (!value) ...
since that includes 0 (but not []
or {}
, which Python considers falsey). It's remarkably inconsistent...
basically every language under the sun has NaN
Yup, but you can use NotNan
in Rust, just like your NonNull
example.
And yeah, it's weird that JavaScript doesn't have an integer type, everything is just floating point all the way down. I actually did some bitwise logic with JavaScript (wrote a tar implementation for the web), and you get into weird situations where you need to >>> 0
in order to get an unsigned 32-bit integer (e.g. (1 << 31) >>> 0
). Those hacks really shouldn't be necessary...