HTML DOM console count() Method Last Updated : 30 Aug, 2024 Comments Improve Suggest changes Like Article Like Report The console.count() method in HTML is used to write the number of times the console.count() method is called. The console.count() method can be added to a label that will be included in the console view. The label is an optional parameter sent to the console.count() method. Syntax:console.count( label )Parameters: This method accepts a single parameter label which is optional and used to count the number of times console.count() has been called with this label. Example: Below program illustrates the console.count() method in HTML: HTML <!DOCTYPE html> <html> <head> <title>DOM console.count() Method</title> <style> h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM console.count( ) Method</h2> <p> To view the message in the console press the F12 key on your keyboard. </p> <p> To count the number of occurrences, double click thebutton below: </p><br> <button ondblclick="count_console()"> Run Loop </button> <script> function count_console() { for (i = 0; i < 10; i++) { console.count(); } } </script> </body> </html> Output:HTML DOM console.count() MethodSupported Browsers: The browsers are supported by the console.count() Methods are listed below:Google ChromeEdge FirefoxOperaSafari Comment More infoAdvertise with us Next Article HTML DOM console count() Method S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM (Document Object Model) The HTML DOM (Document Object Model) is a programming interface that represents the structure of a web page in a way that programming languages like JavaScript can understand and manipulate. Think of it as a tree of objects where each part of your HTML document (elements, attributes, text) is repres 6 min read HTML DOM activeElement Property The DOM activeElement property is used to return the currently active elements in the HTML document. This property is read-only. It gives the reference of a focused element object in the document. Syntax: document.activeElementReturn Value: A reference to the element object in the document that has 2 min read HTML DOM anchors Collection The HTML DOM anchors collection is used to return the collection of all <a> elements. It only counts those <a> element that has the name attribute only. The name attribute of the anchor element does not support HTML 5. The elements in the collection are sorted that appear in the source c 2 min read HTML DOM close() Method The DOM close() method is used to close the output stream. It is used to indicate the finish of writing on a window. The close() method does not require any parameter. Syntax:document.close()Example 1: In this example, we will use DOM close() method.HTML<!DOCTYPE html> <html> <head 2 min read HTML DOM baseURI Property The DOM baseURI property is used to return the base Uniform Resource Identifier (URI) of the document. This property is used for read-only. This property returns a string value that represents the base URI of the page.Syntax: node.baseURIReturn Value: It returns a string value that represents the UR 2 min read HTML DOM body Property The HTML DOM Body property is used to set the document <body> element. It only returns the content present in the <body> Tag. This property is used to change the present content inside the <body> element and sets them with the new specified content. This property does not return th 2 min read HTML DOM createAttribute() Method This createAttribute() method is used to create an attribute with the specified name and returns the attribute object. The attribute.value property is used to set the value of the attribute and the element.setAttribute() method is used to create a new attribute for an element. This method() contains 2 min read HTML DOM doctype Property The DOM doctype property is used to return the doctype of any HTML document. The DocumentType object is the name property used to return the name of the object. If there is no doctype declared in the document then it returns a Null value. Syntax:document.doctypeExample: In this example, we will use 2 min read HTML DOM writeln() Method The writeln() method is used to write a document with the additional property of a newline character after each statement. This method is similar to the document.write() method. Syntax: document.writeln( exp1, exp2, exp3, ... )Parameters: This method contains many parameters which are optional. All 1 min read HTML DOM console error() Method The console.error() method in HTML is used to display an error message on the console. The console.error() method is used for testing purposes. The error message is sent as a parameter to the console.error() method. Syntax:console.error( message )Parameters: This method accepts a single parameter me 2 min read Like