V
14

Spent 4 hours debugging a missing semicolon in JavaScript

I was working on a simple calculator app for practice and could not figure out why the add button did nothing. After staring at the code for four hours, I finally noticed I left out a semicolon after one line. It was such a tiny mistake but it broke the whole thing. Has anyone else spent forever hunting down a simple typo?
3 comments

Log in to join the discussion

Log In
3 Comments
davis.olivia
Four hours huh. I spent a whole shift once tracking down a bug that turned out to be a missing comma in an array. The worst part is the app was just a basic todo list, nothing fancy. I must have read the same line 50 times before my coworker glanced over and spotted it in two seconds. Makes you want to throw the laptop out the window. But hey, at least you can laugh about it now, right?
3
barbara_jenkins66
Oh I read something just the other day about how developers can miss obvious stuff because our brains get so used to seeing what we expect to see. There was this study about pattern recognition and how after staring at code for hours you basically go blind to the actual characters on the screen. Your coworker probably came in with fresh eyes and no expectations. That missing comma thing is brutal too because arrays are so picky about formatting. I've done the same dance with a missing bracket in a JSON file once and felt like such a fool when someone pointed it out.
8
murray.robert
Man I read something similar about how our brains fill in the gaps when we're staring at code too long. It's like your eyes see the right thing but your brain just skips over it because it expects it to be correct. That fresh pair of eyes thing is real, sometimes you just need to walk away for ten minutes and come back.
5