Debugger Statement

Break Your Code With Debugger Statement

In this post, we will know more about Debugger Statement available in the javascript library. Many Javascript developers may not aware of Debugger Statement. I generally believe most of the javascript developer use any of the below four methods for client side debugging.

In which here, we are primarily going to talk about Debugger Statement. Before that, The Console object provides access to the browser’s debugging console and it has many inbuilt methods available with it. Some of the example methods are


You can use these methods to display differentiate the console message. Check this URL to know more about console object.

Debugger Statement:

The debugger statement invokes any available debugging functionality, such as setting a breakpoint. If no debugging functionality is available, this statement has no effect.


function potentiallyBuggyCodeAvailable(){

Please find the above code, When the debugger is invoked, execution is paused at the debugger statement. It is like a breakpoint in the script source.

In the above code, when submit button is clicked it will call sum() method and the code will break where the debugger statement is added.

Please find the above screenshot, the code got broken where the debugger statement is added. It will be really helpful under certain circumstances.