22
Spent 4 hours yesterday because I forgot one semicolon in my JavaScript
I was trying to make a simple button that changes the page color. My code looked right, I checked the function names, the event listener, everything. The browser console just kept saying 'unexpected token' and pointing to a blank line. I went through three different online guides, even rewrote the whole thing from scratch twice. Finally, after making a cup of coffee and stepping away, I saw it. A missing semicolon on line 17, right after a variable. My whole program broke because of one tiny punctuation mark. It's so easy to miss when you're starting out and the error messages don't really help. Has anyone else lost a huge chunk of time to something that small?
2 comments
Log in to join the discussion
Log In2 Comments
harperc792d ago
That part about the error pointing to a blank line is the real killer. It makes you doubt your whole understanding of the language. The real problem isn't the missing semicolon itself, it's that the parser gets confused and reports the error in the wrong place. You end up looking for a ghost bug. It's a flaw in how the tools report the mistake, not really in your code.
1
wren3012d ago
Totally feel that, it's like the compiler is gaslighting you. Had a similar thing happen with a missing bracket in JavaScript, spent an hour staring at a line that was perfectly fine. The worst part is when you finally find it, you feel both relieved and stupid.
6