The console.info() method in HTML is used for writing a message in the console. It indicates an important message about any element or object. The message is sent as a parameter to the console.info() method.
Syntax:
console.info( message )
Parameters: This method accepts single parameter message which is mandatory and used to specify the information to be written on the console.
Below programs illustrate the console.info() method in HTML:
Example 1:
<!DOCTYPE html> <html> <head> <title>DOM console.info() Method</title> <style> h1 { color:green; } h2 { font-family: Impact; } body { text-align:center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM console.info() Method</h2> <p>To view the message in the console press the F12 key on your keyboard.</p> <p> To view the message, double click the button below: </p><br> <button ondblclick="info_console()"> View Message </button> <script> function info_console() { console.info ("GeeksforGeeks is a portal for geeks."); } </script> </body> </html> |
Output:

Console View:

Example 2: Displaying an object while using console.info() method
<!DOCTYPE html> <html> <head> <title>DOM console.info() Method</title> <style> h1 { color:green; } h2 { font-family: Impact; } body { text-align:center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM console.info( ) Method</h2> <p> To view the message in the console press the F12 key on your keyboard. </p> <p> To view the message, double click the button below: </p><br> <button ondblclick="info_console()"> View Message </button> <script> function info_console() { var MyElement = { Product : "Coca Cola", Type : "Beverage" }; console.info(MyElement); } </script> </body> </html> |
Output:

Console View:

Supported Browsers: The browser supported by console.info() method are listed below:
- Google Chrome
- Internet Explorer 8.0
- Firefox 4.0
- Opera
- Safari
Recommended Posts:
- HTML | DOM contains() Method
- HTML | DOM before() method
- HTML | DOM after() Method
- HTML | DOM execCommand() Method
- HTML | DOM write() Method
- HTML | DOM normalize() Method
- HTML | DOM addEventListener() Method
- HTML | DOM Select add Method
- HTML | DOM setRangeText() method
- HTML | DOM fullscreenEnabled() Method
- HTML | DOM createDocumentFragment() Method
- HTML | DOM getNamedItem() Method
- HTML | DOM isEqualNode() Method
- HTML | DOM removeAttribute() Method
- HTML | DOM getElementById() Method
- HTML | DOM getElementsByClassName() Method
- HTML DOM customElements get() method
- HTML DOM queueMicrotask() Method
- HTML | DOM createElement() Method
- HTML | DOM requestFullscreen() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


