🌀 Jump Statements

Last Updated: 14th October 2025


Jump statements are used to change the normal flow of a program.
They make the program “jump” from one part to another instead of running line by line.

Hinglish Tip 🗣: Jump statements ko shortcut samjho — ye program ko ek jagah se doosri jagah le jaate hain.

JavaScript provides two main jump statements:

  1. break
  2. continue

1. break Statement

The break statement stops the loop immediately and exits from it.

Hinglish Tip 🗣: Jab koi condition mil jaaye aur loop ko turant band karna ho, tab break use karte hain.

✏ Example:

for (let i = 1; i <= 5; i++) {
  if (i === 3) {
    break; // stops loop when i is 3
  }
  console.log(i);
}

💡 Output: 1, 2,


2. continue Statement

The continue statement skips the current iteration and moves to the next one.

Hinglish Tip 🗣: continue ka matlab hai — iss round ko skip karo, agli iteration par jao.

Example:

for (let i = 1; i <= 5; i++) {
  if (i === 3) {
    continue; // skip 3
  }
  console.log(i);
}

💡 Output: 1, 2, 4, 5


💡 Quick Practice

  1. Write a loop from 1–10 and stop the loop when number is 6.
  2. Print all numbers from 1–10 except 4 and 8 using continue.
  3. Exercises Set 1
  4. Exercises Set 2