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.

by 스타트업러913

8 answers

True... a single semicolon eats up 3 hours.

by 데이터덕후598 · ▲0

Enable eslint + prettier and you'll be freed from this pain. Seriously.

by 주말개발자173 · ▲0

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.

by 알고리즘고수523 · ▲0

Same here... I thought it would just skip over it if there was no semicolon, but it turns out it doesn't ㅠ

by 코딩하는곰280 · ▲0

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.

by 초보개발자495 · ▲0

Ah, this one hits hard lol I once wasted two hours because of a single typo.

by 클라우드러버54 · ▲0

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.

by 프롬프트장인813 · ▲0

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.

by 클라우드러버290 · ▲0