Skip to main content

Featured

🎉 Day 46 — React Mastery Completed (Final Summary & Congratulations!)

🎉 Day 46 — React Mastery Completed (Final Summary & Congratulations!) Congratulations, developer! 👏 You’ve successfully completed the 45-Day React.js Roadmap — from understanding the fundamentals to mastering advanced concepts like Redux, Routing, Testing, and Deployment. 📘 What You’ve Learned ✅ React basics — Components, JSX, Props, and State ✅ Hooks — useState, useEffect, useRef, useMemo, and Custom Hooks ✅ Context API and Redux Toolkit for global state management ✅ Routing with React Router & Protected Routes ✅ Data fetching using Fetch API, Axios, React Query ✅ Advanced Patterns — Compound Components, Render Props, HOCs ✅ Styling — CSS Modules, Styled Components, Theming ✅ Animations, Accessibility, Testing, and Performance Optimization ✅ Deployment on Vercel, Netlify, or GitHub Pages 🧩 Final Project Ideas Now that you’re done, build real-world apps to polish your skills: 📝 Task ...

📘 Day 35: Conditional Statements in JavaScript

📘 Day 35: Conditional Statements in JavaScript

Conditional statements allow your program to make decisions based on certain conditions. They help you control the flow of execution, so different code runs in different situations.

🔹 Types of Conditional Statements

  • if statement – Runs a block if the condition is true.
  • if...else statement – Runs one block if true, another if false.
  • if...else if...else ladder – Tests multiple conditions in sequence.
  • switch statement – Executes one case among many choices.

🧠 Example 1: if statement

let age = 18;
if (age >= 18) {
  console.log("You are eligible to vote!");
}

🧠 Example 2: if...else statement

let number = 10;
if (number % 2 === 0) {
  console.log("Even number");
} else {
  console.log("Odd number");
}

🧠 Example 3: if...else if...else ladder

let marks = 85;
if (marks >= 90) {
  console.log("Grade: A+");
} else if (marks >= 75) {
  console.log("Grade: A");
} else if (marks >= 60) {
  console.log("Grade: B");
} else {
  console.log("Grade: C");
}

🧠 Example 4: switch statement

let day = "Monday";

switch(day) {
  case "Monday":
    console.log("Start your week strong!");
    break;
  case "Friday":
    console.log("Weekend is almost here!");
    break;
  default:
    console.log("Enjoy your day!");
}

✅ Practice Task

Create a program that checks whether a number is positive, negative, or zero using if...else.

Comments