Day 2 of My JavaScript Learning Journey Today I explored some fundamental concepts that helped me understand how decision-making works in JavaScript and how code execution actually flows. Understanding if vs if-else - "if" always checks its condition independently. - Multiple "if" statements will all run if their conditions are true. - "else" does NOT take a condition — it only runs when the previous "if" is false. Example insight: If we write multiple "if" statements like this: let marks = 85; if(marks > 90){ console.log("O"); } if(marks > 80){ console.log("A"); } if(marks > 60){ console.log("C"); } else { console.log("FAIL"); } Output: A C Why? Because each "if" runs separately and checks its own condition. --- Important Learning If you want ONLY one condition to run, use: if...else if...else Otherwise, multiple outputs will come. --- Semicolon in JavaScript - Semicolon (";") is optional in many cases. - JavaScript automatically inserts it (ASI – Automatic Semicolon Insertion). But: - It becomes important when writing multiple statements in one line. Example: console.log("2"); console.log("nifty"); #JavaScript #WebDevelopment #CodingJourney #LearningInPublic #Day2
JavaScript Decision Making and Semicolons Explained
More Relevant Posts
-
Starting my JavaScript learning journey — sharing what I learn every day. 🚀 📅 JavaScript Learning Journey — Day 8 Today I learned about Loops in JavaScript — a powerful way to repeat tasks efficiently. Loops help us execute the same block of code multiple times without writing it again and again. --- 🔎 1. for Loop (Most Used) for (let i = 1; i <= 5; i++) { console.log(i); } 👉 Output: 1 2 3 4 5 --- 🔎 2. while Loop let i = 1; while (i <= 5) { console.log(i); i++; } --- 🔎 3. do...while Loop let i = 1; do { console.log(i); i++; } while (i <= 5); --- 🧠 When to use what? • "for" → when you know how many times to loop • "while" → when condition-based loop • "do...while" → runs at least once --- 📌 Key Takeaways (Day 8) • Loops reduce repetitive code • "for" loop is most commonly used • Always be careful with infinite loops ⚠️ --- This is Day 8 of my JavaScript learning series. Next, I’ll explore Functions in JavaScript. #JavaScript #WebDevelopment #FrontendDeveloper #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
Day 07 of My JavaScript Learning 👉 Finding the largest among three numbers How to compare multiple values using if-else Writing clean and readable conditions Converting logic into a reusable function // Find the largest among 3 numbers let firstNum = 5; let secondNum = 10; let thirdNum = 2; if (firstNum >= secondNum && firstNum >= thirdNum) { console.log(firstNum); } else if (secondNum >= firstNum && secondNum >= thirdNum) { console.log(secondNum); } else { console.log(thirdNum); } 🔁 Making it reusable with a function: let largestInFunction = function(firstNum, secondNum, thirdNum) { if (firstNum >= secondNum && firstNum >= thirdNum) { return firstNum; } else if (secondNum >= firstNum && secondNum >= thirdNum) { return secondNum; } else { return thirdNum; } } console.log(largestInFunction(3, 1, 4)); 🌱 My takeaway: Even simple problems help build strong fundamentals. The goal is not just solving — but understanding the logic behind it. #Day07 #JavaScript #LearningJourney #FrontendDeveloper #CodingPractice
To view or add a comment, sign in
-
Starting my JavaScript learning journey — sharing what I learn every day. 🚀 📅 JavaScript Learning Journey — Day 7 Today I learned about Conditions in JavaScript — how to make decisions in code. Conditions allow us to run different code based on different situations. --- 🔎 1. if Statement let age = 18; if (age >= 18) { console.log("You are an adult"); } --- 🔎 2. if...else let age = 16; if (age >= 18) { console.log("Adult"); } else { console.log("Not adult"); } --- 🔎 3. else if let marks = 75; if (marks >= 80) { console.log("A+"); } else if (marks >= 70) { console.log("A"); } else { console.log("B"); } --- 🔎 4. switch Statement let day = 2; switch(day) { case 1: console.log("Sunday"); break; case 2: console.log("Monday"); break; default: console.log("Invalid day"); } --- 📌 Key Takeaways (Day 7) • Conditions help make decisions • "if", "else", "else if" are most commonly used • "switch" is useful for multiple conditions --- This is Day 7 of my JavaScript learning series. Next, I’ll explore Loops in JavaScript. #JavaScript #WebDevelopment #FrontendDeveloper #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 3 of My JavaScript Learning Journey Today I explored some core concepts of JavaScript that every beginner must understand — and honestly, things are starting to make more sense now! 🔢 1. Numbers in JavaScript JavaScript has only one type for numbers — no separate integer or float. Example: 10 / 20 = 0.5 Even though both are integers, the output is a decimal. Simple but powerful! ✅ 2. Boolean Logic Understanding true/false conditions: 3 >= 3 → true 2 >= 3 → false Also learned something interesting 👇 Expressions are evaluated left to right: 1 >= 0 <= 5 < 6 >= 0 → true 🔄 3. Typecasting == → checks only value === → checks value + type This small difference can save you from big bugs! ⚡ 4. Logical Operators & Short Circuiting || (OR) → if any condition is true && (AND) → all conditions must be true ! (NOT) → reverses the result 👉 Short Circuiting: As soon as JavaScript gets the result, it stops checking further. Example: let marks = 45; let attendance = 60; if (marks >= 33 || attendance >= 75) { console.log("You are pass"); } else { console.log("Fail"); } 💡 Even if one condition is true, it won’t check the next! 🧵 5. Strings & Template Literals Instead of messy concatenation, we can use template literals: let naam = "Surbhi"; let kaam = "Web Developer"; let shaher = "Gurgaon"; let output = `Hi, I am ${naam}, a ${kaam} in ${shaher}`; Clean, readable, and modern ✨ 📌 Small steps every day… but building strong foundations! #javascript #codingjourney #webdevelopment #learninginpublic
To view or add a comment, sign in
-
🚀 Today’s Learning Update (JavaScript Fundamentals) Time: 3:00 PM – 4:00 PM Topic: Variables, Data Types, Operators, Conditional Statements, Ternary Operator, Unary Operator, Loops, Functions 🧠 What I focused on today I studied and revised the core JavaScript fundamentals with a clear approach: 👉 What is it? 👉 Why is it used? 👉 How does it work? 🟢 Variables What: Stores data in memory Why: To reuse and manage data How: Assigns a name to a value stored in memory 🟡 Data Types What: Types of data (String, Number, Boolean, etc.) Why: To define correct form of data How: JS identifies or assigns type automatically 🟠 Operators What: Symbols like +, -, == used for operations Why: For calculations and comparisons How: Takes values → performs operation → returns result 🔵 Conditional Statements What: Decision-making in code (if-else) Why: To control program flow How: Condition checked → true/false → block executes 🟣 Ternary Operator What: Short form of if-else Why: Write clean and short code How: condition ? value1 : value2 🟣 Unary Operator What: Works on single value (++, --, typeof) Why: For increment, decrement, and type checking How: Directly modifies or evaluates a single value 🟤 Loops What: Repeats code multiple times Why: To avoid repetition and automate tasks How: Runs until condition becomes false 🟢 Functions What: Reusable block of code Why: To avoid repetition and make code clean How: Define once → use multiple times 💡 Key Learning These are not just topics — they are the foundation of JavaScript. 👉 Without understanding these: You cannot solve coding problems You cannot learn DSA You cannot build real projects This is the base of programming, and I am focusing on building it strong before moving to advanced DSA and development. #JavaScript #WebDevelopment #FrontendDevelopment #LearningJourney #Consistency #ProgrammingBasics #DeveloperMindset
To view or add a comment, sign in
-
🚀 Day 14 of My JavaScript Learning Journey Today I learned about JavaScript Objects — Access, Add, Update & Delete properties. 📌 Key concepts I explored: 🔹 What is an Object? • A collection of key-value pairs • Used to store structured data Example: let user = { name: "Sanjay", age: 21 }; 🔹 Accessing Object Data • Dot Notation → user.name • Bracket Notation → user["age"] 💡 Bracket notation is useful when keys are dynamic or contain special characters. 🔹 Modifying Objects • Add → user.city = "Bangalore" • Update → user.age = 22 🔹 Deleting Properties • Use delete keyword Example: delete user.city; 🔹 Important Insight • Objects are mutable, meaning they can be changed after creation 💡 Understanding objects is essential because they are widely used to represent real-world data in applications. Step by step, I’m improving my JavaScript fundamentals and practical coding skills. 💻✨ #JavaScript #WebDevelopment #FrontendDevelopment #CodingJourney #LearningInPublic #100DaysOfCode #DeveloperJourney #ProgrammingBasics
To view or add a comment, sign in
-
-
🚀 Understanding JavaScript Promises is a must for every developer working with asynchronous code. When I first started learning JavaScript, handling async operations felt confusing—especially with nested callbacks. That’s where Promises changed everything. In this article, I’ve broken down: ✔️ The concept of Promises in a simple way ✔️ How they solve callback hell ✔️ Practical examples for better understanding ✔️ Common mistakes developers should avoid If you're preparing for interviews or improving your JavaScript fundamentals, this guide can be really useful. 🔗 https://lnkd.in/gTUfUvAB Curious to know—do you prefer using Promises directly or async/await in your projects? #JavaScript #SoftwareDevelopment #WebDevelopment #FrontendDevelopment #Programming #CodingTips
To view or add a comment, sign in
-
💡 Understanding Closures in JavaScript (My Learning Journey 🚀)💡 🔥Today, I explored one of the most important concepts in JavaScript — Closures 🔥 👉 A closure means: An inner function can access and remember the variables of its outer function, even after the outer function has finished execution. 🧠 What happens behind the scenes? 🔹 When JavaScript runs a program, it creates a Global Execution Context (GEC) and pushes it into the Call Stack. 🔹 Execution happens in two phases: 1️⃣ Memory (Creation Phase) 2️⃣ Code Execution Phase 🔹 When a function is invoked, a new Execution Context is created and pushed into the stack. 🔹 JavaScript follows lexical scope, meaning inner functions can access variables from their outer scope. 🔥 The Magic of Closures Even after the outer function completes execution and is removed from the call stack, the inner function still has access to the outer function’s variables. 👉 This is because the function maintains a reference to its lexical environment. 👉 Using the scope chain, JavaScript can still find and access those variables. 🎯 Key Concepts Involved ✅ Execution Context ✅ Call Stack ✅ Lexical Scope ✅ Scope Chain ✅ Closures 🚀 Why Closures are Powerful? ✔ Helps in data hiding (Encapsulation) ✔ Useful for maintaining state ✔ Used in callbacks and asynchronous programming ✔ Enables function factories 🔥 Conclusion Closures show how powerful JavaScript functions are. They don’t just execute — they remember where they were created. Understanding closures deeply helps in writing better and more efficient code. 💯 #JavaScript #Closures #WebDevelopment #FrontendDevelopment #CodingJourney #LearnInPublic #JSInternals #Developers
To view or add a comment, sign in
-
-
🚨 STOP SCROLLING if you're learning JavaScript... Quick question 👇 ❓ Are you still confused with JS basics or async stuff? Because this might fix that. I found a 40-page handwritten JavaScript notes PDF and it’s honestly GOLD 💯 No boring theory. No overcomplicated explanations. Just clear concepts + real examples. 📘 What’s inside? (Basics → Advanced) 🔥 Variables, Data Types & Operators (super clean explanations) 🔥 Functions, Scope & Closures (finally makes sense 🤯) 🔥 Arrays & Objects (real-life examples you’ll remember) 🔥 DOM Manipulation (actual use-cases, not just theory) 🔥 Async JS (Callbacks, Promises, async/await simplified) 🔥 Error Handling & Debugging 🔥 ES6+ (Arrow functions, destructuring, modules) 🔥 Mini Project Guide (so you actually build something 🚀) 💡 Why people love it: ✅ Beginner-friendly ✅ Perfect for quick revision ✅ No fluff, only what matters ✅ Easy handwritten format = faster learning ⚠️ Real talk... If you STILL struggle after this... …it’s probably not your resources anymore 😅 💬 Let’s make this fun: 👉 Comment “JS” and I’ll share the notes 👉 OR comment your biggest struggle in JavaScript (I’ll help you out) 👉 Already learning? Drop your level: Beginner / Intermediate / Advanced ❤️ Like if this helped 🔁 Repost to help a friend 💾 Save it for later #JavaScript #WebDevelopment #Coding #Programming #Developer #LearnToCode #CodingLife #Tech #SoftwareDeveloper #100DaysOfCode
To view or add a comment, sign in
More from this author
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development