O
12

I spent 5 hours fixing a missing semicolon yesterday

I was working on a basic JavaScript function to add up numbers in an array. Kept getting undefined as the result no matter what I tried. After rewriting the whole thing twice, I noticed I forgot a semicolon after a variable declaration in a for loop. Has anyone else lost a ton of time to a tiny typo like that?
3 comments

Log in to join the discussion

Log In
3 Comments
diana829
diana8291d ago
That's a solid point @troy_palmer76, I've been guilty of skipping the console too. 5 hours on a semicolon is brutal but honestly relatable. My record is like 3 hours over a single closing bracket in a callback function. Now I always keep dev tools open before I even start typing, it catches so much dumb stuff.
6
troy_palmer76
Did you actually check the console for errors before you started rewriting, or did you just assume it was something deeper? lol I've definitely been there staring at code for way too long over something dumb like that.
1
max_ramirez48
assuming it was something deeper" man that hit home. I spent an entire weekend rewriting a whole function once because it wasn't outputting what I expected. Turned out I forgot to call the thing with the right parameter. Just one line. Console.log would have showed me that in like two seconds. Now I literally make myself check the console first no matter how sure I am, it's saved me so many times.
8