JavaScript: Guides and Practical Know-how | Page 18 | mironsoft Blog
JavaScript
-
Mar 24, 2025
Local Git hooks live in .git/hooks and are never versioned with the repository, so every developer has to set them up individually and teams end up with no reliable way to enforce code quality before a commit. Husky distributes hooks automatically through npm, lint-staged limits checks to changed files, and commitlint enforces clean commit messages, all without manual setup.
-
Mar 18, 2025
Custom share buttons hardcoded to a handful of social media platforms are outdated. The Web Share API opens the operating system's native share dialog, and the user decides which app to use: WhatsApp, Telegram, Email, Notes, or anything else. The result is better UX with less code and no dependency on third-party SDKs.
-
Mar 16, 2025
switch/case only handles primitive equality, nested conditions quickly become unreadable, and there is no expression character at all. The TC39 Pattern Matching Proposal changes that: a match expression checks structure, type, shape, and value of an object at the same time, declaratively, exhaustively, and without a fallthrough bug.
-
Mar 16, 2025
An ordinary Map used to associate objects with private state prevents those objects from ever being collected by the garbage collector as long as the map exists. WeakMap and WeakSet solve exactly this problem by only weakly referencing their keys, enabling private state that automatically disappears along with its associated object.
-
Mar 14, 2025
JavaScript is single-threaded, but that is not a law of nature for browser applications. Web Workers bring real multithreading to the browser: CPU-intensive calculations, file processing, encryption and AI inference run in background threads while the UI thread stays responsive and processes user interactions smoothly.
-
Mar 12, 2025
Module Federation in Webpack 5 solves what has long been the hardest problem in micro-frontend architectures: how multiple independent teams can combine their JavaScript bundles at runtime, without loading shared dependencies multiple times or sharing a central build pipeline.
-
Mar 4, 2025
The new using keyword in JavaScript automates releasing resources when a scope is left: database connections, file handles, locks and workers are guaranteed to be cleaned up, whether the block ends normally, throws an exception, or triggers an early return.
-
Mar 2, 2025
Data attribute variants like data-[state=open] let Tailwind react directly to states that a component library or Alpine.js sets in the markup, with no JavaScript manually adding or removing CSS classes. Combined with custom variants through @custom-variant, this produces state-driven UI that cleanly separates state from presentation.
-
Feb 28, 2025
In JavaScript, the original error gets lost on re-throw: an Error is replaced by another one, and the context disappears. The error.cause feature from ES2022 solves exactly this problem. It allows structured error chains where each layer keeps its own context while the root error is passed through.
-
Feb 27, 2025
An error inside an async function disappears without a trace, the console shows an unhandled rejection, an empty catch block hides exactly the problem you were looking for. Promise error handling follows its own rules, different from synchronous try catch. This article shows the concrete pitfalls and how to reliably avoid them.