How to debug a code in JSFiddle?

0

Is there any way to debug / debug a code in JSFiddle ? Usually in the chrome development tools there are several scripts, what is the correct way to put the breakpoint's to debug the code? Is there any way to debug via code?

    
asked by anonymous 07.08.2017 / 16:23

1 answer

6

You can use the command debugger; in some line of your code, so the debugger will stop there and you can debug.

document.getElementById('teste').onclick = function (){
  debugger;
  alert('teste');
}
<button id='teste'>Teste</button>

It even works here on StackSnippet. It's worth remembering that you need to be with Developer Tools open

    
07.08.2017 / 16:26