Tips for making javascript console life more easier


Basically, Console can be used to log on information . To view the console,  right click, Inspect and go to the console area . It’s always good to know the tools you are using. The better you learn to handle the tool, the more better the result will be. We tend to forget the basic while learning so, today in this topic let’s revise some basic which you may already know and some that you may not know.

Let’s get started with the basics. I’ll be providing the line’s of code. All you need to do is open the console , start pasting the below code and see the result

Output of the above codes :


As you can see, we have varieties of ways to log the messages for us while debugging and logging. Next time why don’t we try the right one to log the message we want to log.

# Console clear

You must have used this one. This will clear the log from the console.

# String substitutions

We can substitute the %s with type string , %i with integer, %f with float and %o with object . This is awesome feature right !\

String substitutions# Table

This one is fun. We can log a very nice table with the given objects in the console.table() .

Console Table# Color

This is a good one too . Making the console log more stylish with %c .

Console color

All of these above tips seems easy and fun, right ? 🙂 . Hope this help you understand some basic ways of logging on console . You can always drop in any other tips on comment. Happy coding ! 🙂

Sharing is caring!

Related Post