Tsallaka zuwa abun ciki
Justice Tech School

Debugging

Open the browser developer tools (F12) to see errors in the Console. console.log, console.table and console.error help you inspect values. A breakpoint in the Sources tab pauses the code so you can step through it line by line.

Read the error message first: it names the type of error and the line. Reproduce the bug with the smallest example you can.

Example
const people = [{ name: "Ada", age: 21 }, { name: "Tunde", age: 30 }];
console.log(people);
console.table(people);
console.error("Something went wrong");
// debugger; pauses here when dev tools are open

Exercise

Pause the code in the debugger.

;

Quiz Test

Which key usually opens the browser developer tools?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.