THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JavaScript debugger Statement

JavaScript Statements Reference JavaScript Statements Reference

Example

With the debugger turned on, this code should stop executing before it executes 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 has the same function as setting a breakpoint in the code.

Normally, you activate debugging in your browser with the F12 key, and select "Console" in the debugger menu.

Note: If no debugging is available, the debugger statement has no effect.

For more information about debugging in JavaScript, and how to activate debugging if your browser does not support it, read our JavaScript Debugging 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 Statements Reference JavaScript Statements Reference