How to debug a code in Jsfiddle?

Asked

Viewed 69 times

0

Is there any way to debug/debug a code on Jsfiddle? Usually in the Chrome development tools several scripts appear, which is the correct way to put breakpoints to debug the code? Is there any way to debug via code?

1 answer

6


You can use the command debugger; on 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 at Stacksnippet. Remember that you need to be with Developer Tools open

Browser other questions tagged

You are not signed in. Login or sign up in order to post.