Console.time

From FirebugWiki
Revision as of 02:52, 18 November 2013 by Sebastianz (Talk | contribs) (Separate Console API page for console.time())

(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

console.time(name)

Parameters

name

Label used for the timer. required

Examples

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