Loops repeat a block of code while their state changes. A for loop keeps its starting value, condition, and update together, making a counted repetition easy to scan.
for (let step = 1; step <= 3; step += 1) {
console.log(`Step ${step}`);
}
// Step 1
// Step 2
// Step 3Begin with traced counters and running totals before comparing for with while. Check that every loop has a reachable stopping condition—especially when the repeated code changes the same value used by the condition.