How to print debug messages in the Google Chrome JavaScript Console? Last Updated : 21 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Printing in the console is pretty easy all we have to know is how to activate the console on the chrome for viewing. The Console is always active all we are doing is making it visible to the front-end. A console is an object which provides access to the browser's debugging console. Console object has many methods which help us to print customized debugging. Here, are the following methods:assert(): Acts like 'if', prints to console if false.clear(): Clears the console.count(): counts whenever it gets called.error(): prints error if any.group(): Creates a new inline group in the console.groupCollapsed(): Creates a new inline collapsed group in the console.groupEnd(): Exits the inline group in the console.info(): acts just as log, for priority info.log(): Outputs a message to the console.table(): Displays tabular data as a table.time(): tracks how long the specific task taking place.timeEnd(): ends the tracker.trace(): Outputs a stack trace.warn(): Outputs a warning message.Click on F12 after running the script and it opens the Developer Tools, navigate to the Console tab, which will be on the top menu.Example 1: javascript <!DOCTYPE html> <html> <body> <h2>Debugging in Console</h2> <p>On Clicking the below button, myFunction() invokes and prints in the console.</p> <input type="button" onclick="myFunction()" value="Tony send signal to Quill(console)"> <!--button--> <script> function myFunction() { //prints in console console.log("log:Tony sent a message"); //prints in console console.info("info:Quill received."); } </script> </body> </html> Output: Before:Output1After clicking the button:Output2Example 2: Check out the console.table() for better understanding of methods. javascript <!DOCTYPE html> <html> <body> <h2>Debugging in Console</h2> <p>On Clicking the below button, myFunction() invokes and prints in the console.</p> <input type="button" onclick="myFunction()" value="who are the guardians?"> <script> function myFunction() { console.table(["Quill", "Gamora", "Drax", "Groot", "Rocket", "mantis"]); } </script> </body> </html> Output Before:Output1After Clicking the button:Output2 Comment More infoAdvertise with us Next Article How to print debug messages in the Google Chrome JavaScript Console? T Tejashwi5 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to Print a Message to the Error Console Using JavaScript ? This article will show you how to print a message using JavaScript on the error console. There are three methods to display the error console, these are: Table of Content Using console.error() MethodUsing console.warn() MethodUsing console.info() MethodApproach 1: Using console.error() MethodThe con 2 min read View the list of all variables in Google Chrome Console using JavaScript All the variables in Google Chrome can be listed for the use of debugging. There are two approaches to list all variables: Method 1: Iterating through properties of the window object: The window object in JavaScript represents the current browser's window. The properties of this object can be used t 2 min read How to disable JavaScript in Chrome Developer Tools? In many situation, we may find it useful to inspect how a webpage appears without the influence of JavaScript. Disabling JavaScript allows us to observe the baseline functionality and styling of a site. In this tutorial, we'll focus on how to achieve this in Chrome Developer Tools, a powerful toolse 2 min read Running JavaScript in Console in Microsoft Edge Browser JavaScript is an important programming language that is mainly developed for web use cases and it plays a vital role in improving the responsiveness and usefulness of websites. On the other hand, Microsoft Edge is a web browser that offers a built-in JavaScript engine for development. So here, we'll 3 min read What are Some Common Debugging Techniques for JavaScript ? JavaScript development can be tricky, and errors are common. But do not worry! There are ways to find and fix these problems. Some of the common methods to debug JavaScript code are listed below: Table of Content Using console.log()Error Handling (try...catch blocks)Using debugger and developer tool 3 min read Like