Skip to main content
Console - Web documentation
interface Console
Private

Interface representing the console object that provides methods for logging, debugging, and timing

Methods

assert(
condition?: boolean,
...data: any[],
): void

Tests that an expression is true. If not, logs an error message

clear(): void

Clears the console if the environment allows it

count(label?: string): void

Maintains an internal counter for a given label, incrementing it each time the method is called

countReset(label?: string): void

Resets the counter for a given label

debug(...data: any[]): void

Outputs a debugging message to the console

dir(
item?: any,
options?: any,
): void

Displays a list of the properties of a specified object

error(...data: any[]): void

Outputs an error message to the console. This method routes the output to stderr, unlike other console methods that route to stdout.

group(...data: any[]): void

Creates a new inline group in the console, indenting subsequent console messages

groupCollapsed(...data: any[]): void

Creates a new inline group in the console that is initially collapsed

groupEnd(): void

Exits the current inline group in the console

info(...data: any[]): void

Outputs an informational message to the console

log(...data: any[]): void

Outputs a message to the console

table(
tabularData?: any,
properties?: string[],
): void

Displays tabular data as a table

time(label?: string): void

Starts a timer you can use to track how long an operation takes

timeEnd(label?: string): void

Stops a timer that was previously started

timeLog(
label?: string,
...data: any[],
): void

Logs the current value of a timer that was previously started

trace(...data: any[]): void

Outputs a stack trace to the console

warn(...data: any[]): void

Outputs a warning message to the console

timeStamp(label?: string): void

Adds a marker to the DevTools Performance panel

profile(label?: string): void

Starts recording a performance profile

profileEnd(label?: string): void

Stops recording a performance profile

Back to top