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?

Follow

@vaporeon_ @wallhackio fur x === 0 (or -0, or NaN), the if (x === null || x === undefined) is if (false) but if (!x) is if (true)

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.