𝗧𝗵𝗲 𝗲𝗿𝗿𝗼𝗿 𝗺𝗲𝘀𝘀𝗮𝗴𝗲 𝘄𝗮𝘀 𝗻𝗲𝘃𝗲𝗿 𝘁𝗵𝗲 𝗽𝗿𝗼𝗯𝗹𝗲𝗺. 𝗠𝘆 𝗿𝗲𝗮𝗰𝘁𝗶𝗼𝗻 𝘁𝗼 𝗶𝘁 𝘄𝗮𝘀. For a long time, whenever something broke, I would immediately try to fix it. Add logs. Change variables. Rewrite the function. Anything to make the error disappear. But most of the time, the error message was already telling me what was wrong. I just wasn’t reading it carefully #JavaScript #Debugging #DeveloperMindset
Anjani .C’s Post
More Relevant Posts
-
I once spent hours debugging something that made no sense. The code looked correct. The logic was simple. But the console logs were appearing in a strange order. Something like this: Promise 𝗿𝗲𝘀𝗼𝗹𝘃𝗲𝗱 Then 𝘀𝗲𝘁𝗧𝗶𝗺𝗲𝗼𝘂𝘁 Then another log I expected earlier. That’s when I discovered something many JavaScript developers overlook: Not all async tasks are treated the same. Some go to the 𝗺𝗶𝗰𝗿𝗼𝘁𝗮𝘀𝗸 𝗾𝘂𝗲𝘂𝗲. Some go to the 𝗺𝗮𝗰𝗿𝗼𝘁𝗮𝘀𝗸 𝗾𝘂𝗲𝘂𝗲. And JavaScript always clears microtasks first before moving to the next macrotask. That’s why: Promises, 𝗾𝘂𝗲𝘂𝗲𝗠𝗶𝗰𝗿𝗼𝘁𝗮𝘀𝗸, 𝗠𝘂𝘁𝗮𝘁𝗶𝗼𝗻𝗢𝗯𝘀𝗲𝗿𝘃𝗲𝗿 run earlier. While things like: 𝘀𝗲𝘁𝗧𝗶𝗺𝗲𝗼𝘂𝘁, 𝘀𝗲𝘁𝗜𝗻𝘁𝗲𝗿𝘃𝗮𝗹, 𝗗𝗢𝗠 𝗲𝘃𝗲𝗻𝘁𝘀 wait for the next event loop cycle. Once I understood this, a lot of 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗶𝘀 𝘄𝗲𝗶𝗿𝗱 moments stopped being weird. They were just the event loop doing exactly what it was designed to do. Sometimes the bug isn’t in the code. It’s in our 𝗺𝗲𝗻𝘁𝗮𝗹 𝗺𝗼𝗱𝗲𝗹 of how the runtime works. #JavaScript #EventLoop #FrontendEngineering #SoftwareEngineering
To view or add a comment, sign in
-
💥 🔍 Another vulnerability uncovered, buried deep inside the JavaScript. Source code review still wins. 🔍💥 Everyone scans endpoints. Few read the JavaScript and Debug. Bug: Improper Access Control Leading to Application-Wide PII Exposure #bugbounty #bugbountytips #sourcecodereview YesWeHack
To view or add a comment, sign in
-
-
👉 Minimum Operations to Alternate Binary String Instead of checking both patterns separately, we can: -Assume the string starts with '1' → pattern 1010... -Count mismatches. -The opposite pattern (0101...) mismatches will be length - mismatches. -Take the minimum of both. #javascript #typescript #codingpractice #dsa #algorithms #webdevelopment #softwaredevelopment #frontenddevelopment #problemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
The "Bug Hunter" (Focus: Stale Closures) Headline: The most common React bug isn't a crash. It's a "Stale Closure." 🕵️♂️ Ever had a useEffect or event listener that keeps seeing an "old" version of your state variable, even though the state definitely updated? Why it happens: JavaScript functions "close over" the variables available when they were defined. If your effect runs once ( [] dependency ), the function inside it is trapped in time. It effectively remembers the state from the first render forever. The Fix: Correct Dependencies: Always include state variables in the dependency array (or trust the linter!). Functional Updates: Use setState(prev => prev + 1) instead of setState(count + 1). If your state isn't updating, check your closures. #Debugging #JavaScript #ReactHooks #SoftwareDevelopment
To view or add a comment, sign in
-
I used var for 2 months. Big mistake. var → function-scoped, hoisted, unpredictable 😬 let → block-scoped, reassignable ✅ const → block-scoped, can't reassign ✅ Simple rule: Use const by default. Use let when you need to reassign. Forget var exists. Clean code starts here. 🙌 #JavaScript #WebDev #CodingTips #LearnToCode
To view or add a comment, sign in
-
-
Day 59/365 💻🔥 1011. Capacity To Ship Packages Within D Days (Medium) Instead of searching in the array, we binary searched the minimum ship capacity that allows shipping all packages within the given days. Key takeaway 🧠 If a problem asks for the minimum/maximum value under a constraint, think Binary Search on Answer. #Day59 #365DaysOfCode #LeetCode #BinarySearch #JavaScript #DSA
To view or add a comment, sign in
-
-
💻 JavaScript Intermediate – Remove Duplicates from an Array Duplicates in arrays can cause bugs or unnecessary processing. Here's a clean way to remove them. 📌 Problem: Get an array containing only unique values. JavaScript code function removeDuplicates(arr) { return [...new Set(arr)]; } console.log(removeDuplicates([1, 2, 2, 3])); 📤 Output: [1, 2, 3] 📖 Explanation: • Set automatically stores unique values only. • Spread operator ... converts it back to an array. 💡 Tip: Use this for data cleaning, API responses, or user inputs. #JavaScript #Coding #WebDevelopment #FrontendDevelopment #LearnToCode #ProgrammingTips
To view or add a comment, sign in
-
-
Today’s lesson from the console 👇 Not every line of code will make sense instantly. Not every bug will get fixed in one try. Not every day will feel productive. But every effort compounds. The logs you debug today. The fundamentals you revise. The mistakes you learn from. They quietly build the developer you’ll become tomorrow. 💻✨ 👉 Progress isn’t loud. It’s consistent. Keep learning. Keep shipping. Keep growing. 🚀 #WebDevelopment #JavaScript #LearningEveryday #DeveloperLife #GrowthMindset #Consistency
To view or add a comment, sign in
-
In today’s session, we focused on understanding asynchronous behavior in JavaScript and how to manage it effectively. Topics covered: • Promise states – pending, fulfilled, rejected • Proper chaining with .then() • Error handling using .catch() • Promise.resolve() • Promise.allSettled() • async/await with try-catch • Microtasks vs Macrotasks • Understanding the JavaScript Event Loop Step by step, building a stronger foundation in modern JavaScript 💻✨ #JavaScript #AsyncProgramming #WebDevelopment Hitesh Choudhary
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