Hacker News new | past | comments | ask | show | jobs | submit login

Under the section "Debugging Property Reads": how would you convert `{configOption: true}` to `{get configOption() { debugger; return true; }}` using a conditional breakpoint?



That’s not under the conditional breakpoint heading. You would just override the value to be a getter in the console, or you could even change it in your source code if you have write access.


Thanks, I know I could do it in the console or the original source. But I was referring to the fact that the sentence in the post says to convert it to a getter "either in the original source code or using a conditional breakpoint."


Oh! I understand the question now.

You can put any expression into a conditional breakpoint, so anything you can do in the console you can do in a conditional breakpoint.

So, if you're doing this sort of thing once, you can just type it into the console and you're golden. But if you want to modify a stack local variable over and over again every time it is initialized, it's much easier to do in a conditional breakpoint because then it will happen every time that line of code runs, and your debugger never has to pause. (see https://alan.norbauer.com/articles/browser-debugging-tricks#...)


Got it! Thank you for the explanation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: