Skip to main content

Console

interface Console

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

Jump to headingassert(
condition?: boolean,
...data: any[],
): void

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

Clears the console if the environment allows it

Jump to headingcount(label?: string): void

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

Jump to headingcountReset(label?: string): void

Resets the counter for a given label

Jump to headingdebug(...data: any[]): void

Outputs a debugging message to the console

Jump to headingdir(
item?: any,
options?: any,
): void

Displays a list of the properties of a specified object

Jump to headingerror(...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.

Jump to headinggroup(...data: any[]): void

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

Jump to headinggroupCollapsed(...data: any[]): void

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

Exits the current inline group in the console

Jump to headinginfo(...data: any[]): void

Outputs an informational message to the console

Jump to headinglog(...data: any[]): void

Outputs a message to the console

Jump to headingtable(
tabularData?: any,
properties?: string[],
): void

Displays tabular data as a table

Jump to headingtime(label?: string): void

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

Jump to headingtimeEnd(label?: string): void

Stops a timer that was previously started

Jump to headingtimeLog(
label?: string,
...data: any[],
): void

Logs the current value of a timer that was previously started

Jump to headingtrace(...data: any[]): void

Outputs a stack trace to the console

Jump to headingwarn(...data: any[]): void

Outputs a warning message to the console

Jump to headingtimeStamp(label?: string): void

Adds a marker to the DevTools Performance panel

Jump to headingprofile(label?: string): void

Starts recording a performance profile

Jump to headingprofileEnd(label?: string): void

Stops recording a performance profile

Back to top