JavaScript debugger Statement
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
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.
Desktop





Tablets & Mobile





