How to insert a breakpoint in Javascript by code

3

I know that it is possible to mark a line as a breakpoint using Dev Tools, but is it possible to invoke the browser debugger directly from the code?

    
asked by anonymous 23.03.2017 / 21:48

1 answer

5

You can use the keyword debugger

function(){
   debugger; // quando estiver no modo de debug (F12) o cursor irá parar aqui
   alert("Is me...");
}
    
23.03.2017 / 21:50