Console.count

From FirebugWiki
Jump to: navigation, search

Writes the number of times that the line of code was executed where count was called.

There can be several counters for a page, which are distinguished by the line of code it is placed or the name it is given.

Syntax[edit]

console.count([name])

Parameters[edit]

name[edit]

Name for the counter. This name will be displayed besides the count. If a name is given, the calls to console.count(<name>) will be counted based on their name disregarding the line they are in. If no name is given, the calls to console.count() will be distinguished by their line number.

Examples[edit]

console.count("Exception");

This prints something like Exception 4 to the console, where 4 is the number of times the line of code was executed.

See also[edit]