Javascript Console Helpers

Meriem
Mar 7, 2021

The javascript console functions are very useful to display data in the console. Every javascript developer need to know them. They allow you to debug Javascript code and solve problems with your code.

Time() & TimeEnd()

Starts and stops a time. That helps you to know how much time a function take to execute.

Error()

Outputs an error message to the console.

error

Warn()

Outputs a warning message to the console.

Clear()

Clears the console.

Table()

Displays tabular data as a table.

Count()

Logs the number of times that count(label) was called based on the value of label. label is optional.

Example with label:

Example without label :

dir()

This is very useful if you want to display objects in the console. It outputs a hierarchical listing with disclosure triangles that let you see the contents of child objects.

--

--