HTML DOM console.count() Method
Example
Write to the console the number of time the console.count() is called inside the loop:
for (i = 0; i < 10; i++) {
console.count();
}
Try it Yourself »
Definition and Usage
Writes to the console the number of times that particular console.count() is called.
You can add a label that will be included in the console view.
See more examples in the bottom of this page.
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
console.count() | Yes | Yes | 30 | Yes | Yes |
Syntax
console.count(label)
Parameter Values
Parameter | Type | Description |
---|---|---|
label | String | Optional. If present, the method counts the number of times console.count() has been called with this label. |
More Examples
Example
Call console.count() two times and see the result:
console.count();
console.count();
Try it Yourself »
Example
Call console.log two times, with a label, and see the result:
console.count("myLabel");
console.count("myLabel");
Try it Yourself »