-3

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?

2
  • 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) Commented Aug 18, 2016 at 9:44
  • dorey.github.io/JavaScript-Equality-Table Commented Aug 18, 2016 at 9:44

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.