In reducers and signal updates, I still see a lot of `const next = [...arr]; next[i] = value` for single-index changes. The new `Array.prototype.with()` makes that intent explicit: create a new array with one element replaced, without mutating the original. The trade-off is runtime support and team familiarity, so you may still need polyfills or a clear TS/ES target in shared code. Where would you adopt `with()` first, and where would you avoid it for compatibility reasons? #javascript #typescript #frontend #immutability #redux
Jake O.’s Post
More Relevant Posts
-
Most developers don’t know this, but JavaScript can pause execution without blocking the thread. Not with setTimeout. Not with hacks. With microtasks. await Promise.resolve() That single line lets the current call stack finish flushes pending microtasks then continues execution cleanly Why it matters: sometimes you don’t want a delay you just want the browser to breathe This is how you fix subtle race conditions avoid weird UI glitches control execution order without timers It’s not magic. It’s how the event loop actually works. Most bugs aren’t about syntax. They’re about timing. #JavaScript #WebDevelopment #Frontend #EventLoop #Async #CleanCode
To view or add a comment, sign in
-
-
TIL there's a flat() method for arrays to 'flatten' the array. e.g., [[1,2,3], 4,5,6,7, [8,9]] can be converted to [1,2,3,4,5,6,7,8,9] How does one go around and find these things? #javascript #frontend
To view or add a comment, sign in
-
Here is a basic problem: Inline Logic Explosion 💥 This code works. But it smells. When JSX starts doing calculations, date comparisons, and condition chains, the readability takes a hit. What to do? 👉 Move decision-making out of JSX. 👉 Keep components declarative. 👉 Make logic testable and reusable. Have you seen (or written) code like this in production? 😄 #React #CleanCode #Frontend #CodeSmell #JavaScript #WebDevelopment
To view or add a comment, sign in
-
-
🔁 Closures in JavaScript A closure is when a function remembers variables from its parent function, even after the parent function has finished executing. function outer() { let count = 0; return function inner() { count++; console.log(count); } } const counter = outer(); counter(); // 1 counter(); // 2 👉 inner() still remembers count 👉 That memory is called a closure If closures ever confused you, save this post 👍 #JavaScript #WebDevelopment #Frontend #CodingSimplified #LearnJS #BhaviDigital
To view or add a comment, sign in
-
-
Ever wondered why your JavaScript logs run out of order? This is one of the most common async mistakes. The fix isn’t complex — it’s async/await. Once you see it, you can’t unsee it. Cleaner flow. Predictable output. Better code. Try this pattern in your code today. #JavaScript #AsyncAwait #WebDevelopment #Frontend #SoftwareEngineering #makstyle119
To view or add a comment, sign in
-
-
Day 9 of #75Hard Today was a reminder of how easy it is to forget the basics when libraries do the heavy lifting. While building a modal, I revisited: What a backdrop actually is (not CSS magic, but a real DOM layer) How event bubbling works Why stopPropagation() is critical to prevent unwanted closes Frameworks and UI libraries abstract these details so well that we stop questioning why things work — until we have to build them ourselves. Good reminder for me: If you don’t understand the core reason, you’re just assembling pieces — not engineering. Back to fundamentals. On to Day 10. #75Hard #JavaScript #WebDevelopment #Frontend #LearningInPublic #VueJS
To view or add a comment, sign in
-
-
Most grouping bugs I debug in production come from assuming keys are always strings. Object.groupBy() is fine for primitive keys, but anything else gets coerced into a property name. That means object/function keys collapse into "[object Object]", and you lose identity. Map.groupBy() keeps keys by reference, so lookups and merges remain predictable across code paths (assuming your runtime supports it, or you polyfill it). Where in your codebase are you grouping by something that isn’t naturally a string? #javascript #typescript #frontend #webdev
To view or add a comment, sign in
-
-
One pattern that's saved me countless debugging hours: Always capture your current state before async operations. When dealing with rapid user interactions, the state can change before your operation completes. This pattern ensures you're always working with the value that was current when the action started. #Frontend #AsyncPatterns #StateManagement #JavaScript #CunninghamsLaw
To view or add a comment, sign in
-
-
🔹JavaScript Tip: bind vs call vs apply These three methods are often confusing, but they all exist for one main reason: controlling the value of this when calling a function. Here’s a simple breakdown 👇 ✅ call() Invokes the function immediately Arguments are passed one by one ✅ apply() Invokes the function immediately Arguments are passed as an array ✅ bind() Does not invoke the function Returns a new function with this (and optional arguments) permanently bound Perfect for callbacks and event handlers Understanding these three makes working with callbacks, event listeners, and frameworks much easier. #JavaScript #WebDevelopment #Frontend #ProgrammingTips #CleanCode
To view or add a comment, sign in
-
-
🚀 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗧𝗶𝗽: 𝗦𝗽𝗮𝗿𝘀𝗲 𝗔𝗿𝗿𝗮𝘆𝘀 Sparse arrays are arrays that don’t have values at every index. 𝘤𝘰𝘯𝘴𝘵 𝘢𝘳𝘳 = [1, 2, , 3]; Notice the missing value? That empty slot still counts as an index but holds 𝗻𝗼 𝗮𝗰𝘁𝘂𝗮𝗹 𝗲𝗹𝗲𝗺𝗲𝗻𝘁. ⚠️ This can cause unexpected behavior with methods like map, forEach, and length. 👉 Always be mindful when working with arrays—𝘄𝗵𝗮𝘁 𝘆𝗼𝘂 𝗱𝗼𝗻’𝘁 𝘀𝗲𝗲 𝗰𝗮𝗻 𝘀𝘁𝗶𝗹𝗹 𝗺𝗮𝘁𝘁𝗲𝗿. #JavaScript #WebDevelopment #Frontend #ProgrammingTips #LearningInPublic
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