O
18

Spent 3 hours debugging a missing semicolon last night

I was working on a simple JavaScript loop for my class project and couldn't figure out why it kept breaking. Turned out I left out one semicolon in line 12. Has anyone else wasted that much time on something so dumb?
3 comments

Log in to join the discussion

Log In
3 Comments
mason_flores21
Bro line 12 is always where the dumb bugs hide. I had a similar thing with a React project last semester where I spent like 4 hours trying to figure out why my state wasn't updating. Turns out I put a colon instead of a comma in my object. That tiny mistake broke everything. Honestly I feel like those little syntax errors hurt way more than big logic problems cause they're just so stupid.
0
kevin218
kevin21816d ago
Bro line 12 is always where the dumb bugs hide" - dude that's too real. But actually I gotta say, a colon instead of a comma doesn't usually break everything in JS, it just makes the object syntax invalid so your code won't even run. That's way easier to catch than a bug where your state just silently doesn't update. Still sucks though, four hours is rough for something that small.
2
torres.leo
torres.leo16d ago
Wait, hold up. @kevin218 are you serious? A colon instead of a comma cost you four hours? That's painful just reading it. I've been there though, those tiny punctuation mistakes are the worst because your brain just skips right over them. You stare at the code for an hour thinking you have some deep state management issue when really you just typed a : instead of a ,. It's almost insulting how simple the fix ends up being. With React specifically, the silent failures are the absolute worst. At least with a syntax error you get a red screen that tells you something is wrong, but state just quietly stops working and you're left guessing.
6