Skip and Stop
JavaScript
20 pts
Skip and Stop
Loop over the numbers 1 to 20 and add them to total, with two rules:
- Skip every multiple of 3 with
continue(do not add or print it). - After adding and printing a number, stop with
breakas soon astotalis more than 30.
After the loop, print the total. Expected output:
1 2 4 5 7 8 10 Total: 37
Checklist
- Add the numbers to
total(no typed answer). - Skip multiples of 3 with
continue. - Stop with
breakonce the total is over 30. - Print each added number and the total.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
