JavaScript Console Methods

--

Photo by AltumCode on Unsplash

The Console object provides access to the browser’s debugging console. While working with JavaScript, all of us have used the console.log() method. There are more console methods and in this blog post we’re going to take a look at the most popular ones.

We will set up a simple HTML markup and import JavaScript index.js file.

Console.log() — outputs a message to the console.

Console.info() — outputs an informational message to the console.

OUTPUT:

Console.warn() — outputs a warning message to the console.

OUTPUT:

Console.error() — outputs an error message to the console.

OUTPUT:

Console.assert() — writes an error message to the console if the assertion is false.

OUTPUT:

Console.table() — displays tabular data as a table.

OUTPUT:

console.clear() — clears the console.

OUTPUT:

--

--