Blog
Notes on data structures & algorithms, system design, and things I learn along the way.
Learning DSA? Follow the structured path — ordered articles from recursion to dynamic programming.→Why [10, 9, 1].sort() returns [1, 10, 9], how comparator functions work, why sort is stable and what that buys you, sorting text correctly with localeCompare and Intl.Collator, multi-key sorts, and toSorted() for sorting without mutating.
Objects make poor dictionaries: keys are coerced to strings, inherited properties get in the way, and size takes extra work. How Map and Set fix that — iteration order, identity-based keys, set operations, JSON — and how WeakMap and WeakSet stop object-keyed caches and metadata from leaking memory.
Every JavaScript number is a 64-bit binary float. Why that makes 0.1 + 0.2 equal 0.30000000000000004, why toFixed rounds 1.005 down, how large IDs silently change when parsed from JSON, and the practical rules: integer minor units for money, BigInt or strings for big IDs, and Intl for display.
Why setInterval animations stutter, how requestAnimationFrame syncs your code with the display's refresh, why movement should depend on elapsed time rather than frame count, what to animate so the browser can skip layout, and when CSS or the Web Animations API is the better tool.
What class syntax actually creates, how fields, getters, static members and static blocks work, and how #private fields give real encapsulation that no reflection API can see. Plus the gotchas: brand checks, Proxies, and when a closure is still the simpler choice.
Symbols are unique values that make collision-free property keys. How Symbol() differs from Symbol.for(), why symbol keys are skipped by Object.keys and JSON, and how well-known symbols like Symbol.iterator and Symbol.toPrimitive let your objects plug into for…of, spread, and type conversion.
Every JavaScript property has hidden flags — writable, enumerable, configurable — plus optional getters and setters. How Object.defineProperty sets them, why freeze is shallow, how freeze, seal and preventExtensions differ, and when TypeScript's readonly is the better tool.
1,234,567.89 or 12,34,567.89 or 1.234.567,89? JavaScript's built-in Intl API formats numbers, currencies, dates, relative times, lists and plurals correctly for any language — no libraries, no hand-written rules.
How errors travel up the call stack, how try/catch/finally works, why async errors become rejected promises, the fetch call that doesn't reject on a 404, and how to add context with error causes without losing the original problem.
Import one function from a library and you might ship all of it. How bundlers use the static structure of ES modules to drop unused exports, the things that silently defeat it — CommonJS, side effects, barrel files — and how to check what you're actually shipping.
38 posts tagged JavaScript · page 1 of 4