Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debug javascript function on chrome console

Two Questions about debugging in chrome console :

  1. How can I debug function that I am writing directly in the chrome console on the fly ? for example
function say(){
console.log("hello");
console.log("test");
}

I want to set breakpoints,etc..

And how can I do a tab in a console for indention?

Thank you.

like image 375
dudi du Avatar asked May 02 '16 14:05

dudi du


1 Answers

1.Someone may have a better solution. Try:

debugger;say()

in your console, and then press F11 twice, you will be navigated to a VMxxxx tab, you can add breakpoints there and it will be kept.

i.e. next time you run say() in the console, the breakpoint will be triggered.

2.I haven't figured out a way to do it either, but you may try Shift+Enter to open a new line and ident with spaces, or copy a "tab" from somewhere else (a text editor) and paste it in chrome.

like image 83
Kevin Avatar answered Oct 18 '22 10:10

Kevin