13
That "just use console.log" advice almost cost me a whole day
I was reading a beginner thread on another forum where someone said "just use console.log" for everything. So I spent like 6 hours trying to debug a function that wasn't returning what I expected, just logging values here and there. Has anyone else tried using a proper debugger tool and found it way faster for tracking down the actual flow of your code?
3 comments
Log in to join the discussion
Log In3 Comments
the_felix9d ago
Six hours lost to console.log is brutal, I've been there myself and it stings every time. Stepping through code line by line with a proper debugger helps catch those little logic errors that logging just can't show you. That beginner advice really does set people up for a frustrating day like yours.
2
blake_kelly199d agoMost Upvoted
Yeah exactly @the_felix, logging is cool for quick checks but it's not some magical fix for everything. People act like console.log is the only tool you'll ever need and that's just not true. Stepping through the debugger saves so much time when you've got a weird bug that only shows up sometimes. I wish more tutorials would show debugging early on instead of just saying spam console.log everywhere. That mindset is honestly what made me waste hours early on too.
2
iris_barnes878d ago
Started using the breakpoints in Chrome DevTools after a similar loss of time, and it was night and day. Setting a breakpoint right where I thought the bug was let me watch each variable change step by step, saw that a loop was skipping an item because I messed up the index. The call stack feature also helped me trace back to the function that actually passed the wrong data, something I never would have found with console.log.
2