JavaScript debugger statement
- Previous Page continue
- Next Page do...while
- Go to the Previous Level JavaScript Statement Reference Manual
Definition and Usage
The debugger statement stops the execution of JavaScript and calls (if available) the debugging function.
Using the debugger statement has the same function as setting a breakpoint in the code.
通常,您可在浏览器中使用 F12 键激活调试,然后在调试器菜单中选择“控制台”。
Note:If no debugging is available, the debugger statement is invalid.
For more information on debugging in JavaScript, as well as how to start debugging if your browser does not support it, please read our JavaScript debugging tutorial.
Example
After opening the debugger, this code should stop executing before the third line:
var x = 15 * 5; debugger; document.getElementById("demo").innerHTML = x;
Syntax
debugger;
Technical Details
JavaScript Version: | ECMAScript 1 |
---|
Browser Support
Statement | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
debugger | Support | Support | Support | Support | Support |
Related Pages
JavaScript Tutorial:JavaScript Debugging
- Previous Page continue
- Next Page do...while
- Go to the Previous Level JavaScript Statement Reference Manual