4 ms·
I did not know about the debugger statement until I read your comment: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger htt
by TYMorningCoffee 5y ago
I did not know about the debugger statement until I read your comment: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... . Thank you.
- aerovistae 5y agoMassively useful! I also recently learned you can right click a line of code in the chrome debugger to add a logpoint - i.e. "log the value of this expression when you reach this point in the code" - so I don't have to manually add console.log statements. Basically the reverse of discovering the debugger statement!
- culturestate 5y ago> you can right click a line of code in the chrome debugger to add a logpoint...so I don't have to manually add console.log statements Thank you, this is the best thing I've learned in 2022.
- Vinnl 5y agoNext try https://www.replay.io https://www.replay.io, which allows you to add logpoints to code that has already executed.
- core-utility 5y agoThis was news to me too
- AdamTReineke 5y agoOne more trick: Add a conditional breakpoint with the condition: `value = "someOverrideValue", false` to make the breakpoint change the value when it is reached without actually stopping execution. Great for when you need state changed but the app is always trying to override it. Here's a video from a talk I gave five years ago that demonstrates that: https://youtu.be/uixXOTCNbhs?t=1182 https://youtu.be/uixXOTCNbhs?t=1182
- therein 5y agoYou can also right click a DOM element in the inspector and click `store as a global variable`. It will automatically do the following for you temp1 = document.querySelector(SELECTOR_FOR_NODE_YOU_PICKED)
- xeromal 5y agoIt's pretty powerful. I oftentimes struggle to get VS code to pick up a breakpoint when debugging serverless node functions, but the debugger statement usually gets it working.