🚀 Day 4: My JavaScript Journey 💻✨ Today I explored some core fundamentals of JavaScript that every developer must know 🔥 📌 What I Learned Today: ➤ 🔢 Operators in JavaScript ✔️ Arithmetic Operators (+, -, *, /) ✔️ Assignment Operators (=, +=, -=) ✔️ Comparison Operators (==, ===, !=, >, <) ➤ ⚖️ Double vs Triple Equals 👉 == checks value (loose equality) 👉 === checks value + type (strict equality) ➤ 🔄 Type Conversion (Very Important!) ✔️ String ➝ Number ✔️ Number ➝ String ✔️ Boolean ➝ Number/String ✔️ Null & Undefined behavior ⚠️ Learned about NaN (Not a Number) — a tricky concept 😵 ➤ 📜 JavaScript Rules = ECMAScript 👉 Standards that define how JS works ➤ 🧠 Floating Point Precision Issue 😲 Example: 0.1 + 0.2 ≠ 0.3 (exactly) ✔️ Learned how to handle it ➤ 🔍 Equality with null & undefined 👉 JS behaves differently in loose equality ➤ 🔤 String Comparison using ASCII values ➤ 🔁 Loops in JavaScript ✔️ for loop ✔️ while loop ✔️ do-while loop ➤ 🔀 Conditionals ✔️ if-else ✔️ else-if ➤ 🔗 Logical Operators ✔️ AND (&&) + Short Circuiting ⚡ ✔️ OR (||) ✔️ NOT EQUAL (!=) 💡 Key Takeaway: JavaScript looks simple but has many hidden behaviors 😄 Understanding these basics deeply will make coding much stronger 💪 📈 Step by step improving every day! #JavaScript #WebDevelopment #MERNStack #CodingJourney #Learning #DeveloperLife 💻🔥
JavaScript Fundamentals: Operators, Equality, and Loops
More Relevant Posts
-
I stopped chasing correct answers in JavaScript today… and started chasing why I was wrong. 👇 --- 💥 Mistakes that taught me more than tutorials: ❌ Thought "onclick" supports multiple handlers 👉 It overrides—use "addEventListener" instead ❌ Confused arrow function "this" 👉 Arrow functions don’t have their own "this" ❌ Expected "var" to behave like "let" 👉 Faced hoisting and scope differences ❌ Assumed async code runs in order 👉 Learned: microtasks run before macrotasks ❌ Misunderstood "await" 👉 It pauses execution and resumes via the microtask queue ❌ Ignored shallow copy behavior 👉 Spread operator copies references, not nested objects --- 💡 Big shift: I wasn’t stuck because JavaScript is hard… I was stuck because I wasn’t questioning why. --- 🎯 What changed: ✔ I analyze outputs instead of guessing ✔ I understand how JS behaves under the hood ✔ I debug with clarity, not confusion --- 📌 Lesson: Mistakes in coding aren’t failures. They’re proof that your understanding is evolving. --- 🚀 Next focus: Closures + real-world problem solving --- If you're learning JavaScript: 👉 Which concept confused you the most? 👉 And what finally made it click? Let’s learn together 👇 #JavaScript #LearningInPublic #Frontend #CodingJourney #Debugging
To view or add a comment, sign in
-
🚀 Day 6 of My JavaScript Journey Today was all about mastering Strings & Date Object in JavaScript — and honestly, it made me realize how powerful these basics really are 🔥 Here’s what I learned 👇 📌 Strings in JavaScript Different ways to create strings ("", '', and backticks ` `) Why backticks (template literals) are modern & super useful 💡 Finding string length using .length Accessing characters using index 📌 Important Concept Strings are immutable → original value can’t be changed ⚠️ 📌 String Methods Convert text: .toUpperCase() .toLowerCase() Search inside strings: .includes(), .indexOf() Extract parts: .slice() (supports negative index 🔥) .substring() Modify strings: .replace() .trim() Convert string to array: .split() 📌 Concatenation Combine strings using + Mixing numbers with strings → automatic type conversion 🤯 📌 Date Object (Real Game Changer 🕒) Getting current date & time Understanding UTC vs Local Time Formatting date (ISO & local formats) Extracting parts like year, month, day Creating custom dates 📌 Advanced Concepts Date.now() → gives milliseconds since Epoch (Jan 1, 1970) ⏳ Importance of UTC & Epoch Time in real-world apps Browser automatically converts UTC → Local Time 🌍 💡 Big Learning: Even basic things like strings & dates have deep concepts that are used in real-world applications like chat apps, logs, scheduling systems, etc. Consistency is the key 🔑 Day by day, getting closer to becoming a better developer 💻🔥 #JavaScript #WebDevelopment #MERNStack #CodingJourney #Day6 #Learning #Developers
To view or add a comment, sign in
-
-
🚀 **Day 4 – Scope Chain & Lexical Environment in JavaScript** In Day 3, we learned about Execution Context… But now the real question is: 👉 **How does JavaScript find variables when executing code?** 🤔 Let’s understand 👇 --- 💡 **What is Scope?** Scope defines **where a variable can be accessed** 👉 Simple: Scope = where is variable available ? --- 💡 **What is Scope Chain?** When JavaScript tries to access a variable: 👉 It searches in this order: * Current scope * Parent scope * Global scope 👉 This is called **Scope Chain** --- 💡 **Example:** ```js let name = "Aman"; function outer() { let city = "Indore"; function inner() { console.log(name); console.log(city); } inner(); } outer(); ``` --- 💡 **Behind the scenes:** When `inner()` runs: * looks for `name` → not in inner * goes to parent → not found * goes to global → found * looks for `city` → found in outer 👉 JavaScript climbs the **scope chain** --- 💡 **What is Lexical Environment?** 👉 It means: Scope is decided by where code is written, not where it is called --- ⚡ **Key Insight** JavaScript uses: * Scope * Scope Chain * Lexical Environment 👉 to resolve variables --- 💡 **Why this matters?** Because this is the base of: * Closures * Variable access * Debugging scope issues --- 👨💻 Continuing my JavaScript fundamentals series 👉 Next: **Hoisting (most misunderstood concept)** 👀 #JavaScript #WebDevelopment #FrontendDevelopment #Coding #SoftwareEngineer #Tech
To view or add a comment, sign in
-
-
💡 Event Propagation in JavaScript — Simple Way to Teach & Learn Aaj maine ek interesting concept bachon ko sikhaya: Event Propagation (Capturing & Bubbling) — aur honestly, unko samajh a gaya in just a few minutes 🚀 👉 Jab hum kisi element (like a button) par click karte hain, event sirf us element tak limited nahi rehta… wo travel karta hai DOM tree mein 👇 🔹 Capturing Phase (Top → Down) Event sab se upar (document) se start hota hai aur target element tak aata hai 🔹 Target Phase Jahan actual click hota hai (e.g. button) 🔹 Bubbling Phase (Down → Up) Event wapas upar ki taraf jata hai (parent → body → html → document) 🔥 Simple Demo Code: <div id="parent" style="padding:20px; background:lightblue;"> Parent <button id="child">Click Me</button> </div> <script> document.getElementById("parent").addEventListener("click", () => { console.log("Parent Clicked"); }); document.getElementById("child").addEventListener("click", (e) => { console.log("Button Clicked"); // e.stopPropagation(); // try this to stop bubbling }); </script> 🧠 Pro Tip: By default, JavaScript uses bubbling phase But you can switch to capturing using: element.addEventListener("click", handler, true); ✨ Teaching tip: Visual examples + console logs = instant clarity Agar aap junior devs ya students ko sikha rahe ho, ye concept MUST hai — React ho ya vanilla JS, har jaga kaam aata hai. #JavaScript #Frontend #WebDevelopment #Coding #Learning #Teaching #ReactJS
To view or add a comment, sign in
-
-
🚀 JavaScript Hoisting — what it actually means (with a simple mental model) Most people say: “Variables and functions are moved to the top". Even the educators on youtube (some of them) are teaching that and even I remember answering that in my first interview call. That’s not wrong… but it’s also not the full picture. Then Priya what’s really happening? JavaScript doesn’t “move” your code. Instead, during execution, it runs in two phases: 1️⃣ Creation Phase Memory is allocated Variables → initialised as undefined Functions → fully stored in memory 2️⃣ Execution Phase Code runs line by line Values are assigned 🎨 Think of it like this: Before running your code, JavaScript prepares a “memory box” 📦 Creation Phase: a → undefined sayHi → function() { ... } Execution Phase: console.log(a) → undefined a = 10 🔍 Example 1 (var) console.log(a); // undefined var a = 10; 👉 Why? Because JS already did: var a = undefined; ⚡ Example 2 (function) sayHi(); // Works! function sayHi() { console.log("Hello"); } 👉 Functions are fully hoisted with their definition. 🚫 Example 3 (let / const) console.log(a); // ❌ ReferenceError let a = 10; 👉 They are hoisted too… But stuck in the Temporal Dead Zone (TDZ) until initialised. 🧩 Simple rule to remember: var → hoisted + undefined function → hoisted completely let/const → hoisted but unusable before declaration 💬 Ever seen undefined and wondered why? 👉 That’s hoisting working behind the scenes. #javascript #webdevelopment #frontend #reactjs #programming #100DaysOfCode
To view or add a comment, sign in
-
-
Day 17 of my JavaScript learning journey 🚀 Today, I started building a Form Validation system using HTML, CSS, and JavaScript. This one felt different from my previous projects because it’s closer to real-world applications, every website needs proper form validation. Here’s what I worked on: • Validating user input fields (Name, Phone, Email, Message) • Displaying real-time error messages • Using regex to check for correct name format • Preventing empty submissions • Giving visual feedback (error text & success icons) • Structuring cleaner validation functions One thing I learned today is how important user experience is. It’s not just about collecting input, it’s about guiding the user and preventing mistakes before submission. I also started understanding how to break logic into small functions like: • validateName() • validateEmail() • validatePhone() That made the code easier to manage and debug. Still working on improving validation for all fields, but this is a solid step forward. Consistency is paying off 💪 #JavaScript #WebDevelopment #Frontend #100DaysOfCode #LearningInPublic
To view or add a comment, sign in
-
-
Ever felt like JavaScript is just… pretending to be object-oriented? Like you write a function, slap a .prototype on it, and boom - suddenly it's a “class”? 😄 Now enter the "new" keyword. And this is where things get interesting. Because "new" is not just syntax. It’s doing a bunch of hidden work for you. Let’s break it down: You write this: function User(name) { this.name = name; } const user1 = new User("John"); Looks simple, right? But under the hood, JavaScript is doing FOUR steps automatically: - It creates a brand new empty object - It links that object to User.prototype - It sets this inside User to that new object - It returns the object (unless you explicitly return something else) So essentially, "new" is like your invisible assistant. Without new, you'd have to manually do all of this: const obj = {}; Object.setPrototypeOf(obj, User.prototype); User.call(obj, "John"); And honestly… nobody wants to write that every time. - new is not about “creating a class instance” - It’s about orchestrating object creation + prototype linkage + execution context JavaScript doesn’t magically become OOP. It’s still doing what it always does - just giving us a shortcut. #JavaScript #WebDevelopment #Programming #Coding
To view or add a comment, sign in
-
Javascript: NaN ⚠️ JavaScript has a value that literally means “Not a Number”… but it is still a number type! Yes, that confusing value is called NaN. Many beginners get surprised when they see it in their code. Let’s simplify it. NaN stands for Not a Number, and it appears when JavaScript fails to convert something into a valid number. Example situations: • Trying to divide something impossible → 0 / 0 • Converting text into numbers → Number("Hello") • Invalid math operations → Math.sqrt(-1) • Parsing wrong values → parseInt("abc") Important things to remember: • typeof NaN is "number" 🤯 • NaN is not equal to itself (NaN === NaN → false) • Use Number.isNaN() to properly check it • It often appears during data validation bugs Understanding NaN helps you avoid hidden bugs in JavaScript applications. Small concept… but very important for debugging. #JavaScript #WebDevelopment #FrontendDevelopment #LearnToCode #ProgrammingTips #JavaScriptBasics #CodingForBeginners #SoftwareEngineering #DevCommunity #100DaysOfCode
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
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