Sunday , 17 December 2017
Home / Programming / JavaScript / Console Object – Advanced JavaScript Tutorial
Console Object
Console Object

Console Object – Advanced JavaScript Tutorial

The console object is the recommended way to log errors, messages, and information about what’s going on. All browsers have consoles and are accessible via the console object.

Clear your script and add this bit of code.

To access the console object, will depend on your browser. If you have FireFox, then you must install firebug in order to see the console and it’s logs. Google Chrome’s console can be accessed by going to tools > JavaScript Console.

In our example, we use 4 methods which are available in the console object. They all basically output a message into the console, but they all have different meanings in each browser. Error message are usually displayed in red text or have an icon next to it display it’s significance.

Logging messages are a great way to debug code. Let’s take a look at this example.

In this example, we just log at what stage our code is executing. By doing this, we can make sure to check if certain parts of code is running the way we want them to. This is a much better alternative than alerting a message or outputting a message into the document directly.

Logging messages into the console does not affect the website in anyway.  It’s also recommended you only log messages during the development process of your website. It serves little to no purpose in live production code.


You’ll be using the console object often during development phases. For more information on the console object and debugging in general, then go here.

About Jasko Koyn

Check Also


Audio – Advanced JavaScript Tutorial

The video and audio objects both have the same events, properties and methods. So, you …

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to learn how to create your own custom WordPress plugins and themes? Check out my course!
Get 93% off my course. You'll also learn how to integrate WooCommerce and BuddyPress into your projects. This is a limited time offer
Yes, I would like to get 93% off your course!
No Thanks!