Different kinds of console output

Different kinds of console output that are useful in JavaScript

Rodrigo Figueroa
Geek Culture
Published in
3 min readJul 12, 2020

--

Hi I was reading about console.log but console has others methods that are really useful

Clear the console

yes there is a method that can clear the console, if you run this command into Chrome browser you can see something like this

console.clear()

Before command

example console.clear()
example console.clear()

After command

Finish example console clear
Finish example console clear

Count how many times is called

With console.count we can count how many times a variable string is called

console.count()
Code example of console.count()
Code example of console.count()
Example of console.count()
Example of console.count()

Check all the data of an object

display all the information of the object

console.dir()
Example code of console.dir()
code of console.dir()
example of console.dir()
example of console.dir()

print an error on the console

with console.error() you can print an error like this

console.error()
code of console.error()
code of console.error()
example of console.error()
example of console.error()

Create a table with the data

You can control the data output and create a table with them

console.table()
code of console.table()
code of console.table()
Example of console.table()
Example of console.table()

Check the time

With this method we can check the time of the response or check the time when people check something or click in some area

console.time(), console.timeLog(), console.timeEnd()
Code of console.time(), console.timeLog() and console.timeEnd()
Code of console.time(), console.timeLog() and console.timeEnd()
Example of console.time(), console.timeLog(), console.timeEnd()
Example of console.time(), console.timeLog(), console.timeEnd()

Print a Warning

with this method is easy to create a warning

code of console.warn()
code of console.warn()
example of console.warn()
example of console.warn()

Conclusion

There are another ones but these are the most useful console methods for me but in this case you can use table if you want to use more information or errors or warning, well those are great methods for console.log

Sources

https://developer.mozilla.org/en-US/docs/Web/API/console

--

--

Rodrigo Figueroa
Geek Culture

I’m a Web Developer, fanatic of books and Smash Player.