A null check JavaScript, like any other C-style language:
if (thing == null)
or
if (thing != null)
I believe that this works well in most cases against my own programming, where I write, as I, for example, in C #; however, I find that other people's code is based on things that have never been announced or installed, and the like, and, in general, it comes down to spaghetti checking null and "undefined" - yes, a literal line, really - and everything else .
source share