🚀 Did you know? In JavaScript, setTimeout(..., 0) doesn’t actually run immediately. It runs after all Promises and await calls — even if the delay is 0ms 🧠 Why? Because JS runs all microtasks (like Promises and await) before moving on to macrotasks (like setTimeout, setInterval, etc.). 💡 Takeaway: Understanding the event loop helps you fix async bugs and write smoother, predictable code. #JavaScript #Coding #WebDevelopment #EventLoop #AsyncProgramming #CodeTips #Developers #Learning #letsLearnWithPrateek #Day7 Here’s proof 👇
setTimeout(0) doesn't run immediately in JavaScript. Why? How to fix async bugs.
More Relevant Posts
-
💻 Day 2 — Learning to Think in Logic 🧠 Today was all about decision making in JavaScript — learning how code “thinks.” I explored conditional statements: if, else if, switch, and even played around with alert, prompt, and error handling. It’s wild how these simple tools form the foundation of every program’s logic. Each concept feels like another small piece of the bigger picture coming together. Still early days — but every line of code is one step closer to clarity and confidence. 🌱 #Day2 #CodingJourney #MERNStack #LearnInPublic #JavaScript
To view or add a comment, sign in
-
-
🚀 Day 8 of My 30 Days of JavaScript Journey ✅ Challenge: Function Composition (LeetCode #2629) Build a function compose(functions) that returns a new function representing the composition of all given functions. When called with an input x, it evaluates from right to left, applying each function in sequence. If no functions are provided, it returns the identity function — meaning f(x) = x. 💻 Language Used: JavaScript ❓ Problem Link: https://lnkd.in/gEXnFK4d 💡 Solution: https://lnkd.in/gjKcFQvB 🧠 Concept Highlighted: This challenge explores function composition, a key concept in functional programming, showing how multiple simple functions can combine to form powerful transformations. It reinforces the importance of execution order and function chaining in JavaScript. #Day8 #JavaScript #LeetCode #30DaysOfCode #CodingChallenge #WebDevelopment #FrontendDevelopment #FunctionalProgramming #LearningEveryday #ProblemSolving
To view or add a comment, sign in
-
🚀 JavaScript Scope Understanding scope is one of the keys to writing clean, bug-free JavaScript. 👉 Global Scope: Accessible everywhere 👉 Function Scope: Accessible only inside the function 👉 Block Scope (let, const): Accessible only inside {} 👉 Local Scope: Exists only where it's declared Mastering scope = fewer errors + cleaner code. 💡 Happy coding! ⚡ #JavaScript #JS #WebDevelopment #Frontend #Coding #Programmer #Developer #SoftwareEngineer #LearningToCode #TechLearning #100DaysOfCode #CodeNewbie #WebDeveloper #TechEducation #CleanCode #ProgrammingBasics #SoftwareDevelopment #ES6 #FullStack #TechCommunity #Debugging #WomenWhoCode #Developers #LearnJavaScript #NaveenCodes
To view or add a comment, sign in
-
Let’s talk about something small but mighty in JavaScript, the Spread Operator (...). You’ve probably seen it before those three dots that seem to be doing “magic.” But what they really do is expand (or “spread out”) the contents of an array or object. In simple terms, the spread operator helps you: - Copy arrays or objects without changing the original one. - Combine multiple arrays or objects easily. - Pass array elements as separate arguments in functions. For example, if you have an array of numbers and you want to copy it, you can use the spread operator instead of manually looping. The same thing applies to merging two arrays or adding new properties to an object. It’s one of those small features that make your code cleaner and easier to understand, and you’ll see it a lot when working with frameworks like React. #JavaScript #LearnInPublic #WebDevelopment #Coding #Backend #100DaysOfCode #Tech
To view or add a comment, sign in
-
-
If you only had 2 hours a week to learn JavaScript, what would you do? Here’s what actually works: 1️⃣ Review what you learned last week. 2️⃣ Complete the next CSX unit. 3️⃣ Join a free Beginner Study Group to practice with others. Start free on https://lnkd.in/eNshGh4b and take your first JavaScript lesson today. You’ll write real code in your browser and see instant results.🌱 #javascript #coding #webdevelopment #csx #datatypes
To view or add a comment, sign in
-
⚡ 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 𝐇𝐨𝐢𝐬𝐭𝐢𝐧𝐠 𝐚𝐧𝐝 𝐒𝐜𝐨𝐩𝐞 𝐌𝐚𝐝𝐞 𝐒𝐢𝐦𝐩𝐥𝐞 ⚡ In JavaScript, two important concepts — 𝐡𝐨𝐢𝐬𝐭𝐢𝐧𝐠 and 𝐬𝐜𝐨𝐩𝐞 — control how your code runs. 𝐇𝐨𝐢𝐬𝐭𝐢𝐧𝐠 means JavaScript moves all variable and function declarations to the top before the code runs. That’s why you can sometimes use a function before it’s written. But remember — only declarations are hoisted, not values! Variables declared with var become undefined, while let and const are not accessible before declaration. 𝐒𝐜𝐨𝐩𝐞 decides where your variables can be used. 🌍 𝐆𝐥𝐨𝐛𝐚𝐥 Scope – You can use the variable anywhere in the program. ⚙️ 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 Scope – The variable works only inside that function. 📦 𝐁𝐥𝐨𝐜𝐤 Scope – Works only inside { }, when declared with let or const. Understanding hoisting and scope helps you know how JavaScript actually reads and runs your code — and that’s the key to avoiding errors and writing better programs. #javascript #js #Hoisting #Scope #softwaredeveloper #JavaScriptTips #JSTutorial #webdevelopment #frontenddevelopment #CodingTips #JavaScriptDeveloper #ES6 #Programming #Coding #JSLearning #JSTypes #education #LearnJavaScript #technology #w3schools #careers
To view or add a comment, sign in
-
Today, I explored an important JavaScript concept Hoisting. Hoisting means JavaScript moves declarations (not initializations) to the top of their scope before code execution.
⚡ 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 𝐇𝐨𝐢𝐬𝐭𝐢𝐧𝐠 𝐚𝐧𝐝 𝐒𝐜𝐨𝐩𝐞 𝐌𝐚𝐝𝐞 𝐒𝐢𝐦𝐩𝐥𝐞 ⚡ In JavaScript, two important concepts — 𝐡𝐨𝐢𝐬𝐭𝐢𝐧𝐠 and 𝐬𝐜𝐨𝐩𝐞 — control how your code runs. 𝐇𝐨𝐢𝐬𝐭𝐢𝐧𝐠 means JavaScript moves all variable and function declarations to the top before the code runs. That’s why you can sometimes use a function before it’s written. But remember — only declarations are hoisted, not values! Variables declared with var become undefined, while let and const are not accessible before declaration. 𝐒𝐜𝐨𝐩𝐞 decides where your variables can be used. 🌍 𝐆𝐥𝐨𝐛𝐚𝐥 Scope – You can use the variable anywhere in the program. ⚙️ 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 Scope – The variable works only inside that function. 📦 𝐁𝐥𝐨𝐜𝐤 Scope – Works only inside { }, when declared with let or const. Understanding hoisting and scope helps you know how JavaScript actually reads and runs your code — and that’s the key to avoiding errors and writing better programs. #javascript #js #Hoisting #Scope #softwaredeveloper #JavaScriptTips #JSTutorial #webdevelopment #frontenddevelopment #CodingTips #JavaScriptDeveloper #ES6 #Programming #Coding #JSLearning #JSTypes #education #LearnJavaScript #technology #w3schools #careers
To view or add a comment, sign in
-
Ever wondered what’s the real difference between Default Imports and Named Imports in JavaScript? Both might look similar, but they play very different roles in how you structure and manage your projects. Default Imports are perfect when you’re bringing in one main export from a file clean and simple. Named Imports, on the other hand, let you import multiple specific elements, giving you more control and flexibility in your codebase. Understanding these small distinctions can take your coding from good to great, making your projects easier to maintain and your teamwork smoother. #JavaScript #ReactJS #WebDevelopment #FrontendDeveloper #ProgrammingTips #SoftwareDevelopment #LearnCoding #WebDevCommunity #CodeBetter #TechLearning #SoftwareEngineer #SilverSparrowStudios
To view or add a comment, sign in
-
🧠 𝗖𝗹𝗼𝘀𝘂𝗿𝗲𝘀 & 𝗟𝗲𝘅𝗶𝗰𝗮𝗹 𝗦𝗰𝗼𝗽𝗶𝗻𝗴 — You Know ? Ever wondered how some functions “remember” variables even after they’ve finished executing? That’s the magic of Closures — one of the most powerful concepts in JavaScript. Here’s how it works 👇 ➡️ 𝗟𝗲𝘅𝗶𝗰𝗮𝗹 𝗦𝗰𝗼𝗽𝗶𝗻𝗴 means a function can access variables defined in its outer scope. ➡️ 𝗖𝗹𝗼𝘀𝘂𝗿𝗲 happens when an inner function remembers and uses variables from its outer function — even after the outer function has returned. #frontend #javascript #coding #learning #developer Muhammad Arham Amna BB Muhammad Awais Raza Awais IftikharAbdul Rehman Asghar Ali Abdul Rehman Waseem
To view or add a comment, sign in
-
-
🎯 Day 1 — Deep Dive into JavaScript Fundamentals Today I started my journey to strengthen the core of JavaScript, and it’s amazing how much depth lies behind the basics! 🚀 Here’s what I learned today: 🧩 Primitive vs Reference Types 🧠 typeof Operator Behavior ⚖️ Difference Between null and undefined 🪄 var vs let vs const and Variable Hoisting ⛔ Temporal Dead Zone (TDZ) 📦 Block Scope vs Function Scope 🔄 Implicit vs Explicit Type Conversion ✅ Truthy and Falsy Values 🔍 Comparison Operators & Type Coercion 🔧 Object to Primitive Conversion (valueOf, toString) 👇 Understanding this in Different Contexts: Global Context Object Methods Constructor Functions Arrow Functions Event Handlers Explicit & Implicit Bindings new Keyword Every topic connected like a puzzle — learning how JavaScript really works behind the scenes makes it even more exciting to code. 💻 #JavaScript #WebDevelopment #Day1 #LearningJourney #Frontend #Coding
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
Very informative