Foundations

While Loops

While Loops

A while loop keeps running while its condition stays true. You must update something inside the loop so the condition eventually becomes false.

Your task: Use a while loop to add 3, 2, and 1 to the provided countdown array. Log the array after the loop.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

While Loops

A while loop keeps running while its condition stays true. You must update something inside the loop so the condition eventually becomes false.

Your task: Use a while loop to add 3, 2, and 1 to the provided countdown array. Log the array after the loop.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.