2
TIL the hard way that one missing semicolon can wreck a whole Saturday
Last Saturday I spent 8 hours debugging a simple JavaScript function for my first web app. Turns out I forgot a semicolon after a loop condition. The console didn't even show an error, just a blank page. Now I triple-check every line before I run it. Has anyone else had a tiny typo eat up their whole afternoon?
2 comments
Log in to join the discussion
Log In2 Comments
mila_reed3d ago
Oh man, semicolons are actually optional in JavaScript most of the time if you use line breaks correctly, so skipping one shouldn't normally crash the whole page like that. Are you sure it was the semicolon and not something else in the loop? I've had that happen where I thought it was one thing but it was actually a variable name typo.
6
jakegarcia3d ago
Yeah I totally agree with you on that. A missing semicolon alone almost never takes down a whole page unless there's something else going on. I actually ran into this last week where I was sure it was a bracket issue, but it turned out I had a typo in a variable name inside a for loop. Did you end up finding the real bug in your case?
8