H
20

Appreciation post: using console.log() to debug like a detective actually saved my project

I was stuck on a JavaScript loop for 3 hours last Tuesday, nothing was printing right. I tried using the debugger tool but it was too confusing for me. So I just started sprinkling console.log() everywhere to see what values were changing at each step. Turns out I had a typo in my variable name on line 12! Has anyone else found a simple tool that helped them fix a frustrating bug?
2 comments

Log in to join the discussion

Log In
2 Comments
caseyw12
caseyw121d ago
A console.log() saved me from the same kind of headache last week.
9
rowan666
rowan6661d ago
@caseyw12 yeah its always wild when the most basic thing fixes the issue. i spent like 2 hours once trying to debug why my api calls were failing just to realize i forgot to return the fetch promise. felt like such a dummy. console.log() catches so many of those small mistakes that snowball into big problems.
1