🐿️
18

The console.log trick that finally made loops click for me

I spent like 3 weeks stuck on for loops in JavaScript. Every tutorial showed the same examples but my brain just would not wrap around what the computer was doing at each step. Then my buddy who's been coding for 5 years watched me struggle for 10 minutes and said 'just put a console.log inside the loop and watch what happens each time.' Man. Seeing the counter change and the output update line by line made it all make sense in about 20 minutes. I felt dumb for not trying that sooner since it's such a basic tool. Has anyone else had a moment where some simple debugging trick unlocked a concept for you? What was it?
1 comments

Log in to join the discussion

Log In
1 Comment
gracecarr
gracecarr1mo ago
Did the loops actually click because you finally saw the values change, or because you saw WHERE the code stopped working when something broke? For me the real unlock was putting a console.log before AND after a line, not just inside the loop. That showed me the order of operations, which mattered more than the counter itself.
3