5
I finally got my loops to work by writing them out on paper first
I kept getting infinite loops in my JavaScript practice and was ready to throw my laptop. My brother, who's a mechanic, told me to just write the steps down like a checklist before typing anything. I sketched out the start point, condition, and increment for a 'for' loop, and it clicked immediately. Anyone else find that stepping away from the screen fixes the problem?
3 comments
Log in to join the discussion
Log In3 Comments
gibson.elizabeth19d ago
Yeah, I read that writing code on paper first is a classic trick for getting unstuck. It forces you to slow down and see the logic.
5
terry_thomas19d agoMost Upvoted
I mean, I've done that with spreadsheets at work and it totally helps.
6
paulw878d ago
Used to think it was a waste of time, honestly. Then I got stuck on this one loop for hours. Grabbed a notebook and just wrote it out step by step, and the mistake was so obvious on paper. Totally changed how I tackle tricky bits now.
1