Your preferred style(s) for checking for nullish in JavaScript:
@wallhackio Why would you ever write any of the above two options instead of if (!x)? Asking as a C programmer. Are there any situations where these do different things?
if (!x)
@vaporeon_ @wallhackio fur x === 0 (or -0, or NaN), the if (x === null || x === undefined) is if (false) but if (!x) is if (true)
x === 0
-0
NaN
if (x === null || x === undefined)
if (false)
if (true)
A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.