JavaScript Tutorial - If-Else Statements

Unlock Premium Features: AI explanations (Hinglish), Indian voice & Videos
Sign Up Free

๐Ÿค” If-Else - Decision Making

๐ŸŒŸ Daily Life Decisions:

โ˜” Agar baarish ho โ†’ Chhatri le jao
๐ŸŒž Warna โ†’ Chhatri ki zarurat nahi

๐ŸŽ“ Agar marks >= 40 โ†’ Pass
โŒ Warna โ†’ Fail

If-Else = Computer ko decisions sikhana!

๐Ÿ“ Syntax Patterns

1. Simple If
if (condition) {
  // True ho toh ye karo
}
2. If-Else
if (condition) {
  // True
} else {
  // False
}
3. If-Else If-Else
if (condition1) {
  // Option 1
} else if (condition2) {
  // Option 2
} else {
  // Default
}

๐Ÿค– AI Tutor Unlock Karo!

Apni language mein coding seekho - Hindi, Marathi, Gujarati aur 10+ Indian languages mein!

  • Hinglish mein explanations
  • Real-life examples
  • Beginner-friendly
Free Signup Karo

Example

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