T
5

Spent an hour debugging a missing semicolon in my JavaScript code

Last Tuesday I was working on a simple calculator project for my coding class. It was supposed to add two numbers together but kept returning 'undefined'. I checked my variables, my functions, my console logs, everything looked fine. After 40 minutes of staring at the screen I realized I left out a semicolon after a line in my function. One tiny little character broke the whole thing. My instructor laughed and said this happens to everyone at least 10 times before they learn. Has anyone else had a bug that was just one dumb typo?
1 comments

Log in to join the discussion

Log In
1 Comment
seth_nguyen
seth_nguyen1h agoMost Upvoted
Yeah but is it really that serious though? I mean yeah missing a semicolon can break your code but you spent an hour on it? That seems like a lot of time for something that a linter or even just good formatting would catch in like 2 seconds. I get it bugs happen but maybe the real lesson is to slow down and actually read your code instead of just staring at it waiting for the problem to jump out. Your instructor was right though that stuff happens to everyone but an hour is rough man.
6