JavaScript-এ একটা ছোট trick 👇 ```js billingInfo.individual.address ||= billingInfo.billing_address; billingInfo.corporate.address ||= billingInfo.billing_address; billingInfo.individual.address ??= billingInfo.billing_address; billingInfo.corporate.address ??= billingInfo.billing_address; ``` `||=` vs `??=` — differenceটা subtle কিন্তু important 🔥 👉 `||=` → falsy হলেই replace করে (`"", 0, false` সহ) 👉 `??=` → শুধু `null` / `undefined` হলে replace করে Production code-এ wrong choice মানেই hidden bug 😅 আপনি কোনটা prefer করেন — `||=` নাকি `??=` ? 🤔 #JavaScript #CodingTips #CleanCode #WebDev
JavaScript || vs ?? Assignment Operators
More Relevant Posts
-
📘 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐌𝐨𝐝𝐮𝐥𝐞 (𝐁𝐚𝐬𝐢𝐜) -> Save this checklist, I hope it will be of great use in your next interview revision! 👇 𝐒𝐞𝐜𝐭𝐢𝐨𝐧 1: 𝐁𝐚𝐬𝐢𝐜 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 (𝐓𝐡𝐞 𝐟𝐮𝐧𝐝𝐚𝐦𝐞𝐧𝐭𝐚𝐥𝐬 𝐨𝐟 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭) 🎯 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧𝐬 (𝐄𝐱𝐭𝐫𝐚) 1. 𝐖𝐡𝐲 𝐢𝐬 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 𝐜𝐚𝐥𝐥𝐞𝐝 𝐚 𝐬𝐢𝐧𝐠𝐥𝐞-𝐭𝐡𝐫𝐞𝐚𝐝𝐞𝐝 𝐥𝐚𝐧𝐠𝐮𝐚𝐠𝐞? -> JavaScript can only do one thing at a time. It has only one path (Call Stack). If the work of one line is not completed, it does not go to the next line. 2. 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐞𝐯𝐞𝐧𝐭 𝐥𝐨𝐨𝐩 𝐢𝐧 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭? -> Suppose a task comes up in JavaScript that will take time (such as searching for data on the Internet). JavaScript puts that task aside and continues to do other tasks. When the task is completed, the Event Loop brings that data back to the main path. This is the event loop. 3. 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐉𝐈𝐓 (𝐉𝐮𝐬𝐭-𝐈𝐧-𝐓𝐢𝐦𝐞) 𝐜𝐨𝐦𝐩𝐢𝐥𝐚𝐭𝐢𝐨𝐧? -> It compiles at run time and makes it fast. 4. 𝐖𝐡𝐲 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 𝐢𝐬 𝐬𝐨 𝐩𝐨𝐩𝐮𝐥𝐚𝐫 𝐢𝐧 𝐰𝐞𝐛 𝐝𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭? -> Because it runs everywhere—in browsers, servers (Node.js), mobiles (React Native), and even electronic devices. Its community is very large. 5. 𝐃𝐨𝐞𝐬 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭 𝐨𝐧𝐥𝐲 𝐫𝐮𝐧 𝐢𝐧 𝐛𝐫𝐨𝐰𝐬𝐞𝐫𝐬? -> No. Now with Node.js it can be run on PC or server as well. #DotNet #AspNetCore #MVC #FullStack #SoftwareEngineering #ProgrammingTips #DeveloperLife #LearnToCode #JavaScript #JS #JavaScriptTips #JSLearning #FrontendDevelopment #WebDevelopment #CodingTips #CodeManagement #DevTools
To view or add a comment, sign in
-
-
🚀 **TypeScript vs JavaScript: Which One Should You Choose?** JavaScript has powered the web for decades—flexible, fast, and easy to start with. But as applications grow, managing large codebases becomes challenging. That’s where TypeScript comes in. 🔹 **JavaScript** * Dynamic typing * Quick to learn & use * Great for small to medium projects * Less strict → more runtime errors possible 🔹 **TypeScript** * Static typing (catch errors early) * Better tooling & IntelliSense * Scalable for large applications * Improves code maintainability 💡 **So, which one is better?** * Use JavaScript for rapid development and simple apps * Use TypeScript when working on large-scale, complex systems 👉 In reality, TypeScript is just JavaScript with superpowers. #JavaScript #TypeScript #WebDevelopment #Frontend #Programming #Developers
To view or add a comment, sign in
-
-
*JavaScript Beginner Roadmap* 🌐✨ 📂 *Start Here* ∟📂 Set Up Your Environment (Browser Console, VS Code) ∟📂 Write & Run Your First JS Script 📂 *JavaScript Basics* ∟📂 Variables (`let`, `const`, `var`) ∟📂 Data Types (Number, String, Boolean, Null, Undefined, Object) ∟📂 Operators (Arithmetic, Comparison, Logical) ∟📂 Control Flow (`if`, `else`, `switch`) ∟📂 Loops (`for`, `while`, `do-while`) 📂 *Functions* ∟📂 Function Declaration & Expression ∟📂 Arrow Functions ∟📂 Parameters & Return Values ∟📂 Scope & Closures 📂 *Objects & Arrays* ∟📂 Creating & Accessing Objects ∟📂 Arrays & Array Methods (`push`, `pop`, `map`, `filter`) 📂 *DOM Manipulation* ∟📂 Selecting Elements (`getElementById`, `querySelector`) ∟📂 Changing Content & Styles ∟📂 Event Handling (`click`, `input`) 📂 *Asynchronous JavaScript* ∟📂 Callbacks ∟📂 Promises ∟📂 Async/Await 📂 *Debugging & Tools* ∟📂 Console & Breakpoints ∟📂 DevTools Basics 📂 *Practice Projects* ∟📌 Interactive To-Do List ∟📌 Simple Calculator ∟📌 Quiz App 📂 ✅ *Next Steps* ∟📂 Learn ES6+ Features ∟📂 Introduction to Frameworks (React, Vue) ∟📂 Explore APIs & Fetch Data JavaScript Resources: https://lnkd.in/d4hnv6C2 *React "❤️" for more!* #js #webdev #webdeveloper #webaap #web
To view or add a comment, sign in
-
*JavaScript Beginner Roadmap* 🌐✨ 📂 *Start Here* ∟📂 Set Up Your Environment (Browser Console, VS Code) ∟📂 Write & Run Your First JS Script 📂 *JavaScript Basics* ∟📂 Variables (`let`, `const`, `var`) ∟📂 Data Types (Number, String, Boolean, Null, Undefined, Object) ∟📂 Operators (Arithmetic, Comparison, Logical) ∟📂 Control Flow (`if`, `else`, `switch`) ∟📂 Loops (`for`, `while`, `do-while`) 📂 *Functions* ∟📂 Function Declaration & Expression ∟📂 Arrow Functions ∟📂 Parameters & Return Values ∟📂 Scope & Closures 📂 *Objects & Arrays* ∟📂 Creating & Accessing Objects ∟📂 Arrays & Array Methods (`push`, `pop`, `map`, `filter`) 📂 *DOM Manipulation* ∟📂 Selecting Elements (`getElementById`, `querySelector`) ∟📂 Changing Content & Styles ∟📂 Event Handling (`click`, `input`) 📂 *Asynchronous JavaScript* ∟📂 Callbacks ∟📂 Promises ∟📂 Async/Await 📂 *Debugging & Tools* ∟📂 Console & Breakpoints ∟📂 DevTools Basics 📂 *Practice Projects* ∟📌 Interactive To-Do List ∟📌 Simple Calculator ∟📌 Quiz App 📂 ✅ *Next Steps* ∟📂 Learn ES6+ Features ∟📂 Introduction to Frameworks (React, Vue) ∟📂 Explore APIs & Fetch Data JavaScript Resources: https://lnkd.in/d4hnv6C2 *React "❤️" for more!* #web #js #js #developer
To view or add a comment, sign in
-
🔥 What Every Web Developer Should Know About JavaScript JavaScript was created in 10 days by Brendan Eich — speed ≠ simplicity. Master the fundamentals. ECMAScript is the spec; JavaScript is the implementation you write daily. ES6 (2015) changed everything: let/const, arrow functions, classes — know them deeply. Read more ... https://lnkd.in/ewpDB2ru #JavaScript #WebDevelopment #Frontend #Backend #NodeJS #ECMAScript #Programming #SoftwareEngineering #LearnToCode #TechCareer #Developers #CodingTips #AIinTech
To view or add a comment, sign in
-
From blueprint to deployment! The Full Stack Web Development Journey requires a solid foundation in HTML & CSS, the dynamism of JavaScript, and the scalability of a strong backend and database infrastructure. #FullStack #WebDevelopment #CodingLife #LearnToCode #JavaScript #HTML #CSS #Python #DevOps #Backend #Frontend #Database #CloudComputing #CareerInTech
To view or add a comment, sign in
-
-
Client-side vs Server-side 💻 Both are important parts of web development. 🌐 Client-side (Frontend): • Runs in the browser • What users see & interact with • Example: HTML, CSS, JavaScript ⚙️ Server-side (Backend): • Runs on the server • Handles logic, data & security • Example: Node.js, Python, PHP 💡 Simple: Client-side = UI Server-side = Logic Together, they create complete web applications. 🌐 [www.sreeweb.com](http://www.sreeweb.com) 📩 [contact@sreeweb.com](mailto:contact@sreeweb.com) #WebDevelopment #Frontend #Backend #Programming #SoftwareDevelopment #Tech #JavaScript #NodeJS #Developer
To view or add a comment, sign in
-
-
[ Here's what you need to know about the JavaScript Event Loop ] Most JavaScript developers use async code every day. But if you ask them what actually happens under the hood... silence. JavaScript is single-threaded. It does ONE thing at a time. Yet it handles async operations without freezing the entire page. Uhkay... BUT, How? The Event Loop existence is the guy behind it. There are 4 layers you need to understand: 1 - Call Stack Where your code actually executes — one line at a time. It only receives things that are ALREADY resolved and ready to run. 2 - Web APIs Where async tasks go to wait. setTimeout, fetch, event listeners — they all leave the Call Stack and sit here while they process. 3 - Callback Queue When a Web API task finishes, it pushes its callback here. The Event Loop picks it up only when the Call Stack is empty. 4 - Microtask Queue Same idea — but for Promises. And it has HIGHER priority than the Callback Queue. The order of execution is always: Call Stack → Microtask Queue (Promises) → Callback Queue (setTimeout, etc.) This is why this code might surprise you: console.log("1"); setTimeout(() => console.log("2"), 0); Promise.resolve().then(() => console.log("3")); console.log("4"); // Output: 1, 4, 3, 2 Even with 0ms delay, setTimeout runs LAST. Because it goes through the Callback Queue — and Promises (Microtask Queue) always go first. The key insight interviewers love to hear: "When a callback finally reaches the Call Stack, the work is already done. The Web API handled the heavy lifting. The Call Stack only receives results — never waiting tasks." This is one of the most asked JavaScript fundamentals in technical interviews. And most candidates get it half right. #javascript #webdevelopment #frontend #programming #technicalinterview
To view or add a comment, sign in
-
Let's dive into a common concept in JavaScript called promises. ❓ What is a promise? A promise is an object that represents the eventful result of an asynchronous operation,either success or failure. Let's think of an non-technical example: 💡 Food order in a restaurant: You place an order ---> pending Food arrives ---> resolved(fulfiled) Order failes--->rejected 💡 Basic Promise example: 𝙘𝙤𝙣𝙨𝙩 𝙥𝙧𝙤𝙢𝙞𝙨𝙚 = 𝙣𝙚𝙬 𝙋𝙧𝙤𝙢𝙞𝙨𝙚((𝙧𝙚𝙨𝙤𝙡𝙫𝙚,𝙧𝙚𝙟𝙚𝙘𝙩) => { 𝙘𝙤𝙣𝙨𝙩 𝙨𝙪𝙘𝙘𝙚𝙨𝙨 = 𝙩𝙧𝙪𝙚; 𝙞𝙛(𝙨𝙪𝙘𝙘𝙚𝙨𝙨) { 𝙧𝙚𝙨𝙤𝙡𝙫𝙚("𝘿𝙖𝙩𝙖 𝙛𝙚𝙩𝙘𝙝𝙚𝙙"); } 𝙚𝙡𝙨𝙚 { 𝙧𝙚𝙟𝙚𝙘𝙩("𝙀𝙧𝙧𝙤𝙧 𝙤𝙘𝙘𝙪𝙧𝙧𝙚𝙙"); } }); 💡 In Modern way we can handle/resolve a promise is using async/await: 𝐚𝐬𝐲𝐧𝐜 𝐟𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝐟𝐞𝐭𝐜𝐡𝐃𝐚𝐭𝐚() { 𝐭𝐫𝐲 { 𝐜𝐨𝐧𝐬𝐭 𝐫𝐞𝐬𝐮𝐥𝐭 = 𝐚𝐰𝐚𝐢𝐭 𝐩𝐫𝐨𝐦𝐢𝐬𝐞; 𝐜𝐨𝐧𝐬𝐨𝐥𝐞.𝐥𝐨𝐠(𝐫𝐞𝐬𝐮𝐥𝐭); } 𝐜𝐚𝐭𝐜𝐡 (𝐞𝐫𝐫𝐨𝐫) { 𝐜𝐨𝐧𝐬𝐨𝐥𝐞.𝐥𝐨𝐠(𝐞𝐫𝐫𝐨𝐫); } } ⏯️ Use cases: 1)API calls 2) setTimeout/async tasks 3)parallel operations 4)file upload/download 5)database calls #reactjs #reactinterview #react18 #frontendjobs #ReactJS #Node #Frontend #InterviewPreparation #JavaScript #FullStack #WebDevelopment #SoftwareEngineer #Learning #Hiring #Jobs #FresherJobs #TechTalks #Software #MERN #Frontend #JavaScript #React #CodingInterview #SoftwareEngineering #WebDevelopment
To view or add a comment, sign in
-
"JavaScript is single-threaded… but still handles async tasks?" 🤯 This is where the Event Loop comes in 🔥 Let’s understand it simply 👇 🔹 JavaScript is single-threaded It can do one task at a time using the Call Stack. 🔹 So how does async work? Thanks to: - Web APIs 🌐 - Callback Queue 📥 - Event Loop 🔁 💻 Example: console.log("Start"); setTimeout(() => { console.log("Async Task"); }, 0); console.log("End"); 👉 Output: Start End Async Task 🔹 Why this happens? - "setTimeout" goes to Web APIs - Then moves to Callback Queue - Event Loop waits for Call Stack to be empty - Then executes it 🚀 Pro Tip: Even "setTimeout(..., 0)" is NOT immediate. 💬 Did this surprise you the first time you learned it? 😄 #javascript #webdevelopment #mern #coding #developers
To view or add a comment, sign in
Explore related topics
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