Frontend Developer question bank
661 questions. Filter by level and skill, track what you've solved, and see how many people get each one right.
- Semantic element for site navigation
- Width with border-box
- Block scope of let
- Loose vs strict equality
- Centering with Flexbox
- Why React lists need keys
- Alt text for a decorative image
- Sync code runs before promise callbacks
- Linking a label to an input
- Default type of a form button
- What 1rem is relative to
- Where absolute elements are placed
- Hiding an element but keeping its space
- typeof null and arrays
- Changing a property of a const object
- Grid columns with fr units
- Media query for mobile-first CSS
- Page looks zoomed out on phones
- Numbers saved in localStorage
- What fetch does on a 404
- Input that ignores typing
- Changing a prop inside a child
- Inspecting an API response
- Installing a test-only package
- Tailwind md: prefix
- TypeScript types at runtime
- Optional chaining on missing data
- ?? versus || with zero
- Choosing a heading level
- Minimum text contrast for WCAG AA
- Native lazy loading for images
- What defer does on a script
- Order of click handlers
- Sorting numbers without a comparator
- What the main element is for
- article versus section
- Link or button
- What type="email" gives you
- Why <!DOCTYPE html> matters
- The lang attribute
- Width on a span
- Caption for a chart image
- Header cells in a data table
- Two elements with the same id
- Reading a data attribute
- Links that open a new tab
- Value of a number input
- A FAQ that opens and closes
- Marking up a date
- Gap between two stacked paragraphs
- Total width with content-box
- Sizing chips that sit in a line
- Axes in a column flexbox
- Spacing between flex items
- Flex items squeezed on one line
- Properties that inherit
- Nested em font sizes
- A ::before that does not show
- A floating WhatsApp button
- Square thumbnails from mixed photos
- Images that overflow on phones
- Striping table rows
- Choosing a line-height value
- first-child versus first-of-type
- Following the system dark mode
- Users who get dizzy from motion
- A hover transition
- A loading spinner that never stops
- Invisible text while fonts load
- Keeping a video box 16:9
- Hover effects on touch screens
- Smaller image files
- Nesting rules without Sass
- Printing an invoice page
- A heading with one word on the last line
- Why 0.1 + 0.2 is not 0.3
- Checking for NaN
- Plus and minus with a string
- Is an empty array truthy
- When a default parameter applies
- Swapping with destructuring
- Rename and default in destructuring
- Rest parameters versus arguments
- Array.from with a length
- Typo in a variable name
- What JSON.stringify leaves out
- replace changes only one match
- Changing one letter of a string
- typeof of a function
- What && and || return
- Resolving a promise twice
- What .then returns
- Results of Promise.allSettled
- race versus any
- Awaiting a non-promise
- Stopping a polling timer
- Default and named imports
- Parsing a broken JSON string
- Cancelling a fetch
- A long loop on the main thread
- Hiding a spinner with finally
- A rejection nobody handles
- Forgetting to await response.json
- Where to run a heavy calculation
- Behaviour of script type module
- Type inferred from a let
- Narrowing a union with typeof
- Declaring the same interface twice
- Type of an optional parameter
- Pushing to a readonly array
- Type of a const string
- What as const does to an array
- A tuple type
- Result type of find
- A function that returns nothing
- Limiting a prop to fixed values
- What JSX turns into
- A component written in lowercase
- Adding a CSS class in JSX
- Returning two elements
- A stray 0 on the page
- Handler that runs on every render
- Content between component tags
- Logging state right after setting it
- Two siblings that share a value
- Changing the initial state prop
- Rendering a list of cities
- A form that reloads the page
- Inline styles in JSX
- Hiding a component
- Logs that appear twice
- When useEffect runs
- An effect with an empty array
- When effect cleanup runs
- Focusing an input on a button click
- Reading the current language
- What useMemo is for
- What useCallback returns
- Finding which component is slow
- Splitting off a heavy admin page
- Finding a button in a test
- Asserting an error is gone
- Starting a new React project
- Why use a data-fetching library
- A secret key in import.meta.env
- State hooks in a server-only file
- Raw text in React Native
- Showing 5,000 contacts in React Native
- Choosing the selected option
- A name containing a script tag
- Starting a new React Native app
- Linking a label in JSX
- Showing rupees in Indian format
- Good LCP target
- Good CLS score
- Good INP target
- What TTFB measures
- FCP versus LCP
- Lab data versus field data
- Why CSS blocks rendering
- Images that push text down
- What preconnect does
- What a performance budget is
- What a long task is
- Testing on a slow network
- What to compress
- Metric INP replaced
- Why the 75th percentile
- no-cache versus no-store
- What a 304 response means
- Unit of max-age
- Modern image formats
- What srcset is for
- Main benefit of a CDN
- Best web font format
- font-display: swap
- HTTP/2 multiplexing
- What a service worker does
- Oversized product photo
- Brotli compared to gzip
- What HTTP/3 changes
- Reading the Network waterfall
- What Vary does
- What ~2.4.1 allows
- npm ci in pipelines
- Committing the lockfile
- What minification does
- What source maps are for
- Why the Vite dev server starts fast
- Loading code on demand
- What tree shaking is
- What npx does
- What a peer dependency is
- Tool for finding leaks
- When to use a web worker
- Timing visual updates
- What browserslist controls
- Detached DOM nodes
- What Speed Index shows
- Running Lighthouse in incognito
- Blurred image placeholder
- Catching slowdowns in PRs
- setTimeout vs microtasks
- Closures in a var loop
- Stale value in useEffect
- Which CSS rule wins
- Debounce vs throttle for search
- What INP measures
- Event delegation
- Multiple setState calls
- Arrow function as an object method
- One failed request breaks the dashboard
- What an async function returns
- Function hoisting and let
- Spread copies only one level
- Responsive card grid without media queries
- position: sticky does not stick
- Ref value not shown on screen
- Resize handler that runs many times
- Syncing derived values with an effect
- Form keeps the previous user data
- Test fails before data arrives
- toBe fails on equal objects
- Flaky end-to-end test with fixed waits
- Content jumps when images load
- Slow LCP from the hero image
- Caching fingerprinted bundles
- Fixing a CORS error
- Where to keep a session token
- Clickable div and keyboard users
- What showModal gives you
- unknown versus any
- useState in a Server Component
- Secret key with NEXT_PUBLIC_ prefix
- reduce on an empty array
- Which value a CSS variable takes
- Native element or ARIA
- Announcing "Added to cart"
- Grouping radio buttons
- Autofill for an OTP field
- A PIN field on mobile
- Serving AVIF with a fallback
- Images that push content down
- Order of async scripts
- Showing a user comment
- Live versus static lists
- target versus currentTarget
- preventDefault versus stopPropagation
- form.submit versus requestSubmit
- tabindex="3" on a field
- Skip link at the top
- hidden versus aria-hidden
- State of a menu button
- Loading the hero image sooner
- A preloaded font downloaded twice
- Pressing Enter in a search field
- Specificity of a nav link selector
- Inline style versus !important
- :is() versus :where()
- Styling a card that has an image
- What flex: 1 means
- Widths from flex-grow
- Pushing one nav item to the right
- One flex item aligned differently
- Naming grid areas
- A featured card that spans two columns
- Column width with gaps
- Centering with one grid rule
- Moving an element with position: relative
- An overlay that covers its card
- Icons that follow text colour
- Width that leaves room for a sidebar
- Font size from clamp()
- Spacing that flips for Arabic
- Focus rings only for the keyboard
- Resetting a property
- Why a big CSS file delays first paint
- A print stylesheet and render blocking
- will-change on everything
- A slow loop that resizes cards
- CSS variables versus Sass variables
- Reading a BEM class name
- What CSS Modules do
- A Tailwind colour that never appears
- Using transition: all
- Using a feature only where it exists
- Which image srcset downloads
- White scrollbars in dark mode
- A manual dark mode toggle
- Anchor target hidden under a header
- A swipe carousel without JavaScript
- A small gap below an image
- typeof before a let declaration
- Reading a var before it is set
- Two counters from one factory
- Keeping a balance private
- this in a plain function call
- Calling bind twice
- Property found on the prototype
- Arrow field versus class method
- null compared loosely
- Adding two arrays
- Freezing a nested config
- What structuredClone cannot copy
- Objects as keys in a plain object
- Attaching data to DOM nodes
- map over new Array(3)
- slice versus splice
- for...in over an array
- Number versus parseInt on "12px"
- includes versus indexOf with NaN
- Return value with finally
- When the executor runs
- A chain after catch
- Order of Promise.all results
- Reading pages with for await
- Error inside a setTimeout callback
- Total wait with exponential backoff
- Timing a JavaScript animation
- Loading a chart library on click
- An imported let that changes
- __dirname in an ES module
- nextTick versus promise in Node
- Wrapping an error with a cause
- Adding a timeout to fetch
- Listener that will not go away
- Passive touch listeners
- Handler that should run once
- When Promise.any rejects
- An endless chain of microtasks
- Resolving with two values
- What Promise.withResolvers gives
- Inferring a generic type
- Constraining a generic
- A typed getter with keyof
- Type for a PATCH body
- A tax-rate lookup table
- Narrowing on a kind field
- A function that narrows a type
- Narrowing with the in operator
- The ! after a value
- satisfies versus a type annotation
- Reusing a function’s return type
- Passing an object with extra fields
- Indexing with noUncheckedIndexedAccess
- Unwrapping a promise type
- Changing an object in state
- Adding to a list in state
- Removing a row from state
- Expensive initial state
- An input that loses focus on each key
- Two counters that share state
- Uncontrolled to controlled warning
- Same key in two different lists
- Passing a prop through five layers
- When to reach for useReducer
- State becomes undefined after an action
- A button inside a clickable card
- Children re-render with the parent
- A hook inside an if
- Two components using one custom hook
- Unique ids for a reusable field
- useFormStatus always says not pending
- Showing a form action’s result
- Default prop values
- When React onChange fires
- An effect that re-runs on every render
- useMemo that recomputes every time
- useCallback that changes nothing
- A slow page from one hover state
- Exposing only focus() from a component
- Cleaning up a window listener in an effect
- Rendering 20,000 rows
- Where to split a bundle first
- A Server Component inside a client wrapper
- Security of a Server Function
- staleTime versus gcTime
- Wrong orders shown for a new filter
- userEvent versus fireEvent
- Testing text that appears after a fetch
- The "not wrapped in act" warning
- A store hook that re-renders too often
- What the React Compiler does
- A tab switch that freezes the page
- dispatch in a dependency array
- The memo compare function
- Flexbox defaults in React Native
- Different code for iOS and Android
- Sharing logic: hook or HOC
- What a render prop is
- Building <Tabs> with <Tabs.Tab>
- Supporting both controlled and uncontrolled
- Where focus goes after a modal
- A big form that re-renders on each key
- Filters lost on refresh
- A list that stops updating
- Computing one layout shift
- What can be the LCP element
- Raising the hero image priority
- preload versus prefetch
- Console warning after preload
- Default behaviour of module scripts
- Inlining critical CSS
- dns-prefetch or preconnect
- Computing Total Blocking Time
- Parts of an interaction
- Breaking up a long handler
- Reading LCP in code
- Collecting real-user metrics
- Redirect chain hurts TTFB
- Page not restored on Back
- Instant next-page loads
- Skipping off-screen rendering
- Heavy chat widget
- Clicks ignored after load
- Lazy loading every image
- stale-while-revalidate
- Caching the HTML page
- Getting sizes right
- Origin load from hit ratio
- Low CDN hit ratio
- Large font for a few scripts
- When to pick font-display: optional
- Many weights of one font
- Self-hosting Google Fonts
- Users stuck on old version
- New service worker waits
- Domain sharding today
- Small file, slow page
- Different crop for phones
- Changing a file at the same URL
- Savings from Brotli
- Encoding images on upload
- Heavy animated GIF
- Three map embeds below the fold
- Icon font for 20 icons
- "sideEffects": false
- Why CommonJS shakes poorly
- Vendor chunk hash changes
- Two copies of one library
- Finding why a package is installed
- Forcing a nested version
- Does devDependencies keep code out?
- Leak through a closure
- Timer survives the component
- Caching data per DOM element
- Removing many listeners at once
- Low-priority background work
- Moment.js in the bundle
- Why esbuild is fast
- Polyfills nobody needs
- npm audit fix --force
- Package not found in a monorepo
- Finding unused JavaScript
- Touch listener slows scrolling
- Large CSS from a UI kit
- Staying within a JS budget
- Biggest weight in Lighthouse
- Limiting layout work
- Polling an API that rarely changes
- Faster clicks on links
- Serving AVIF from one URL
- Cause of a hydration mismatch
- Avoiding layout thrashing
- Race condition in data fetching
- Why React.memo did not help
- z-index that does not work
- Preventing XSS from user HTML
- Reducing the initial bundle
- Losing this when a method is extracted
- Ellipsis that never truncates in Flexbox
- Every context consumer re-renders
- Effect that fetches forever
- Tooltip flashes in the wrong place
- Janky slide-in animation
- Order of logs around await
- Order of object keys
- map with parseInt
- A CSP that stops injected scripts
- CSRF risk left with SameSite=Lax
- Unsafe postMessage listener
- Slow click handler hurts INP
- Layout shift when the web font loads
- Old version after deploy with a service worker
- Typing lags while a big list filters
- Optimistic like button done right
- Memory grows in a single-page app
- Importing one function pulls a whole library
- Cascade layers versus specificity
- Card layout based on its own width
- Exhaustive check with never
- When extra properties are an error
- Status message screen readers miss
- Comparator that returns a boolean
- aria-hidden on a parent of a button
- Which label wins
- Focus after client-side navigation
- Locking the page behind a drawer
- Global CSS and a shadow root
- Naming a custom element
- What is inside a template tag
- onclick stops working after adding CSP
- Detecting the end of a list
- A field that stays invalid
- Minimum contrast for body text
- Minimum size of a tap target
- Reordering with CSS order
- Relying on accept for uploads
- When a MutationObserver fires
- Child margin pushes the parent down
- A parent that ignores floated children
- What padding-top: 50% is based on
- A grid column that will not shrink
- auto-fill versus auto-fit with few items
- A fixed modal that scrolls away
- height: 100% that does nothing
- Specificity of :not() with a list
- Aligning titles across cards
- What dense packing does
- Widths after flex-shrink
- Animating a gradient angle
- z-index on a non-positioned block
- Centring an absolute box with auto margins
- Order of values in gap
- Full-height hero cut off on phones
- A view transition that is skipped
- A very long page that renders slowly
- Arabic and English user comments
- A hover shadow that drops frames
- Percentages in left versus translate
- Buttons vanish in high contrast mode
- Page jumps when a modal opens
- Scrolling leaks out of a modal
- A bottom bar under the iPhone home indicator
- Loading five font weights
- Closure holding a big array
- Spreading an object with a getter
- Symbol keys and JSON
- Object.is and negative zero
- Deep merge of user JSON
- Sorting orders that tie
- Using new on an arrow function
- Checking for a private field
- Passing values into a generator
- Making an object spreadable
- Arguments to a tagged template
- Proxy set trap that returns nothing
- arguments inside an arrow function
- Adding a BigInt and a number
- Class getter and hasOwnProperty
- return versus return await in try
- A promise awaited too late
- Breaking out of for await
- Progress bar that never moves
- Sending a callback to a worker
- ArrayBuffer after transfer
- Relying on FinalizationRegistry
- setImmediate inside an I/O callback
- A debounce that never debounces
- Time with a concurrency limit
- Throwing after resolve
- Top-level await in a config module
- Promise.resolve of a promise
- Breaking up a long task
- try/catch around forEach with async
- A conditional type over a union
- Extracting a type with infer
- Removing optional and readonly
- Building handler names from keys
- Method versus property function types
- Stopping mixed-up string IDs
- A const type parameter
- Type of the catch variable
- Typing a global on window
- What the {} type accepts
- Batching inside a timeout
- Scrolling to a just-added message
- Too many re-renders error
- Resetting selection when items change
- Setting state to the same value
- Items added twice in development
- A list item made of two elements
- Old value after an await
- use() that suspends forever
- Errors an error boundary misses
- Which fallback shows
- Clicks inside a portal
- Passing a ref to a function component
- Cleanup from a ref callback
- useContext with no Provider above
- useEffect(async () => ...)
- Two socket connections in development
- Relying on useMemo for correctness
- Logging the latest theme from an effect
- Streaming HTML with Suspense
- Passing onSelect from a Server Component
- Putting a function in useState
- Analytics event sent many times
- Reading a mutable store during render
- A transition around typing
- One user lookup per request
- Old content during a product change
- A huge bundle from one helper
- Mocking APIs in component tests
- Heavy work in useLayoutEffect
- Jumping to row 3,000 in a FlatList
- Animation stutters while data loads
- A custom hook with a stale callback
- Loading and error both true
- One slow field in a big form
- A user-supplied website link
- Organising a growing React codebase
- How CLS groups shifts
- Shifts after a click
- Where LCP time goes
- Download time of a bundle
- Why the first 14 KB matters
- Finding the script behind slow INP
- Big DOM, slow paint
- High TTFB only in the Gulf
- Marketing tags slow the page
- Font preloaded twice
- HTTP 103 Early Hints
- Loading non-critical CSS
- Good average, bad mobile
- LCP in a single-page app
- Explaining slow TTFB
- No Cache-Control header
- User data cached at the CDN
- Vary: User-Agent at the CDN
- Choosing an image CDN setup
- Preloading all fonts
- Matching the fallback font
- Service worker slows navigations
- Large cookies on every request
- Version in a query string
- Using HTTP/2 Server Push
- Picking the srcset candidate
- Invisible text on 3G
- Origin outage resilience
- Cache storage filling up
- Many edges hitting the origin
- Same bytes, different cost
- Slow builds from index files
- What scope hoisting gives
- Over-splitting a bundle
- Deep import breaks after upgrade
- Two instances of one package
- Estimating a leak
- Leak from a global listener
- Sending a big buffer to a worker
- Page views jump after prerendering
- Build fails after moving to pnpm
- One vendor chunk for everything
- Native import maps
- Risky install scripts
- Rendering a 10,000-row table
- High input delay at load
- Cost of a font swap shift
- Lab looks fine, users complain
- Moving tags off the main thread