JavaScript and Modern Web APIs
Posts, tutorials, and snippets on JavaScript — from asynchronous programming fundamentals to modern browser APIs like the Observer family — covering the language and platform features that power interactive web applications.
Content in JavaScript
Snippet:First N Matches from Any Iterable with
filter()andtake()Get the first N matches and stop reading.Return the first N matches from any iterable with Iterator.from(), filter() and take(), stopping as soon as it has enough, even on infinite sequences.Tutorial:Iterator Helpers: Lazy Pipelines over Any Iterator
Map, filter and take over any iterator, lazily.Use ES2025 iterator helpers (map, filter, take, drop, flatMap, reduce, Iterator.from) to build lazy pipelines over generators, Sets, Maps and infinite sequences.Tutorial:JavaScript Iterator
chunks(),windows(),includes()andjoin()Group, window, search and join any iterator natively.Use JavaScript's new iterator chunks(), windows(), includes() and join() for batching, moving averages and calendar rows, with edge cases and fallbacks.Post:Trusted Types and
eval: The Dynamic Code Brand Checks ProposalGuard eval and new Function with Trusted TypesWhy eval and new Function are risky, how Trusted Types and CSP contain them, and what the Stage 3 Dynamic Code Brand Checks proposal changes. Not in ES2027 yet.Snippet:Bytes to Hex and Back with
Uint8Array.fromHex()andtoHex()Convert bytes to hex and back without padStart loops.Encode bytes as hex with ES2026's Uint8Array toHex(), decode with fromHex() and setFromHex(), with SHA-256 digests, colours, error cases and a padStart fallback.