Teacher Mode Preview

Guided coding lesson demo

Back to playground
Walkthrough previewLesson starts
main.jsPreview
1const output = document.getElementById("output");
2let row = 1;
3let text = "";
4
5while (row <= 3) {
6 text += `Row ${row}: `;
7 let col = 1;
8
9 while (col <= 4) {
10 text += `[${row},${col}] `;
11 col++;
12 }
13
14 text += "\n";
15 row++;
16}
17
18output.textContent = text;
Browser preview

Nested while loop in JavaScript

Output appears as the lesson runs.
Teacher caption

The teacher starts with the output area and explains the goal before typing loop code.