15
Spent 3 months writing messy JavaScript before realizing I could just use console.log properly
I kept adding random alert() boxes everywhere to debug my loops, then a buddy from a coding Discord showed me how to inspect objects in the browser console. Has anyone else had a moment where a simple tool was staring them in the face the whole time?
2 comments
Log in to join the discussion
Log In2 Comments
the_jason1mo ago
Honest question, don't you think relying on console.log too early can make you miss how the whole code structure is actually working? I've seen people get stuck debugging single lines instead of stepping back and understanding the flow.
3
mason_lee1mo ago
Yeah, building on what @the_jason said about stepping back - I think there's a balance. console.log is great for quick checks but if you're sprinkling them everywhere without a plan, you're basically just guessing. I've caught myself adding logs in loops to track counter values when really I just needed to check if my array had the right data coming in. Once you learn to log the actual objects and arrays, you start seeing the bigger picture instead of chasing random numbers.
3