14
Spent 6 hours on a missing semicolon in my first JavaScript project
I was building a simple to-do list app, following a guide from a site called FreeCodeCamp. Everything looked right, but the 'add task' button just would not work. I checked the logic, the event listener, everything. I even rewrote the function three times from scratch. Finally, after almost a full day, I spotted it: a missing semicolon on line 47. The console error was not helpful at all. It just said 'unexpected token'. Has anyone else lost a huge chunk of time to a tiny syntax error like that when starting out?
3 comments
Log in to join the discussion
Log In3 Comments
kevin_west5d agoMost Upvoted
Ever heard of a linter?
9
emma_dixon705d ago
Oh man, that's the worst kind of bug. Setting up a linter in your editor catches those instantly, saves so much headache. It's a total game changer for new coders.
4
young.kim5d ago
Unexpected token" has to be the most useless error message ever invented. It's like your code just points at a random spot and says "bad thing here, good luck." I spent a whole afternoon once because I used a curly quote instead of a straight one. Looked exactly the same to me.
4