🎙️
25

Finally realized my if statements were backwards after 2 months of debugging

I kept getting weird results in my practice app and it turned out I was checking 'if x === y' when I meant 'if x !== y', which a friend spotted in 30 seconds, has anyone else had a silly logic flip like that?
1 comments

Log in to join the discussion

Log In
1 Comment
patriciah51
You mentioned your friend spotted it in 30 seconds, and that's usually how it goes, right? It's funny how a fresh pair of eyes can catch what you've been staring at for weeks. But also, I gotta say, checking `if x === y` when you mean `!==` is a pretty easy thing to mix up, especially if you're tired or you've been writing a lot of similar code that day. I did the same thing once with a login form, I had the logic flipped so it only let you in if the password was wrong, and I spent a whole weekend wondering why my test accounts kept getting locked out.
2