📲 Download Utility Tools Apps

EMI Calculator

Download EMI Calculator

SOA Games

Download SOA Games

SOA Technology App

Download SOA Technology

BMI Checker

Download BMI Checker

Task Jira

Download Task Jira

Laughing Adda

Download Laughing Adda

📅 हिंदी कैलेंडर ऐप डाउनलोड करें

Download Shubhcalendar App

3️⃣ Control Statements (Decision Making)

Control statements help your program make decisions based on conditions.


✅ 1. if Statement

Runs code only if condition is true

let age = 18;if (age >= 18) {
console.log("You can vote");
}

👉 If condition is true → code runs
👉 If false → nothing happens


✅ 2. if...else

Runs one block if true, another if false

let age = 16;if (age >= 18) {
console.log("Adult");
} else {
console.log("Minor");
}

✅ 3. else if

Used when checking multiple conditions

let marks = 75;if (marks >= 90) {
console.log("Grade A");
} else if (marks >= 70) {
console.log("Grade B");
} else if (marks >= 50) {
console.log("Grade C");
} else {
console.log("Fail");
}

✅ 4. switch Statement

Better alternative when checking many fixed values

let day = 2;switch (day) {
case 1:
console.log("Monday");
break;
case 2:
console.log("Tuesday");
break;
case 3:
console.log("Wednesday");
break;
default:
console.log("Invalid day");
}

👉 break stops execution
👉 Without break, next cases also run


🔹 🔁 Loops (Repeat Code)

Loops help run code multiple times automatically


✅ 1. for Loop

Used when you know how many times to run

for (let i = 1; i <= 5; i++) {
console.log(i);
}

👉 Output: 1 2 3 4 5


✅ 2. while Loop

Runs while condition is true

let i = 1;while (i <= 5) {
console.log(i);
i++;
}

✅ 3. do...while

Runs at least once, even if condition is false

let i = 1;do {
console.log(i);
i++;
} while (i <= 5);

✅ 4. break

Stops loop immediately

for (let i = 1; i <= 10; i++) {
if (i === 5) {
break;
}
console.log(i);
}

👉 Output: 1 2 3 4


✅ 5. continue

Skips one iteration

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

👉 Output: 1 2 4 5


🧠 Practice Programs


🎯 1. Number Guessing Game

let secret = 7;
let guess;while (guess !== secret) {
guess = Number(prompt("Guess a number (1-10):")); if (guess === secret) {
console.log("🎉 Correct!");
} else {
console.log("❌ Try again");
}
}

👉 Concepts used:

  • while loop
  • if else

🎯 2. Multiplication Table Generator

let num = Number(prompt("Enter a number:"));for (let i = 1; i <= 10; i++) {
console.log(num + " x " + i + " = " + (num * i));
}

👉 Output example for 5:

5 x 1 = 5
5 x 2 = 10
...
5 x 10 = 50


AI Spiritual Tools & Interactive Experiences

Explore powerful AI-driven tools for daily guidance, spirituality, fun quizzes, and self-discovery.

Today’s Quote

Get inspiring daily quotes powered by AI to motivate and guide your day.

Explore Now

AI Tarot Card Reader

Reveal insights about your future, love, and career with AI tarot readings.

Read Tarot

Love Match Calculator

Check compatibility and love predictions using AI-based analysis.

Check Match

Fortune Cookie

Open an AI fortune cookie and receive wisdom, luck, and fun messages.

Open Cookie

Quiz Categories

Engage with knowledge-based and fun quizzes across multiple categories.

Start Quiz

Panchang Calendar

View daily Panchang, auspicious timings, tithi, nakshatra, and festivals.

View Panchang

Online Numerology

Discover your destiny number, life path, and numerology predictions.

Calculate Now

Spiritual Feeds

Stay connected with spiritual thoughts, mantras, and divine content.

View Feeds

Quiz Hub

Attempt trending quizzes on GK, spirituality, festivals, and more.

Explore Quizzes