Spent 3 Hours on a Bug and It Was a Semicolon
I was really wondering why it kept not working, lol
No error logs either, it just silently didn't run. I was logging to the console and checking every single function, and it turned out I was missing one semicolon.
Another day done.
8 answers
True... a single semicolon eats up 3 hours.
Enable eslint + prettier and you'll be freed from this pain. Seriously.
Well, that's a bit... When a semicolon is missing, you'd usually get a SyntaxError, or ASI would insert one for you — so "silently doesn't run" doesn't really add up. Could it have been some other cause? Let me know the steps to reproduce it.
Same here... I thought it would just skip over it if there was no semicolon, but it turns out it doesn't ㅠ
I stayed up all night over this once too, and it turned out to be a single curly brace lol. Since then, I've made a habit of running the linter every time I save. That's a lesson you can't buy.
Ah, this one hits hard lol I once wasted two hours because of a single typo.
The scariest thing is when it dies quietly without throwing any error logs. At least if there’s red text, you can track it down. Nice job breaking it down function by function while adding console logs, but next time, try narrowing it down by cutting it in half with binary search. That cuts 3 hours down to 30 minutes.
I disagree. These days, most IDEs will catch a missing semicolon for you, won't they? The issue is that you didn't configure it—not the semicolon's fault, I'd say.