Codington
0 of 8 problems solved • 0%

Exercise prompt

Repeat with a for Loop

A for loop repeats a block while its condition is true.

Example

for (let step = 1; step <= 3; step += 1) { console.log("Step:", step); } // Output: // Step: 1 // Step: 2 // Step: 3
  • let step = 1 sets the starting value once.
  • step <= 3 is checked before each repetition; false means stop.
  • step += 1 increases the counter after each repetition.

Your task

A warm-up contains four exercises. Use one for loop to display Exercise: 1 through Exercise: 4 on separate lines.