Skip to content

JavaScript Tutorial Getting Started

The Browser Console

Lesson 6 of 258 2 min read By Deepak Paswan Updated Oct 4, 2026

Every browser has developer tools, and the Console tab is where JavaScript talks to you.

Opening it

  • Press F12, or Ctrl + Shift + J (Chrome, Edge) or Ctrl + Shift + K (Firefox). On a Mac, use Cmd + Option + J (Chrome) or Cmd + Option + C (Safari, after enabling developer tools).
  • Or right-click anywhere on a page, choose Inspect, and open the Console tab.

Two things you will use constantly

1. Type code and press Enter. The console runs it straight away.

script.js
JS
2 + 3
"Hello".toUpperCase()
document.title

2. Print messages from your own code with console.log().

script.js
JS
console.log("Hello, console!");
console.log("Two plus two is", 2 + 2); // → Two plus two is 4
console.log([1, 2, 3]);

Everything you see in the Console output next to these examples is the same idea. The editor on this site shows your console.log lines and errors for you.

Different kinds of messages

script.js
JS
console.log("A normal message");
console.warn("A warning: something looks suspicious");
console.error("An error message");

Warnings are usually yellow and errors are red. When your page breaks, the console is the first place to look: it names the problem and often the line.

lightbulb
Use the console as a calculator and a notebook
Trying a small piece of code in the console is faster than editing a file. If you are not sure how a method behaves, test it there first.

You will go much deeper into debugging tools later, in Debugging with console.log and Friends.