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.
The count()
method counts the number of times console.count() is called.
The count()
method this number to the console.
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.
console.count(
label)
Parameter | Description |
label | Optional. Default label is "Default". |
Call console.count two times, with a label:
console.count("myLabel");
console.count("myLabel");
Try it Yourself »
console.count()
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!