Is it better to validate user input using this method
if (obj == null) {
// detects null and undefined
// exit the function, input not validated
}
or this method
if (!obj) {
// detects false, 0, -0, '', null, undefined, NaN
// exit the function, input not validated
}
In this particular case, obj represents an array to be looped through.
I'm having difficulty deciding which method to use.