debugger - JavaScript | MDN
debugger
The debugger statement invokes any available debugging functionality, such as setting a breakpoint. If no debugging functionality is available, this statement has no effect.
Syntax
debugger;
Copy to Clipboard
Examples
Using the debugger statement
The following example shows code where a debugger statement has been inserted, to invoke a debugger (if one exists) when the function is called.
function potentiallyBuggyCode() {debugger;// do potentially buggy stuff to examine, step through, etc.}
Copy to Clipboard
When the debugger is invoked, execution is paused at the debugger statement. It is like a breakpoint in the script source.
Specifications
SpecificationECMAScript Language Specification (ECMAScript)
# sec-debugger-statement
Browser compatibility
Report problems with this compatibility data on GitHub
desktopmobileserver
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on iOSSamsung InternetNode.js
debugger
Full support5Full support12Full support1Full support4Full support10Full support5Full support1Full support18Full support4Full support10.1Full support4.2Full support1.0Full support0.10.0
Legend
Full support
Full support
See also
Found a problem with this page?
- Edit on GitHub
- Source on GitHub
- Report a problem with this content on GitHub
- Want to fix the problem yourself? See our Contribution guide.
Last modified: Jul 21, 2021, by MDN contributors