JavaScript continue Statement — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript continue Statement lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Skip one number
easy10 minAdd 1 to 6 together but skip the number 4. Show the total.
- 2
Skip the even numbers
easy10 minAdd only the odd numbers from 1 to 9. Show the total.
- 3
Ignore the negatives
easy10 minAdd up only the numbers that are zero or above. Show the total.
- 4
Count what you kept
easy10 minCount how many names are not empty. Show the count.
- 5
Build a string without spaces
medium10 minJoin the letters of "a b c" together, skipping the spaces.
Find the bug(5)
- 1
Fix break used instead of continue
easy8 minbreak ends the loop, so everything after 4 is lost.
- 2
Fix the inverted condition
easy8 minThis skips the odd numbers when it should skip the even ones.
- 3
Fix the continue placed too late
easy8 minThe value is added before the check, so nothing is skipped.
- 4
Fix the counter that never runs
easy8 minThe counter sits after continue, so it is skipped every time.
- 5
Fix the wrong value skipped
easy8 minThis skips 4 when it should skip 3.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace