Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This break and continue worksheet is part of the JavaScript Coding without HTML and CSS 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 | |
|---|---|---|
| 1break; | AWrong - use 'break', not 'stop', to exit a loop | |
| 2continue; | BExits the loop completely | |
| 3Stops a loop early once a condition is met | Cif (x % 2 === 0) { continue; } | |
| 4Skips even numbers while looping | DSkips the rest of this pass and moves to the next | |
| 5if (i === 4) { stop; } | EWrong - use 'continue', not 'skip', to move to the next pass | |
| 6if (i === 2) { skip; } | Fif (found) { break; } |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
break — Exits a loop completely, stopping it before it finishes all its passes.if (i === 4) {
break;
}if (i === 2) {
continue;
}if (n > 10) {
break;
}if (x % 2 === 0) {
continue;
}if (found) {
break;
}