Difference between revisions of "Console.time"

From FirebugWiki
Jump to: navigation, search
(Separate Console API page for console.time())
 
m (Added categories)
 
Line 23: Line 23:
 
* [[console.timeEnd]]
 
* [[console.timeEnd]]
 
* [[Console API]]
 
* [[Console API]]
 +
 +
[[Category:Firebug]]
 +
[[Category:UI]]
 +
[[Category:API]]

Latest revision as of 17:12, 21 November 2013

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]