B
20

Spent 4 hours debugging a missing semicolon in JavaScript yesterday

I was working on a simple calculator project for my coding class and the whole thing just refused to run. It took me until 11 PM to realize I forgot a semicolon on line 47 of my script.js file. Has anyone else spent way too long hunting down a tiny typo like that?
3 comments

Log in to join the discussion

Log In
3 Comments
brian_smith6
Tbh I spent three hours on a missing comma in React once. The whole app just showed a blank white screen and I was ready to throw my laptop out the window. Honestly it makes you feel so dumb when you finally spot it.
1
joel_martinez
Correct me if I'm wrong, but missing commas don't cause blank white screens in React. That's usually a syntax error or an uncaught exception. A missing comma in an object or array will just throw a JavaScript error that you'd see in the console. The blank white screen is probably from the whole component crashing, not the comma itself. The comma might have been part of a bigger issue, like breaking the JSX structure. Either way, I've been there too and it always feels silly when you finally find it.
3
miles_garcia
Yeah but I mean, a missing comma in an object literal can actually cause a blank white screen if it's inside a React component that's rendering something important. Like if you have a state object missing a comma, the whole thing fails to parse and the component never mounts, so you just get nothing. It's not like React ignores that error and shows something else, it just dies silently if you don't have error boundaries set up. So technically the missing comma itself isn't the error, but it's what triggers the crash that gives you the white screen. idk, just splitting hairs at that point I guess.
5