Console.time

From FirebugWiki
Revision as of 16:12, 21 November 2013 by Sebastianz (Talk | contribs) (Added categories)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Creates a new timer under the given name. Call console.timeEnd() with the same name to stop the timer and print the time elapsed.

Syntax[edit]

console.time(name)

Parameters[edit]

name[edit]

Label used for the timer. required

Examples[edit]

console.time("assignments");
for (var i=0; i<1000000; i++)
  var a = 1;
console.timeEnd("assignments");

This measures the time how long one million assignments in a for loop take and prints the result to the console.

See also[edit]