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?
            Asked
            
        
        
            Active
            
        
            Viewed 912 times
        
    -3
            
            
        
        Prashant
        
- 3,823
 - 3
 - 25
 - 40
 
- 
                    1`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) – Ry- Aug 18 '16 at 09:44
 - 
                    https://dorey.github.io/JavaScript-Equality-Table/ – Etheryte Aug 18 '16 at 09:44
 
1 Answers
5
            
            
        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.
        Ry-
        
- 218,210
 - 55
 - 464
 - 476