- :
var falsey = ["0", "", "false", "null", "undefined", "NaN"];
var isFalse = false;
for(var i = 0, len = falsey.length; i < len; i++){
if(options + "" == falsey[i]){
isFalse = true;
break;
}
}
, , , options falsey 0, "", false, null, undefined, NaN
This will detect them no matter what they were (the technique is similar to the upper case of both search words and comparison words)
Since the list is short, you can also do this using switch cases, otherwise ifs
source
share