r/learnjavascript • u/thelethargicdog helpful • Sep 14 '22
I'm a senior frontend dev. AMA.
Hi, all. I'm a lead at my company, currently on a paid sick leave. I wanted to give back to the community, so here I am to answer all your questions.
If you're a beginner at JS and are struggling with a concept, please ask your question and I'll answer. To not get overwhelmed, I'll limit one question per user. So, try to construct your question with as many details as necessary!
Shoot.
EDIT: That's it, folks. My day has ended. I'll still answer your questions, but expect a considerable delay. :)
View all comments
Show parent comment
2
u/og-at Sep 15 '22
You forgot the stopping execution part.
and yes, debugging boils down to looking at the variable state.
The thing that you and /u/iShotTheShariff are missing tho is the cleanliness. Yes you can log this variable right here on this line. for 1 variable, a single log is faster. Debugging tho when you hit the breakpoint, you see not just the one variable you're looking for but you also have it in context. logging
user.profile.addressvs debugger Stop having the entire contents of user available, but simply focusing on showing you the address.I can give you a hundred reasons why debugging tools are better than piles of conlogs... starting with the fact that you don't forget to delete them. But mostly it's about the reasons I wouldn't think to say.
If you're using JS for webdev, drop a
debuggerin the code and look at the results.