Search notes:

Browser Object Model: console.time() / timeEnd()

console.time(timerName) starts a timer that is named by timerName. The timer ends with a call to console.timeEnd(timerName) and the duration will be written into the console window.
<html>
<head>
  <meta charset="utf8">
  <title>console.time</title>

<script type="text/JavaScript">

var out;

function bar(i) {

  console.time('t_bar');

  for (var j=0; j < i*3; j++) {
    console.log('j=' + j);
  }

  console.timeEnd('t_bar');
}

function foo() {

  console.time('t_foo');

  for (var i=0; i<3; i++) {
    console.log('i='+i);
    bar(i);
  }

  console.timeEnd('t_foo');
}

function main() {
  out = document.getElementById('out');
  foo();
}


</script>
</head>
<body onload='main()'>

  <div id='out'> </div>

</body>
</html>
Github repository Browser-Object-Model, path: /console/time.html

Output into console window

See also

The console object of the browser object model

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759406533, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/browser/object-model/console/time(91): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78