Lesson 3 / 40

The Console

Use the browser console and DevTools to print values, spot errors and experiment with code live.

console.log

The most-used debugging tool — print any value to the DevTools console.

console.log("Hello, JS!");
console.log(1 + 2);

Output:

Hello, JS!
3

Other console methods

console.error(), console.warn(), and console.table() format output differently — useful for spotting issues fast.

DevTools shortcut

Open DevTools with F12 or Ctrl+Shift+I (Cmd+Option+I on Mac) — the Console tab doubles as a live JS REPL.