Things You Didn’t Know You Could Do With The Console in JavaScript

Travis Waith-Mair
Non-Traditional Dev
4 min readJun 21, 2019

--

Photo by Anton Ponomarev on Unsplash

The first thing the many people learn when learning a new programming language is how to build a “Hello World” app. Which is pretty much what it sounds like, having your programming language print out “Hello World!” on to the screen (there is an interesting article at hacker rank on the history of “Hello World” if you are interested). To do that in JavaScript, it only takes one line of code:

console.log("Hello, World!");

Logging to the console isn’t just one of the first things you learn. It ends up being one of the most important debugging tools. One of the most common things to do when JavaScript isn’t running the way we think it should, is to add log statements at various point in our app so we can understand what is really happening in our app.

If all you know about console was that it could log things, you will probably be very successful, but:

What if I told you you can do other things with console besides logging?

Yes that’s right. The console object has more methods than just log and can help you bring your JavaScript debugging skills to a new level. Though each browser can have their own unique features, there are some common methods available on all…

--

--