TIL a missing semicolon in my first JavaScript file had me stuck for 3 nights | Coding For Beginners - Freelance Forum - The Community for Independent Professionals
TIL a missing semicolon in my first JavaScript file had me stuck for 3 nights
I was following a YouTube tutorial in my bedroom last Monday and my page just showed a blank white screen instead of the greeting I typed. I checked the file about 20 times and even rewrote the whole thing from scratch, but nothing worked. Then a guy in a Discord group asked me to paste my code, and he pointed at line 12 where I forgot a semicolon after a console.log. I added one tiny character and it ran on the first try after 3 days of staring at the same screen. How do you all catch dumb little mistakes like this without losing your mind?
Wasted three whole nights on a semicolon, that is a rite of passage and I am honestly impressed you rewrote the file 20 times before someone else caught it. My own worst one was a missing closing brace that made the whole page go blank, and I spent an entire weekend blaming my browser instead of my code. What saves me now is opening the console every single time I hit refresh, because most of these tiny deals show up there as a red line pointing right at the spot. Another trick is to run the code way before it is finished, like after every two or three lines, so when it breaks you know the mess is in the part you just typed. If you stare at the same file long enough your brain just fills in the missing pieces, so closing the laptop and coming back the next morning works better than another hour of squinting. The bad news is you will do this again, but the good news is you will spot it in 10 minutes instead of 3 days.