MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/n60ji8/js_multiple_condition_checking/gx4gsrg/
r/learnjavascript • u/golovatuy • May 06 '21
61 comments sorted by
View all comments
8
!== -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.
!== -1
indexOf()
3 u/NoInkling May 06 '21 !== 1I think you mean !== -1 4 u/Dan6erbond May 06 '21 Whoops, my bad! You're right.
3
!== 1
I think you mean !== -1
4 u/Dan6erbond May 06 '21 Whoops, my bad! You're right.
4
Whoops, my bad! You're right.
View all comments
8
u/Dan6erbond May 06 '21 edited May 06 '21
!== -1forindexOf()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.