0
0
Javascriptprogramming~10 mins

Continue statement in Javascript - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to skip the current loop iteration when the number is 3.

Javascript
for (let i = 1; i <= 5; i++) {
  if (i === 3) {
    [1];
  }
  console.log(i);
}
Drag options to blanks, or click blank then click option'
Abreak
Bcontinue
Creturn
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'break' instead of 'continue' stops the entire loop.
Using 'return' inside a loop without a function causes errors.
2fill in blank
medium

Complete the code to print only odd numbers from 1 to 5 using continue.

Javascript
for (let i = 1; i <= 5; i++) {
  if (i % 2 === 0) {
    [1];
  }
  console.log(i);
}
Drag options to blanks, or click blank then click option'
Astop
Bbreak
Ccontinue
Dskip
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'break' stops the loop entirely.
Using 'skip' is not a valid JavaScript statement.
3fill in blank
hard

Fix the error in the loop to skip printing number 4.

Javascript
for (let num = 1; num <= 5; num++) {
  if (num === 4) {
    [1];
  }
  console.log(num);
}
Drag options to blanks, or click blank then click option'
Aexit
Bbreak
Creturn
Dcontinue
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'break' stops the entire loop.
Using 'return' outside a function causes errors.
4fill in blank
hard

Fill both blanks to skip even numbers and print only odd numbers from 1 to 6.

Javascript
for (let i = 1; i <= 6; i++) {
  if (i [1] 2 === 0) {
    [2];
  }
  console.log(i);
}
Drag options to blanks, or click blank then click option'
A%
Bcontinue
C===
D!==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '===' instead of '%' for checking even numbers.
Using 'break' instead of 'continue'.
5fill in blank
hard

Fill all three blanks to skip numbers divisible by 3 and print others from 1 to 9.

Javascript
for (let n = 1; n <= 9; n++) {
  if (n [1] 3 [2] 0) {
    [3];
  }
  console.log(n);
}
Drag options to blanks, or click blank then click option'
A%
Bcontinue
C===
D!==
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'break' instead of 'continue'.
Using '!== 0' instead of '=== 0' to check divisibility.