Underscore.js has two methods _.isNull
and _.isUndefined
which we use a lot in our code and we've also created a mix-in for _.isUndefinedOrNull
.
I recently realised that I could easily use javascripts "truthiness" to achieve the same results most of the time so the question is, is that considered bad practice?
What's better?
if(someVariable){...}
or
if(_.isNull(someVariable) || _.isUndefined(someVariable){...}