Day 12 #100DaysOfCode 💻 Today I learned about Synchronous vs Asynchronous JavaScript, especially how setTimeout() and setInterval() work. JavaScript runs code synchronously by default (line by line). But functions like "setTimeout()" run asynchronously, meaning they execute later without blocking the main thread. Example: console.log("1"); setTimeout(() => { console.log("2"); }, 0); console.log("3"); Output: 1 3 2 Even with "0ms", "setTimeout" goes to the callback queue, so the synchronous code runs first. Understanding this concept helped me see how JavaScript handles non-blocking tasks. #JavaScript #AsyncJavaScript #WebDevelopment #CodingJourney #Akbiplob
JavaScript Synchronous vs Asynchronous Programming Basics
More Relevant Posts
-
One of the Best YouTube Videos on JavaScript Event Loop 🧑💻 The JavaScript Event Loop is one of the most important concepts to understand if you want to know how JavaScript handles asynchronous operations. I recently watched this video by Lydia Hallie and honestly, it’s one of the best explanations of the Event Loop on YouTube. She explains concepts like Call Stack, Web APIs, Task Queue and Microtask Queue in a very clear and visual way. If you want to understand how the Event Loop works, just watch this video once. Video: https://lnkd.in/gbg5PXQF #eventloop #javascript #webdevelopment #softwaredevelopment #learninpublic
To view or add a comment, sign in
-
-
🚀 What I Learned Today – JavaScript Basics Today I revised some important concepts in JavaScript: 🔹 Loops (for, while, do-while, for...of, for...in) 🔹 Infinite loop and why it should be avoided 🔹 Strings and how they store text 🔹 String properties (length, indexing) 🔹 Template literals & string interpolation 🔹 String methods (toUpperCase, trim, slice, replace, etc.) Also understood that strings are immutable in JavaScript. Small steps every day to become a better developer 💻 #JavaScript #WebDevelopment #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
🧠 Day 3 of 21 days challenge JavaScript Event Loop 🤯 Event Loop is a mechanism in JavaScript that handles execution of asynchronous code. It continuously checks the call stack and callback queue. If the stack is empty, it moves tasks from the queue to the stack for execution. For example :- console.log("Start"); console.log("End"); console.log("Timeout"); Wait… why this order? Because JavaScript doesn’t run everything instantly. It uses: • Call Stack • Web APIs • Callback Queue Event Loop decides what runs next. 💤For easy understanding :- Event Loop = decides execution order Sync code runs first Async code waits in queue Then runs after the stack is empty 👉 That’s why “Timeout” runs last This changed how I understand async code 🚀 #JavaScript #EventLoop #Async
To view or add a comment, sign in
-
-
✨ 𝗗𝗮𝘆 𝟮𝟮 𝗼𝗳 𝗠𝘆 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗝𝗼𝘂𝗿𝗻𝗲𝘆 🚀 (𝗙𝗶𝗻𝗮𝗹 𝗗𝗮𝘆 𝗼𝗳 𝗝𝗦 𝗙𝘂𝗻𝗱𝗮𝗺𝗲𝗻𝘁𝗮𝗹𝘀) Today I learned about the 𝘁𝗵𝗶𝘀 𝗸𝗲𝘆𝘄𝗼𝗿𝗱 and how its value changes in different scenarios in JavaScript. I explored how 𝘁𝗵𝗶𝘀 behaves in: 🔹 Global context 🔹 Regular functions 🔹 Object methods 🔹 Arrow functions 🔹 Constructor functions / classes I also learned how to control 𝘁𝗵𝗶𝘀 using 𝗰𝗮𝗹𝗹(), 𝗮𝗽𝗽𝗹𝘆(), 𝗮𝗻𝗱 𝗯𝗶𝗻𝗱(). Another important concept was understanding 𝗦𝘁𝗿𝗶𝗰𝘁 𝗠𝗼𝗱𝗲 𝘃𝘀 𝗡𝗼𝗻-𝗦𝘁𝗿𝗶𝗰𝘁 𝗠𝗼𝗱𝗲. In strict mode ("𝘂𝘀𝗲 𝘀𝘁𝗿𝗶𝗰𝘁"), JavaScript enforces stricter rules and prevents some common mistakes. For example, inside a regular function this becomes undefined instead of the global object, making behavior more predictable. Finishing these JavaScript fundamentals feels great. Now it’s time to move forward and build more complex projects! 💪 #JavaScript #100DaysOfCode #WebDevelopment #LearningJourney #FrontendDevelopment
To view or add a comment, sign in
-
-
🚨 Many beginners get confused between var, let, and const in JavaScript. They all create variables… but they behave very differently. If you understand this early, your JavaScript code will be cleaner and safer. Here is the simple difference 👇 • var Old way to create variables. It is function scoped and can be re-declared and updated. • let Modern JavaScript variable. It is block scoped and can be updated but not re-declared in the same scope. • const Used for values that should not change. It is block scoped and cannot be re-assigned. Quick tip 💡 Use const by default, let when value changes, and avoid var in modern JavaScript. Small concepts like this make a big difference in writing better code. #javascript #webdevelopment #frontenddevelopment #codingtips #learnjavascript #programmingbasics #softwaredevelopment #devcommunity #100daysofcode #javascriptdeveloper
To view or add a comment, sign in
-
-
🚀 JavaScript Fundamentals Series — Part 7 Most developers use arrays every day… But many don't fully understand array methods. This guide explains the most important ones: • map() • filter() • reduce() These methods help you write cleaner and more functional JavaScript. Once you master them, your code becomes much more expressive. Full guide 👇 https://lnkd.in/dZTRRCUx #javascript #webdevelopment #functionalprogramming
To view or add a comment, sign in
-
🚀 Day 947 of #1000DaysOfCode ✨ The Shortest JavaScript Program (You’ll Be Surprised 😮) This is one of those concepts that looks super simple… but completely changes how you see JavaScript. In today’s post, I’ve broken down the shortest possible JavaScript program — and trust me, it’s not just about writing less code. Behind this tiny piece of code lies how JavaScript actually runs your program, creates execution context, and prepares memory before even executing a single line. Sounds crazy? Wait till you see it. This is the kind of concept that once you understand, a lot of “weird JavaScript behavior” suddenly starts making sense. If you’re serious about mastering JavaScript, you don’t want to miss this one. 👉 Swipe through the carousel — this might blow your mind 🤯 👇 Did you already know what the shortest JS program is? #Day947 #learningoftheday #1000daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #Next #CodingCommunity #JSDeepDive
To view or add a comment, sign in
-
🚀 30 Days of JavaScript – Day 12 Can you solve these number puzzles? 🤔 Today I built a small JavaScript program that asks 3 number pattern questions and calculates the final score. 🧠 Concepts Used: conditional statements user input with prompt() variables and score tracking 🎥 Demo below 👇 Full source code in the First comment. #JavaScript #CodingChallenge #ProblemSolving #LearningJavaScript #WebDevelopment
To view or add a comment, sign in
-
Today I revised an important concept in JavaScript – Arrow Functions. Arrow functions help write shorter and cleaner functions compared to traditional functions. I practiced examples like addition, subtraction, and multiplication using arrow functions. Consistent practice is helping me strengthen my JavaScript fundamentals and improve my problem-solving skills. #JavaScript #WebDevelopment #FrontendDevelopment #CodingPractice #LearningJourney
To view or add a comment, sign in
-
-
just built a digital clock using javascript. sounds simple, but not gonna lie… seeing time update automatically felt cooler than it should have . Finally understanding how javascript actually makes a webpage *do* things instead of just sitting there looking pretty. small project, but big confidence boost. trying to move from “watched tutorial” to “ok wait I can build stuff now”. github link in comments. #buildinpublic #javascript #codingjourney #learning
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