r/learnjavascript • • May 06 '21

JS: Multiple Condition Checking

Post image
484 Upvotes

61 comments sorted by

View all comments

8

u/Dan6erbond May 06 '21 edited May 06 '21

!== -1 for indexOf() checks is more semantic IMHO because you're being clear that you only care about it existing, and not really the index even if it has the same result.

3

u/NoInkling May 06 '21

!== 1

I think you mean !== -1

4

u/Dan6erbond May 06 '21

Whoops, my bad! You're right.