Async JavaScript and the Browser interview questions
100 Frontend Engineering practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise Async JavaScript and the Browser questionsBeginner
- A CORS error when calling an API
- Adding a copy-to-clipboard button
- An async function returns a Promise instead of the value
- async and await
- Callbacks in JavaScript
- Click handlers don't work on newly added elements
- CORS from the frontend perspective
- Detecting when an element becomes visible
- DOMContentLoaded vs load
- Event bubbling and capturing
- Event delegation
- Event listeners and the event object
- fetch doesn't throw on a 404 error
- Handling errors with fetch
- Loading more items as the user scrolls
- localStorage, sessionStorage and cookies
- Making several requests at the same time
- Microtasks vs macrotasks
- preventDefault vs stopPropagation
- Preventing double form submissions
- Promises basics
- Remembering a user's preference between visits
- requestAnimationFrame
- Script loading with async and defer
- setTimeout and setInterval
- Submitting a form reloads the page
- Synchronous vs asynchronous code
- The DOM and how JavaScript changes it
- The event loop in the browser
- The Fetch API basics
- The History API and URLs
- The page freezes during a heavy calculation
- The window and document objects
- Working with forms and FormData
Intermediate
- A button click feels slow to respond
- A third-party script slows down your page
- Adding offline support to a web app
- Adding timeouts to fetch requests
- Cancelling requests with AbortController
- Choosing between WebSockets and Server-Sent Events
- Cookie security attributes
- Error handling in async code and unhandled rejections
- Handling token refresh when many requests run at once
- How browser HTTP caching works
- Implementing polling efficiently
- IndexedDB
- IntersectionObserver, ResizeObserver and MutationObserver
- Keeping state in sync across browser tabs
- Limiting how many requests run at once
- Loading code only when it's needed
- Long tasks and Interaction to Next Paint
- Moving heavy computation to a Web Worker
- Observers and listeners cause a memory leak
- Pausing work when the tab is hidden
- postMessage and cross-window communication
- Promise.all, allSettled, race and any
- Retrying failed requests with backoff
- Scheduling work: requestIdleCallback and yielding
- Search results appear out of order
- Service Workers
- The same-origin policy
- The Streams API and streaming fetch responses
- Unhandled promise rejections in production
- Uploading large files with progress feedback
- Web components and custom elements
- Web Workers
- WebSockets vs Server-Sent Events vs polling
Experienced
- A long-running dashboard leaks memory over days
- Back navigation is slow because the page isn't restored from cache
- Browser performance measurement APIs
- Browser storage quotas, eviction and persistence
- Building a robust request layer for a large app
- Building real-time collaborative editing in the browser
- Content Security Policy and Trusted Types
- Coordinating tabs with Web Locks and BroadcastChannel
- Cross-origin isolation, COOP and COEP
- Debugging a race condition in complex async flows
- Designing a prefetching strategy
- Designing a web push notification strategy
- Designing offline-first sync with conflict resolution
- Enabling SharedArrayBuffer for WebAssembly threads
- Governing third-party scripts across the site
- Implementing resumable uploads
- Improving responsiveness in a complex app with poor INP
- Main thread scheduling and yielding strategies
- Making your app resilient on flaky mobile networks
- Measuring real-user performance
- Only one tab should hold the real-time connection
- Processing very large files entirely in the browser
- Push notifications and background sync on the web
- Rolling out a strict Content Security Policy
- Securing postMessage communication with embedded iframes
- Service worker caching strategies
- Service worker lifecycle and update strategies
- The back/forward cache
- The event loop and rendering steps in detail
- Users are stuck on an old version because of a service worker
- Users lose locally stored data unexpectedly
- Web Worker communication becomes a bottleneck
- WebAssembly in the browser