Browser and web
How the browser parses, renders and paints, the DOM, events and storage.
35 lessons 111 practice questions about 3 hours of reading
Chapter 1, beginner
Foundations
What it is and how it works, the questions every round starts with.
- 01How does classList.toggle() work in JavaScript?
Lesson, 6 min read, then 5 questions to practise
- 02innerHTML vs textContent vs innerText
Lesson, 5 min read, then 4 questions to practise
- Escape HTML and sanitize URLs to close XSS holes
- Write an allowlist HTML sanitizer: unwrap unknown tags, block disguised javascript: URLs and resist mutation XSS
- Implement a DOM-based text highlighter that preserves existing markup
- Find a string that spans several text nodes and return the matching nodes and offsets
- 03load vs DOMContentLoaded: what is the difference?
Lesson, 4 min read, then 4 questions to practise
- Put the steps from typing a URL to first paint in order, and mark what blocks rendering
- Survive the back/forward cache: write createPageLifecycle with pagehide, pageshow and visibilitychange
- Choose resource hints for a landing page: preload, preconnect, prefetch, modulepreload and fetchpriority
- Build a lazy image loader using IntersectionObserver
- 04localStorage vs sessionStorage vs cookies
Lesson, 4 min read, then 4 questions to practise
- Build storage that survives private browsing and quota errors
- Implement browser storage with TTL and schema-version migration
- Implement synchronization between browser tabs using BroadcastChannel
- Set cookies for an embedded checkout iframe: SameSite, Partitioned and fallbacks when third-party cookies are blocked
- 05mouseenter vs mouseover: what is the difference?
Lesson, 4 min read, then 4 questions to practise
- 06querySelector vs getElementById: which should you use?
Lesson, 4 min read, then 4 questions to practise
- Build a CSS selector engine: compound selectors, all four combinators, selector lists and right-to-left matching
- Implement getElementsByTagNameHierarchy() for descendant selectors
- Predict which elements CSS selectors match: nth-child, nth-of-type, :not, :has and sibling combinators
- Write closest() and matches() polyfills that work in detached trees and shadow roots
- 08What is the difference between the window and document objects?
Lesson, 4 min read, then 2 questions to practise
- 09What is the DOM?
Lesson, 4 min read, then 4 questions to practise
- 10XMLHttpRequest vs fetch: what is the difference?
Lesson, 4 min read, then 5 questions to practise
- Implement a fetch wrapper with timeout and AbortController
- Build a drag-and-drop file uploader with progress, cancel and retry
- Show download progress for a very large file with ReadableStream: totals, throttling and abort
- Implement request and response interceptors similar to Axios
- Implement useFetch() with loading, error, and cancellation
Chapter 2, intermediate
In depth
How it behaves under the hood, and the follow-ups that come next.
- 11Feature detection vs user agent sniffing
Lesson, 4 min read, then 4 questions to practise
- Build a polyfill loader that feature-detects and loads only what is missing, in dependency order
- Open a <dialog> with commandfor and command, and add a fallback for browsers without invoker commands
- Build a menu with the Popover API: popovertarget, light dismiss, toggle events, focus return and a fallback
- Polyfill AbortSignal.any() and AbortSignal.timeout(), then build withTimeout()
- 12How do search engines handle JavaScript and single-page apps?
Lesson, 4 min read, then 5 questions to practise
- Implement SSR hydration mismatch detection and a reproduction/fix exercise
- Design deep links as a versioned API: URL state, schema migrations, sharing and SEO
- Design an Amazon-style search results page: faceted filters, URL state, sorting, pagination or infinite scroll, and SEO
- Design a news article page like the New York Times: ads without layout shift, a metered paywall, speed, SEO and sharing
- Generate Speculation Rules: choose prefetch or prerender and eagerness from navigation data
- 13How do web push notifications work?
Lesson, 4 min read, then 4 questions to practise
- Design a notification system: in-app and push, with badge counts synced across tabs and devices
- Implement a simple Service Worker caching strategy
- Build a notification bell with an unread badge, grouped panel and live announcements
- Design a notification preferences centre: channels by categories, quiet hours, defaults and sync across devices
- 14How do you track impressions in an infinite feed with IntersectionObserver and sendBeacon?
Lesson, 6 min read, then 3 questions to practise
- 15HTTP/1.1 vs HTTP/2 vs HTTP/3: what changed?
Lesson, 4 min read, then 4 questions to practise
- Decide which HTTP/1 optimizations still help under HTTP/2 and HTTP/3, and model head-of-line blocking
- Choose Cache-Control headers for hashed assets, HTML and API responses
- Implement an HTTP cache with ETag validation, stale-while-revalidate, and request deduplication
- Design image delivery for an e-commerce site: responsive images, AVIF and WebP, CDN transforms, the LCP image and placeholders
- 16localStorage vs IndexedDB: what is the difference?
Lesson, 6 min read, then 4 questions to practise
- Fix an IndexedDB transaction that auto-commits during an await fetch()
- Implement an offline-first data synchronization queue using IndexedDB
- Design an offline-first PWA for field agents: offline forms, a photo upload queue, sync conflicts and storage limits
- Implement useLocalStorage() with serialization and cross-tab updates
- 17Process vs thread: how do browsers use them?
Lesson, 5 min read, then 5 questions to practise
- Implement a Web Worker for CPU-intensive computation
- Split a long task into chunks that yield to the browser to keep INP low
- Build a worker pool for fuzzy search: idle routing, a queue, latest-query-wins and transferables
- Make a page cross-origin isolated for SharedArrayBuffer: choose COOP, COEP and CORP and fix what breaks
- Implement a sandboxed JavaScript execution environment using an isolated iframe or worker, with a clearly defined security boundary
- 18Reflow vs repaint: what is the difference?
Lesson, 4 min read, then 3 questions to practise
- 19REST vs GraphQL: what is the difference?
Lesson, 4 min read, then 3 questions to practise
- 20Sync state across browser tabs: BroadcastChannel vs storage event vs SharedWorker
Lesson, 7 min read, then 3 questions to practise
- 21WebSockets vs polling vs Server-Sent Events
Lesson, 4 min read, then 5 questions to practise
- Choose long polling, Server-Sent Events or WebSocket for six real-time features
- Build a WebSocket client with reconnect, backoff, heartbeat and an offline send queue
- Parse a Server-Sent Events stream and resume with Last-Event-ID
- Implement a resilient polling engine with exponential backoff, visibility awareness, timeout, and cancellation
- Design a real-time dashboard with WebSocket subscriptions, reconnects, and high-volume updates
- 22What are Web Workers in JavaScript?
Lesson, 4 min read, then 1 question to practise
- 23What do the options of addEventListener do: capture, once, passive and signal?
Lesson, 4 min read, then 3 questions to practise
- 24What happens when you type a URL into the browser?
Lesson, 4 min read, then 1 question to practise
- 25What is a progressive web app (PWA)?
Lesson, 4 min read, then 1 question to practise
- 26What is a service worker?
Lesson, 4 min read, then 1 question to practise
- 27What is adaptive bitrate streaming? HLS vs DASH for frontend engineers
Lesson, 6 min read, then 5 questions to practise
- Design YouTube frontend: video playback, adaptive streaming, and feed virtualization
- Design live sports streaming like Hotstar for millions of viewers: the player, adaptive bitrate, ads, live scores and chat, and fallbacks
- Design adaptive media quality for slow networks: reduced-data mode, quality tiers and user override
- Design the Netflix web app: personalised rows, hover previews and the video player
- Design a short-video feed like Reels or TikTok: vertical swipe, autoplay, preloading, memory limits and engagement events
- 28What is CORS, and how does it work?
Lesson, 4 min read, then 4 questions to practise
- Diagnose a failing CORS preflight and write the server's CORS handler
- Implement a secure postMessage communication protocol between a parent page and embedded iframe
- Force cross-origin downloads with Content-Disposition and delegate camera and microphone to iframes
- Protect a web app from CSRF with signed tokens, Origin checks and SameSite cookies
- 29What is MutationObserver used for?
Lesson, 5 min read, then 2 questions to practise
- 30What is requestAnimationFrame used for?
Lesson, 6 min read, then 3 questions to practise
- 31What is the critical rendering path?
Lesson, 4 min read, then 1 question to practise
- 32What is the difference between an attribute and a property in the DOM?
Lesson, 4 min read, then 3 questions to practise
- 33What is the same-origin policy?
Lesson, 4 min read
- 34What was the 300ms tap delay on mobile and how is it removed?
Lesson, 4 min read, then 3 questions to practise
Chapter 3, advanced
Senior level
Trade-offs, edge cases and the questions senior rounds end on.
- 35What is background sync in a service worker?
Lesson, 5 min read