English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM console.count() Method

 JavaScript Console Object

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.

Syntax:

console.count(label)
for (let i=0; i<10; i++) {
console.count();
}
Test and see‹/›

Browser Compatibility

All browsers fully support the console.count() method:

Method
console.count()IsIsIsIsIs

Parameter Value

ParameterDescription
label(Optional) If the method exists, it calculates the number of times console.count() has been called with this label.

More examples

Twice calls to console.log(), withlabel:

console.count("Hello");
console.count("Hello");
Test and see‹/›

 JavaScript Console Object