diff --git a/curriculum/challenges/english/blocks/lecture-working-with-loops/67329f7f3d1bd75c17896c66.md b/curriculum/challenges/english/blocks/lecture-working-with-loops/67329f7f3d1bd75c17896c66.md index afe6ebc220f..0cad292d349 100644 --- a/curriculum/challenges/english/blocks/lecture-working-with-loops/67329f7f3d1bd75c17896c66.md +++ b/curriculum/challenges/english/blocks/lecture-working-with-loops/67329f7f3d1bd75c17896c66.md @@ -5,7 +5,7 @@ challengeType: 19 dashedName: how-do-loops-and-iteration-work-in-javascript --- -# --description-- +# --interactive-- Loops in programming are used to repeat a block of code multiple times. @@ -29,12 +29,16 @@ If the condition is true, the code block inside the loop is executed. If the con The last part of the loop is the increment/decrement statement. This statement is executed after each iteration of the loop. It is typically used to increment or decrement the counter variable. +:::interactive_editor + ```js for (let i = 0; i < 5; i++) { console.log(i); } ``` +::: + In the first part of the example above, we initialize a counter variable `i` to `0`. It is common convention to use `i` as the counter variable in a `for` loop. The next part is to check the condition. In this case, the condition is checking if `i` is less than `5`. Since `i` is `0`, the condition is true, and the code block inside the loop is executed.