Javascript console.time() Method with label

Introduction

Using the label parameter:

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

Time the number of milliseconds it takes to perform a for-loop a hundred thousand times.

View in separate window

<!DOCTYPE html>
<html>
<body>
<script>
var i;//ww  w.j  a v a 2  s . c  o m
console.time("test1");
for (i = 0; i < 100000; i++) {
  // some code
}
console.timeEnd("test1");

</script>
</body>
</html>



PreviousNext

Related