15
Shoutout to the guy who told me to use console.log more
For the first 3 months I was learning JavaScript, I kept guessing why my code broke. I'd stare at the screen for 20 minutes before tweaking one thing. Then a guy on a forum told me to start sprinkling console.log statements everywhere to see what my variables actually held. Now I do that from the start of every script and it saves me hours. Just last week I found a typo in a loop condition in 2 minutes because I logged the counter. Anyone else have a simple habit that changed how they debug?
2 comments
Log in to join the discussion
Log In2 Comments
alice4453d ago
Honestly, @eva243 might be sarcastic but they're not wrong-using console.log changed everything for me too. Do you find yourself logging everything at the very start now, or do you still try to guess first before reaching for it?
5
eva2433d ago
Oh wow, you cracked the code of debugging with console.log. Groundbreaking stuff, really.
2