5
Finally clicked why my variables kept overwriting themselves
I spent 3 hours yesterday chasing a bug in my todo list app, turns out I was re-declaring my array inside a loop instead of outside it. My buddy Dave tried explaining scope to me like 6 times but it only stuck when I saw it break in real time with console.log. Has anyone else had a simple concept take way too many failures to actually learn?
2 comments
Log in to join the discussion
Log In2 Comments
gray_perez5218d ago
Wait, your buddy Dave had to explain scope to you six times before it clicked? That's rough, buddy. I had a similar thing with closures where my brain just refused to accept that a function could remember variables from its parent scope. I must have watched the same YouTube tutorial like ten times before I finally got it to work in my own code. Console.log is honestly the only reason I get any coding done at all, it's like a flashlight in a dark room full of bugs. Sometimes the old school debugging methods are the most reliable, you know?
3
kai_nguyen18d ago
Ngl my buddy literally cried over a semicolon once.
2