Console.time

From FirebugWiki

Revision as of 00:12, 22 November 2013 by Sebastianz (Talk | contribs)
(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.

Contents

[edit] Syntax

console.time(name)

[edit] Parameters

[edit] name

Label used for the timer. required

[edit] 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.

[edit] See also

Personal tools