INTERACTIVE COURSE · FREE

Loops and iteration in JavaScript: repeating, accumulating, and finishing

Learn while, for, and do...while, use counters and accumulators, and control traversals with break and continue. Build a savings simulation and check its limits and outputs.

Level
Beginner
Lessons
5
Learning steps
77
UNDERSTAND · PRACTISE · APPLY

Your lesson journey

Each lesson has a purpose. Follow the order or revisit an idea you want to practise.

5 lessons

5 of 5 lessons shown

The numbers show the lesson order, not your progress.

What you will learn

Distinguish a decision from repetition and explain an iteration. Build while and for loops with coherent initialization, condition, and update. Explain do...while's final check and minimum of one normal execution. Predict ascending, descending, and fixed-step traversals, including zero iterations and inclusive limits. Keep accumulators outside the body and distinguish their results from counters. Apply break and continue, explaining their destinations in each loop type. Identify paths without progress through analysis and fix them without running dangerous versions. Build and check a savings simulation with a calendar maximum, goal, and skipped weeks.

Before you start

Complete courses 01 through 08 of Programming Fundamentals or know their contents. The course uses let, const, console.log, template literals, basic types, comparisons, operators, conditions, and desk checks. No prior loop knowledge is required. Exercises use small numbers, valid fictional inputs, and independent contexts; there are no installations or forms.

COURSE CONTEXT

About this course

Read the full description

Course 09 of Programming Fundamentals from Código con Criterio. Across five lessons, you will progress from a small counter to a savings simulation with a maximum number of weeks, a goal, skipped contributions, and equivalent traversal versions.

Codi guides worked examples, tracing tables, a repetition diagram, activities with hints, and labs. The course distinguishes body iterations from condition checks, counters from accumulated money, and exiting a loop from skipping an iteration.

while is introduced first, then for, then do...while. Nesting is limited to two small traversals. Fragments that might not terminate are presented as analysis text, labeled not to execute; labs begin with finite programs.

The challenge defines up to 12 calendar weeks and includes a for version, a variation that skips contributions at multiples of 4, a while reference for the base, and an independent do...while demonstration. Tests cover reached and unreached goals, equality with the goal, and zero contribution. Activities check understanding; free-form code and personal reflections are not automatically corrected.

No installations, custom functions, arrays, objects, timers, or asynchronous programming are required. Weeks and countdowns are simulations that execute without waiting for real time.

CONNECT YOUR LEARNING

This course is part of these learning paths

Follow the suggested order or take this course on its own.