Skip to main content

Harshal V. LADHE

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() and take()

    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.
    Published at:
    Categories:JavaScript
    Estimated reading time:4 min read
  • 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.
    Published at:
    Categories:JavaScript
    Estimated reading time:10 min read
  • Tutorial:JavaScript Iterator chunks(), windows(), includes() and join()

    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.
    Published at:
    Categories:JavaScript
    Estimated reading time:13 min read
  • Post:Trusted Types and eval: The Dynamic Code Brand Checks Proposal

    Guard eval and new Function with Trusted Types
    Why 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.
    Published at:
    Categories:JavaScript
    Estimated reading time:16 min read
  • Snippet:Bytes to Hex and Back with Uint8Array.fromHex() and toHex()

    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.
    Published at:
    Categories:JavaScript
    Estimated reading time:5 min read