Back to: JavaScript Tutorial For Beginners and Professionals
JavaScript Console Debug() Method
In this article, I am going to discuss JavaScript Console Debug() Method with Examples. Please read our previous article where we discussed JavaScript Console Count() and CountReset() Methods with Examples.
JavaScript console.debug() Method
The console.debug() method is used to display a message to the browser web console at the debug log level. This method is an alternate way to debug the code like a console.log(). This works the same as console.log() method.
The console.debug messages are hidden by default in the web browsers. It can be enabled by using the web console’s filter options. We have to set the log level to verbose in the console section of the browser developer tool to see debug messages.
Syntax: console.debug(data, args);
Parameters:
- data – This parameter displays the message or the data to be printed.
- args – This is an optional parameter that is used to specify the arguments to be passed along with the data to display.
What we discussed above is given in the below example.
Example to Understand JavaScript Console Debug() method
<html> <head> <title>JavaScript console debug() method example</title> </head> <body> <script> //sample code1 without argument console.debug('This is debug message'); //sample code2 with argument args = 2 console.debug('The no. of arguments:', args) console.debug(123); console.debug(10+20); console.debug(20*300); </script> </body> </html>
Output: Run the above code, and then Press F12 and go to the Console section then select verbose from the default level dropdown
Once you select the Verbose, then you will see the following in the Console window.
In the next article, I am going to discuss JavaScript Console Dir() and DirXML Methods with Examples. Here, in this article, I try to explain JavaScript Console Debug() Method with Examples. I hope this article will help you with your need. I would like to have your feedback. Please post your feedback, question, or comments about this article.