Console: console.time()

Use console.time() and console.timeEnd() with the same label to measure elapsed time in the developer console.

What you will learn

Basic example

console.time('load data');
loadData();
console.timeEnd('load data');

The console reports the elapsed time between the two calls. The labels must match, and timers are local to the page's execution context.

Common mistakes