30
Update: My 'simple' JavaScript loop bug took me 4 hours to fix
I kept getting 'undefined' because I was using a for...in loop on an array instead of a for...of loop. What's the most time you've lost on a tiny syntax mistake?
2 comments
Log in to join the discussion
Log In2 Comments
noahw531mo ago
Man, for...in on an array gets everyone at least once. I once spent a whole morning because I typed a single equals sign in an 'if' statement instead of a double. The code just kept running the block no matter what, and I was checking everything except that line. It's crazy how your brain just skips over the mistake after staring at it for too long.
5
jake_mason301mo ago
That single equals mistake is a classic bug, @noahw53. Your brain just locks onto the logic you meant to write and ignores the actual syntax. I've had to start reading my conditionals out loud to catch those.
2