🚨 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗺𝗮𝘆 𝗿𝗲𝗺𝗼𝘃𝗲 𝘁𝗵𝗲 𝗻𝗲𝗲𝗱 𝗳𝗼𝗿 𝘁𝗿𝘆...𝗰𝗮𝘁𝗰𝗵. Yes, you read that right. A new TC39 Stage-1 proposal is exploring a completely different way to handle errors in JavaScript. And it looks something like this: 𝗰𝗼𝗻𝘀𝘁 𝗱𝗮𝘁𝗮 = 𝘁𝗿𝘆 𝗮𝘄𝗮𝗶𝘁 𝗳𝗲𝘁𝗰𝗵𝗗𝗮𝘁𝗮(); 𝗜𝗻𝘀𝘁𝗲𝗮𝗱 𝗼𝗳 𝘄𝗿𝗮𝗽𝗽𝗶𝗻𝗴 𝗲𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 𝗶𝗻 𝘁𝗵𝗶𝘀: 𝘁𝗿𝘆 { 𝗰𝗼𝗻𝘀𝘁 𝗱𝗮𝘁𝗮 = 𝗮𝘄𝗮𝗶𝘁 𝗳𝗲𝘁𝗰𝗵𝗗𝗮𝘁𝗮(); } 𝗰𝗮𝘁𝗰𝗵 (𝗲𝗿𝗿) { 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗲𝗿𝗿𝗼𝗿(𝗲𝗿𝗿); } The idea is inline error handling — inspired by languages like Go and Rust. Why this matters 👇 • Less nested code • Cleaner async logic • More readable error handling • Fewer complex promise chains 𝗔𝗻𝘆𝗼𝗻𝗲 𝘄𝗵𝗼 𝗵𝗮𝘀 𝗯𝘂𝗶𝗹𝘁 𝗮 𝗹𝗮𝗿𝗴𝗲 𝗡𝗼𝗱𝗲.𝗷𝘀 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝗼𝗿 𝗳𝗿𝗼𝗻𝘁𝗲𝗻𝗱 𝘀𝘆𝘀𝘁𝗲𝗺 𝗸𝗻𝗼𝘄𝘀 𝗵𝗼𝘄 𝗺𝗲𝘀𝘀𝘆 𝗲𝗿𝗿𝗼𝗿 𝗵𝗮𝗻𝗱𝗹𝗶𝗻𝗴 𝗰𝗮𝗻 𝗯𝗲𝗰𝗼𝗺𝗲. 𝗧𝗵𝗶𝘀 𝗽𝗿𝗼𝗽𝗼𝘀𝗮𝗹 𝘁𝗿𝗶𝗲𝘀 𝘁𝗼 𝘀𝗶𝗺𝗽𝗹𝗶𝗳𝘆 𝘁𝗵𝗮𝘁 𝗽𝗮𝗶𝗻. But before we get too excited: ⚠️ It’s currently Stage 1 in the TC39 process. Meaning it’s very early and may change a lot — or may never ship. Still, it highlights something important: JavaScript is continuously evolving by learning from other languages. And if this idea moves forward, it could change how we write async code forever. Curious to hear from developers 👇 Would you replace try...catch with inline error handling? #javascript #nodejs #webdevelopment #softwareengineering #programming #developers #coding
JavaScript Inline Error Handling Proposal
More Relevant Posts
-
DSA session update — Strings and Time & Space Complexity! ✅ Strings in JavaScript Strings are everywhere in development — but I never truly studied them from a DSA perspective before. This time I went deep: 🔹 String traversal 🔹 Reverse, palindrome problems 🔹 Character frequency & counting 🔹 Substring problems 🔹 String comparison techniques Time & Space Complexity This is what separates a working solution from a good one. Writing code that runs is not enough — understanding how it scales is what really matters. 🔹 Big O Notation — O(1), O(n), O(n²), O(log n) 🔹 Time Complexity — how algorithm scales with input size 🔹 Space Complexity — how much memory your solution uses 🔹 Best, average & worst case analysis 🔹 Choosing the right tradeoffs for each problem What clicked for me — every decision I make while coding now has a cost. Knowing that cost is what makes you think like a real engineer, not just a developer. Alhamdulillah for every concept that deepens the foundation. 🚀 #JavaScript #DSA #Strings #TimeComplexity #SpaceComplexity #BigO #FrontEndDevelopment #InterviewPrep #LearningInPublic #CareerGrowth
To view or add a comment, sign in
-
-
𝗩𝗮𝗻𝗶𝗹𝗹𝗮 𝗖𝗼𝗱𝗲: 𝗛𝗼𝘄 𝗩𝟴 𝗖𝗼𝗺𝗽𝗶𝗹𝗲𝘀 𝗬𝗼𝘂𝗿 𝗖𝗼𝗱𝗲 You spend your days working with JavaScript. But have you ever wondered what happens behind the scenes? When you run your code, V8 - the JavaScript engine - takes over. It's not just a compiler, it's a performance expert. Here's how it works: - V8 reads your code as a stream of characters - It builds a blueprint, called the Abstract Syntax Tree (AST) - V8 is lazy, so it only builds the full AST when needed - It uses an interpreter, called Ignition, to turn the AST into bytecode - Bytecode is like stage directions for your code When your code runs, V8 watches and takes notes. It looks for hot paths - loops that run many times. When it finds them, it uses Sparkplug to compile the bytecode to machine code. If a function is super hot, V8 uses Maglev to create a baseline optimized version. For critical code, V8 uses TurboFan, an optimizing compiler. TurboFan makes a bet: it assumes your code will keep doing what it's doing. If you keep passing it the same types, your code runs fast. But if you change the type, V8 falls back to the slower bytecode. To keep V8 happy, write consistent code. Use consistent types, small functions, and avoid deleting properties. JavaScript is not slow - your misuse of it is. V8 is a masterpiece of engineering. It's a Just-In-Time compiler that does adaptive optimization. When you write code, you're feeding an algorithm. Understand how it thinks, and you'll stop fighting the machine. Source: https://lnkd.in/g4Fkem6a
To view or add a comment, sign in
-
#day53 Headline: 0ms Runtime | Beats 100% of JavaScript Submissions 🚀 Just cleared the "Single Element in a Sorted Array" challenge on LeetCode with $O(\log n)$ time complexity and $O(1)$ space. While a simple XOR approach works in $O(n)$, the real challenge was implementing a binary search that correctly navigates the even/odd index logic to find that one unique element in logarithmic time. There's a specific kind of satisfaction in seeing that "Beats 100%" metric. It's a reminder that in software engineering, the difference between "it works" and "it's optimal" is where the real fun begins. #LeetCode #JavaScript #DataStructures #Algorithms #CodingLife #Optimization #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 933 of #1000DaysOfCode ✨ Sorting Arrays in JavaScript — Different Types Explained Sorting isn’t always just about numbers in ascending order. In today’s post, I’ve covered sorting arrays in JavaScript for different data types — whether it’s numbers, strings, objects, or more complex structures. The goal is to help you understand how sorting behaves internally and how to customize it properly. If you’ve ever faced unexpected results while using `.sort()`, this post will help you gain clarity and control. 👇 What type of array do you find most challenging to sort? #Day933 #learningoftheday #1000daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #Next #CodingCommunity
To view or add a comment, sign in
-
𝗠𝗮𝘀𝘁𝗲𝗿 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗠𝗲𝗺𝗼𝗿𝘆: 𝗚𝗮𝗿𝗯𝗮𝗴𝗲 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗶𝗼𝗻 𝗘𝘅𝗽𝗹𝗮𝗶𝗻𝗲𝗱! ♻️ Ever wondered how JavaScript keeps your apps running smoothly without eating up all your RAM? The secret is Garbage Collection (GC)! 🚀 Here is a quick breakdown of how it works: Memory Allocation: When you create objects, strings, or functions, JS automatically reserves a spot in the Memory Heap. 💾 The Reachability Concept: The engine looks for "reachable" values—those that are still accessible from the "roots" (like the global window object or active function calls). 🔗 𝗠𝗮𝗿𝗸-𝗮𝗻𝗱-𝗦𝘄𝗲𝗲𝗽 𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺: 1. Mark: The GC "marks" all reachable objects as Alive. ✅ 2. Sweep: It "sweeps" away anything not marked, freeing up that memory for new data. 🧹 𝗣𝗿𝗼-𝗧𝗶𝗽: Avoid memory leaks! If you're done with a large object, set it to null to ensure the GC knows it's ready to be cleared. 💡 Understanding these low-level concepts helps you write more efficient, high-performance code! 💻✨ #JavaScript #WebDevelopment #CodingTips #SoftwareEngineering #ProgrammingConcepts #MemoryManagement
To view or add a comment, sign in
-
-
JavaScript's Date object was broken in 1995. It took 31 years to fix it. ES2026 finally did it. 🎉 The Temporal API is here — and it's just the start of what ES2026 ships. Here's every feature that changes how you write JS: 🗓️ Temporal API — immutable, timezone-aware dates. Drop Moment.js for good. 🔒 using + await using — automatic resource cleanup. No more forgotten try/finally blocks. Files, DB connections, streams — all closed automatically when scope exits. ➕ Math.sumPrecise() — floating point math that actually works. [1e20, 0.1, -1e20].reduce((a,b)=>a+b) = 0 ❌ Math.sumPrecise([1e20, 0.1, -1e20]) = 0.1 ✅ ✅ Error.isError() — reliable error detection across iframes and VM contexts. instanceof Error was never trustworthy. ⚡ Array.fromAsync() — collect async iterables in one line. The async equivalent of Array.from. 🗺️ Map.getOrInsert() — upsert without the boilerplate. No more has() → set() → get() chains. 🔢 Uint8Array Base64/Hex methods — built-in binary encoding. No more btoa() gymnastics. 🔗 Iterator.concat() — chain iterators lazily. No intermediate arrays. I broke down every feature with before/after code in my article. Which feature are you most excited about? Drop a comment 👇 #JavaScript #ES2026 #ECMAScript #WebDev #Frontend #Programming #100DaysOfBlogging
To view or add a comment, sign in
-
Catching bugs at 2:00 PM but they don’t wake me up at 2:00 AM. 🛠️ Moving from #JavaScript to #TypeScript wasn’t just a syntax change; it was a shift in confidence. By defining our data structures upfront, we’ve effectively eliminated the "undefined is not a function" errors that used to haunt our production logs. The Difference: In JS, you pass an object and hope the property exists. In TS, the editor won't even let you save the file until you've handled the possibility of it being missing. Example: // JavaScript: The "Finger-Crossing" Method function getUsername(user) { return user.profile.name; // Runtime Error if profile is missing! } // TypeScript: The "Contract" Method interface User { profile?: { name: string }; } function getUsername(user: User) { return user.profile?.name ?? "Guest"; // Type-safe and explicit } The initial setup takes a few extra minutes, but the hours saved in debugging are immeasurable. Have you made the switch yet? Or are you still team Vanilla? 👇 #WebDevelopment #TypeScript #SoftwareEngineering #Coding
To view or add a comment, sign in
-
-
JavaScript type coercion isn't magic. It's a spec. Every unexpected output follows the same rules, in the same order: 1. Identify the operator 2. If an object is involved → call valueOf(), then toString() 3. If operator is + and either side is a string → concatenate 4. If operator is -, *, / → convert both sides to numbers 5. Compute That's it. Five steps. Runs every time. --- Where this breaks production code: [10] + [1] = "101" → Arrays are objects. valueOf() returns the array itself (not a primitive), so toString() runs next. [10].toString() = "10", [1].toString() = "1". Then + sees two strings. Concatenates. [10] - [1] = 9 → - forces ToNumber. [10] → 10, [1] → 1. Subtracts normally. Boolean([]) = true → [] is not in the falsy list. Truthy. "0" == false → true, but Boolean("0") → true → == coerces both sides to number first. Boolean() checks the falsy list directly. input.value, localStorage, URLSearchParams → Always strings. Wrap with Number() or parseInt() before any arithmetic. --- The complete falsy list (memorise this, not the edge cases): false / 0 / -0 / 0n / "" / null / undefined / NaN Eight values. Everything else is truthy. --- Use === by default. Use == only when you explicitly want coercion — and you almost never do. The spec is 20 years old. The bugs are still new because developers skip the fundamentals. #JavaScript #WebDev #Frontend #SoftwareEngineering #Programming
To view or add a comment, sign in
-
-
Most JavaScript loops look the same… until you use them with async. At the start, forEach and map felt almost identical (both iterate, just different intent side effects vs transformation). The real difference shows up when things break in production. forEach → fires async calls and forgets them map → returns promises you can actually control That small difference decides whether: - your DB queries finish properly - your errors are handled - your code silently fails The real lesson wasn’t about loops. It was about control over async execution. Here’s the mental model that finally clicked for me: - Need control & order → for...of, for, while - Need speed (parallel) → Promise.all with map - Large datasets / DB → batch operations (don’t overload your system) - Never use forEach with async ❌ Bonus: not all loop methods support early exit, worth exploring if you haven’t yet. Still learning to think less in terms of syntax… and more in terms of how execution actually flows. Curious: what’s a JS concept that surprised you later? Let’s share and go deeper. #javascript #nodejs #webdevelopment #backend #learning #chaicode Hitesh Choudhary
To view or add a comment, sign in
-
𝗧𝗮𝗸𝗲 𝗬𝗼𝘂𝗿 𝗧𝘆𝗽𝗲𝗦𝗰𝗿𝗶𝗽𝘁 𝗦𝗸𝗶𝗹𝗹𝘀 𝗧𝗼 𝗧𝗵𝗲 𝗡𝗲𝘅𝘁 𝗟𝗲𝘃𝗲𝗹 You use TypeScript to build robust JavaScript applications. But do you use its advanced type features? These features can eliminate bugs and make your code self-documenting. Let's look at an example. You're working with user roles in an application. You can use string literals, but this approach has limitations. What if you misspell a role? The compiler won't catch it. Advanced types solve this problem at compile time. You can define a type for user roles: - 'admin' - 'editor' - 'viewer' Then you can use this type to check permissions. This approach gives you autocomplete in your IDE and compile-time validation. You can also use discriminated unions to represent state machines or API responses. This pattern eliminates null checks and ensures you handle all possible states. Other advanced type features include: - Conditional types: create types that change based on other types - Mapped types: create new types by transforming properties of existing types - Template literal types: bring type safety to string manipulation You can combine these concepts to create a type-safe API client. This approach ensures your code is maintainable and bug-free. This week, identify one place in your codebase where you can improve typing. Convert it to use at least one advanced type feature. You'll be surprised how much clarity it brings to your code. What advanced TypeScript patterns have you found most valuable in your projects? Share your experiences in the comments below! Source: https://lnkd.in/gXJsb-DY
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