JavaScript debuggerStatement

JavaScript 语句参考手册JavaScript Statements Reference

Example

Turn on the debugger, and the code stops execution before the third line.

var x = 15 * 5;
debugger;
document.getElementbyId("demo").innerHTML = x;

Try it Yourself »


Definition and Usage

The debugger statement stops the execution of JavaScript and calls (if available) the debugging function.

Using the debugger statement is similar to setting a breakpoint in the code.

Usually, you can turn on the debugging tool by pressing F12 and select "Console" in the debugging menu.

Note:If the debugging tool is not available, the debugger statement will not work.

For more JavaScript debugging information, and how to activate the browser's debugging tools when the browser does not support them, please check ourJavaScript DebuggingTutorial.


Browser Support

Statement
debugger Yes Yes Yes Yes Yes


Syntax

debugger;

Technical Details

JavaScript Version: 1.0


Related Pages

JavaScript Tutorial:JavaScript Debugging


JavaScript 语句参考手册JavaScript Statements Reference Other Extensions