Web Development · Module 1 · Lesson 41 min read

Browser Developer Tools

Your most important tool

Every browser has DevTools: press F12 or Ctrl+Shift+I (Cmd+Option+I on Mac), or right-click → Inspect.

TabWhat you do there
Elementsinspect and live-edit HTML and CSS, see the box model
Consolesee errors, run JavaScript, console.log output
Networkevery request: status, size, timing, headers, response
Sourcesread code, set breakpoints, step through JavaScript
ApplicationlocalStorage, cookies, service workers
Lighthouseaudit performance, accessibility and SEO

Everyday tricks

  • Device toolbar (Ctrl+Shift+M): test phone and tablet sizes.
  • Right-click a request → Copy as fetch to reproduce an API call.
  • console.table(arrayOfObjects) shows data as a table.
  • Tick Disable cache in the Network tab while developing.
  • Throttle the network to Slow 4G to see how real users experience your site.

Reading errors

Red errors in the Console show the file and line number; click to jump there. Most bugs announce themselves here first.

Example

JavaScript
// Handy console helpers — try them in DevTools
const users = [
  { name: "Ana", role: "admin" },
  { name: "Ben", role: "editor" },
];
console.table(users);              // neat table
console.warn("This is a warning");
console.error("This is an error");
console.time("loop");
for (let i = 0; i < 1e6; i++) {}
console.timeEnd("loop");           // loop: 3.2ms