JavaScript debugger Statement
JavaScript statement reference manual
Example
With the debugger turned on, the code stops before executing the third line.
var x = 15 * 5;
debugger;
document.getElementbyId("demo").innerHTML = x;
Try it »
Definition and Usage
The debugger statement is used to stop the execution of JavaScript and call (if available) the debugging function.
Using the debugger statement is similar to setting a breakpoint in the code.
Usually, you can open the debugging tools by pressing F12 and selecting "Console" from the debug menu.
Note: If the debugging tools are not available, the debugger statement will not work.
For more JavaScript debugging information and how to activate the browser's debugging tools when unsupported, please refer to our JavaScript Debugging the tutorial.
Browser support
| Statement | |||||
|---|---|---|---|---|---|
| debugger | Yes | Yes | Yes | Yes | Yes |
Syntax
debugger;
Technical Details
| JavaScript version: | 1.0 |
|---|
Related pages
JavaScript tutorial: JavaScript Debugging
JavaScript statement reference manual