Favorites

JavaScript debugger Statement

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
debugger
JavaScript Control FlowThis statement is supported by all modern browsers.
Updated 28th November 2026

The debugger statement pauses the code at that point when the browser's developer tools are open, like a breakpoint.

Description

The debugger statement acts like a breakpoint: when the browser's developer tools are open, execution pauses there so you can inspect variables and step through the code. When the tools are closed, it does nothing. Remove it before publishing; linters usually warn about it.

When execution pauses at a debugger statement, you can inspect the call stack, hover over variables, run code in the console in the current scope, and step through the following lines one at a time. It's particularly handy for code that's hard to reach with a normal breakpoint, such as code generated at run time or inside an eval().

Most browsers also let you set breakpoints directly in the Sources (or Debugger) panel without editing your code, including conditional breakpoints and breakpoints on DOM changes or event listeners. Some developer tools have a setting to ignore debugger statements, which helps when a third-party script uses them.

Syntax

debugger;

Example

function calculate(a, b) {
  const result = a * b;
  debugger;   // pauses here only when developer tools are open
  return result;
}
console.log(calculate(6, 7));

Browser Support

The following information will show you the current browser support for the debugger statement. Hover over a browser icon to see the version that first introduced support for this statement.

This statement is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee