Javascript console.count() Method

Introduction

Write to the console the number of time the console.count() is called inside the loop:

Press F12 on your keyboard to view the message in the console view.

View in separate window

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript console.count() Method</h1>
<script>

for (i = 0; i < 10; i++) {
  console.count();
}

</script>//from  w  w  w  .  j  a  v a2s . c  om

</body>
</html>

Writes to the console the number of times that particular console.count() is called.

You can add a label that will be included in the console view.

By default the label "default" will be added.

console.count(label);

Parameter Values

Parameter Type Description
label String Optional. The method counts the number of times console.count() has been called with this label. If not present, the label "default" will be added.



PreviousNext

Related