hawkeye hawkeye - 3 months ago 13
Javascript Question

Why doesn't the JavaScript debugger pause at debugger statement?

I expect when I insert the JavaScript debugger statement into my JavaScript code that the program will pause at that point and the debugger will open showing the 'breakpoint'.

I'm not seeing this at all.

Here is my code.

<html>
<script type="text/javascript">
debugger;
alert("Hello world!")
</script>
<body>
<p>Hello world</p>
</body>
</html>


When I run it - I go straight to the 'alert' popup on screen. What is the step I'm missing?

My question is: Why doesn't the JavaScript debugger pause at debugger statement?

(Just to clarify - I had the developer tools open - but at the 'console' tab, not the 'sources' tab.)

Answer

You need to open the Developer Tools before the debugger; is executed.

Open using F12 key (read this to learn about more features)


See it in action:

Developer Tools are not opened

enter image description here


Developer Tools are opened

enter image description here

http://jsfiddle.net/qkd5swv9/