Console count()
Examples
Call console.count() 5 times:
for (let i = 0; i < 5; i++) {
console.count();
}
Try it Yourself »
Call console.count() 5 times, with a label:
for (let i = 0; i < 5; i++) {
console.count("myLabel");
}
Try it Yourself »
More examples below.
Definition and Usage
The count()
method counts the number of times console.count() is called.
The count()
method this number to the console.
Note
You can add a label that will be included in the console view.
As a default value the label "Default" is used.
See more examples in the bottom of this page.
Syntax
console.count(label)
Parameters
Parameter | Description |
label | Optional. Default label is "Default". |
More Examples
Call console.count two times, with a label:
console.count("myLabel");
console.count("myLabel");
Try it Yourself »
Browser Support
console.count()
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |