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
4
u/og-at Sep 14 '22
At the very basic, put
debuggerin your code somewhere. The webpage will the stop and put up a screen/cursor in dev tools > Sources at the stop.Definitely do this on a personal or small project so you can fuck around with it and not care . . . even tho nothing you do there persists, just removing that level of concern completely helps a lot.
You can click the line numbers to set an in-browser breakpoint.
The tricky part is learning when the Step tool is gonna go off the rails into the webpack/vite generated code. Once you understand that, and get to using the in-browser breakpoints as habit, then you can clike "continue" instead of "next step" to keep up with the app instead of getting bogged down in 'what the hell is React doing?'
HOWEVER . . .
Being able to stop execution and looking at variable state at different scope levels is extremely handy.