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?

@vaporeon_ there are non-nullish values that are coerced to false. or x could be false itself. That means the following values would also be treated as nullish:

false
""
0
-0
0n
NaN

@wallhackio @vaporeon_ this is a better answer than mine

0n is an arbitray purrecision integer literal ftr

Follow

re: no image descriptions 

@aescling @vaporeon_ sure Brandon Eich, why not do that

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.