1.4 Printing to Console

What the Heck is the Console?

The console is the browser's built in debugger.

The console is your best friend for many reasons:

  1. It is faster and easier to use than other tools as well as being error free.
  2. It is a multi-purpose and somewhat generic tool.
  3. It is the most common debugging method used in JavaScript.
  4. It logs error messages, so you can easily debug them.

Getting Started with Console

To log (←send message) to console, it is written as:

console.log("__insert_message_here__");

To find out all the possible options that console has to offer, it is written as:

console.log(console);

Possibilities with Console

.assert()

<aside> 💡 This section would make more sense after you learn conditional. So, if you don't get it right now, don't worry about it.

</aside>

When you want to log something that is false, you use: