4
Spent 4 hours debugging a missing semicolon in JavaScript
I was working on a simple calculator app for my portfolio and couldn't figure out why the add button did nothing. Turns out I forgot a semicolon after a function in my script.js file around line 23. Has anyone else wasted an afternoon on a tiny syntax error like that?
2 comments
Log in to join the discussion
Log In2 Comments
spencer_perry776d ago
JS is brutal like that, a missing semicolon can silently kill your whole script.
2
the_daniel6d ago
right? "silently kill your whole script" is exactly what makes it so frustrating. but here's what i don't get - if you were using a linter or even just the browser dev tools, wouldn't it have caught that right away? i mean, i used to make the same mistake until i set up eslint to scream at me every time i breathe wrong. did you check the console for errors before diving into four hours of head scratching? because usually chrome will just tell you "unexpected token" or whatever.
2