English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
console.count()to record the number of times count() is called.
console.count()The method takes an optional parameterlabel.
If the parameter is providedlabelthe function records the number of times console.count() has been called with this specific label.
If the parameter is omittedlabelthe function records the number of times count() has been called at this specific line.
console.count(label)
for (let i=0; i<10; i++) { console.count(); }Test and see‹/›
All browsers fully support the console.count() method:
Method | |||||
console.count() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
label | (Optional) If the method exists, it calculates the number of times console.count() has been called with this label. |
Twice calls to console.log(), withlabel:
console.count("Hello"); console.count("Hello");Test and see‹/›