Obiya Window Console

Console object

The Console object provides access to the browser's debugging console.

The Console object is a property of the window object.

The Console object can be accessed in the following ways:

window.console or just console

Example

window.console.error("You made a mistake");

Try it yourself

console.error("You made a mistake");

Try it yourself

Console object methods

Method Description
assert() If assertion is false, write an error message to the console.
clear() Clear the console.
count() Record the number of times this specific call to count() has been made.
error() Output an error message to the console.
group() Create a new group in the console.
groupCollapsed() Create a new inline group in the console. However, the new group is created as collapsed. The user needs to use the button to expand it.
groupEnd() Exit the current group in the console.
info() Output informative messages to the console.
log() Output a message to the console.
table() Display tabular data as a table.
time() Start a timer (to track how long an operation takes).
timeEnd() Stop the timer started by console.time().
trace() Output the stack trace to the console.
warn() Output a warning message to the console.