console.count()
Logs how many times this call with the given label has run.
Syntax
console.count(label)
Returns
undefined — Returns `undefined`.
Examples
console.count("tick");
console.count("tick");
console.count("tock");
Output
tick: 1
tick: 2
tock: 1
for (let i = 0; i < 3; i++) console.count();
Output
default: 1
default: 2
default: 3
Notes
- The label defaults to `"default"`.
- Reset a counter with `console.countReset(label)`.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 2.0 |
| firefox | 30 |
| safari | 4 |
| edge | 12 |
| node | 8.3 |