DEV Community

Daniel Zaltsman
Daniel Zaltsman

Posted on • Updated on

Pro console methods in Javascript

Image from Gyazo

If you use javascript, you are probably familiar with the console object and the classic method console.log(). Undoubtedly at some point, your project has been littered with these logs helping you track your bread crumbs leading you to the error you so desperately wanted to fix. Let's take a look at some other things you can do with the console.

console.table()

Image from Gyazo

Pretty snazzy, right? This method prints a table for the object that you log.

console.dir()

Image from Gyazo

This displays an interactive list of the properties of the specified JavaScript object. Works well when working with html elements.

console.time() and console.timeEnd()

Image from Gyazo

If you think there's a performance issue in your program, this is a neat way to test your theories.

console.count()

Image from Gyazo

This will help you count the amount of times your code has been read.

console.clear()

Image from Gyazo

This one should be obvious...

Top comments (0)