Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Breakpoints and stepping in browser DevTools worksheet is part of the ACARA Digital Technologies Years 9–10 — Modular and Object-Oriented Programming (JavaScript) journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1debugger; | AA statement that pauses the program on that line when DevTools is open, acting like a breakpoint written in the code | |
| 2Step over | BRuns the current line, including any function it calls, then pauses on the next line | |
| 3Pause the program on a line by writing the breakpoint in your code instead of clicking in DevTools | CBreakpoints are set by clicking the line number in the Sources tab, not in the Console tab. | |
| 4Step into lets you follow the program inside a function that the current line calls | Dlet total = add(2, 3); debugger; console.log(total); | |
| 5debugger() | Elet area = getArea(4, 5); | |
| 6Click the code on line 5 in the Console tab to set a breakpoint | Fdebugger is a statement, not a function, so it should be written as debugger; with no brackets. Brackets cause a syntax error. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
breakpoint — A marker on a line in browser DevTools that pauses the program there, so you can step through the code line by line and watch the variables change.let total = 0;
debugger;
total = total + 5;let score = 10;
debugger;
console.log(score);function double(n) {
debugger; return n * 2;
}function double(n) { return n * 2; }
debugger;
let answer = double(4);let lives = 3;
debugger;
lives = lives - 1;