I found this somewhere: Instead of if (count != undefined && count != null), use if(count != null). Can I use if (count == null) and if(!count) interchangeably?
count != undefined && count != null is exactly the same as count != null. !count is true if count is null, undefined, 0, NaN, the empty string, or false. (Converted to an answer while I look for a duplicate)
count != undefined && count != null is exactly the same as count != null. !count is true if count is null, undefined, 0, NaN, the empty string, or false.
count != undefined && count != nullis exactly the same ascount != null.!countis true ifcountisnull,undefined,0,NaN, the empty string, orfalse. (Converted to an answer while I look for a duplicate)