Dom interview questions
Practice 114 questions on dom. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
114 questions
- JavaScriptCoding exercise
Cookie Store
EASYImplement get/set/remove over document.cookie, handling encoding and expiry.
15 minPractice - UI / FrameworksUI challenge4 variants
Copy to Clipboard Button
EASYBuild a button that copies text to the clipboard and shows a transient copied confirmation.
15 minPractice - UI / FrameworksUI challenge4 variants
Counter
EASYBuild a counter component that increments a displayed number each time a button is clicked.
15 minAmazonPractice - JavaScriptCoding exercise
Deep Clone DOM
EASYImplement a deep clone of a DOM node and its subtree (element, text, and attributes) without cloneNode.
15 minPractice - JavaScriptCoding exercise
DOM Tree Height
EASYImplement a function that returns the height (max depth) of a DOM element's subtree.
15 minPractice - JavaScriptCoding exercise
Event Delegation
EASYImplement a delegated event listener that matches events bubbling up from descendants against a selector.
15 minPractice - UI / FrameworksUI challenge4 variants
FAQ Disclosure
EASYBuild a list of FAQ questions that each expand to reveal an answer on click.
15 minPractice - JavaScriptCoding exercise
Generate CSS Selector
EASYImplement a function that builds a unique CSS selector path from the root to a given element.
15 minPractice - JavaScriptCoding exercise
Get DOM Tags
EASYImplement a function returning the set of distinct tag names used in a DOM subtree, in document order.
15 minPractice - JavaScriptCoding exercise
jQuery.css
EASYImplement a jQuery-style helper that gets or sets inline CSS properties on a DOM element.
15 minLinkedInPractice - JavaScriptCoding exercise
Next Right Sibling
EASYImplement a function that finds the element immediately to the right of a target at the same tree depth.
15 minPractice - UI / FrameworksUI challenge4 variants
Toast Notification
EASYBuild a toast that appears on trigger and auto-dismisses after a few seconds, with manual close.
15 minPractice - UI / FrameworksUI challenge4 variants
Tooltip
EASYBuild a tooltip that shows on hover/focus of a trigger and hides on leave/blur.
15 minLinkedInPractice - JavaScriptCoding exercise
Traverse DOM (BFS)
EASYImplement a breadth-first traversal of a DOM tree, returning elements level by level.
15 minPractice - JavaScriptCoding exercise
useClickAnywhere
EASYImplement a hook that fires a callback whenever the user clicks anywhere in the window, cleaning up on unmount.
15 minPractice - JavaScriptCoding exercise
useCopyToClipboard
EASYImplement a hook returning the last copied text and an async copy function built on the Clipboard API.
15 minPractice - JavaScriptCoding exercise
useDocumentTitle
EASYImplement a hook that sets document.title and restores the previous title when the component unmounts.
15 minPractice - JavaScriptCoding exercise
useFavicon
EASYImplement a hook that swaps the page favicon imperatively to a given URL.
15 minPractice - JavaScriptCoding exercise
useFocus
EASYImplement a hook that exposes a ref plus a function to focus the attached element on demand.
15 minPractice - JavaScriptCoding exercise
useHover
EASYImplement a hook that reports whether a referenced element is currently being hovered.
15 minPractice - JavaScriptCoding exercise
useWindowSize
EASYImplement a hook that returns the current window width and height, updating on resize.
15 minPractice - UI / FrameworksUI challenge4 variants
Autoplay Carousel
MEDIUMBuild a carousel that auto-advances, wraps, pauses on hover or focus, and supports manual controls.
25 minPractice - JavaScriptCoding exercise
Corresponding Node Across Pages
MEDIUMImplement a function that locates the node in a mirrored DOM tree occupying the same path as a given node.
25 minMetaPractice - JavaScriptCoding exercise
CSS Selector Matches
MEDIUMImplement Element.matches: test whether an element satisfies a compound CSS selector (tag, id, class, attribute).
25 minPractice - JavaScriptCoding exercise
DOM Method Chaining
MEDIUMBuild a jQuery-style wrapper whose methods return this so calls like addClass().text() chain.
25 minPractice - JavaScriptCoding exercise
Finite State Machine
MEDIUMImplement a state machine from a config of states and transitions, with send, guards, and entry actions.
25 minPractice - JavaScriptCoding exercise
Form Serialize
MEDIUMSerialize a form's fields into a nested object, handling checkboxes, multi-selects, and bracket names.
25 minPractice - JavaScriptCoding exercise
getElementsByClassName
MEDIUMImplement a function that returns all DOM elements containing every one of the specified class names.
25 minAmazon · Discord · Dropbox +2Practice - JavaScriptCoding exercise
getElementsByStyle
MEDIUMImplement a function that returns all DOM elements whose computed style matches a given property and value.
25 minAmazon · ZeptoPractice - JavaScriptCoding exercise
getElementsByTagName
MEDIUMImplement a function that walks a DOM tree and returns every descendant element matching a given tag name.
25 minDropbox · Google · NetflixPractice - JavaScriptCoding exercise
Hash Router
MEDIUMBuild a client-side router over location.hash with route params and a change subscription.
25 minPractice - UI / FrameworksUI challenge4 variants
Heatmap Calendar
MEDIUMBuild a contribution-style heatmap calendar that colors each day cell by its activity value.
25 minPractice - JavaScriptCoding exercise
History Router
MEDIUMBuild a client-side router over the History API (pushState/popstate) with path params.
25 minPractice - JavaScriptCoding exercise
HTML Sanitizer
MEDIUMImplement a simplified HTML sanitizer that strips out unsafe tags and attributes from a given DOM tree.
25 minPractice - JavaScriptCoding exercise
Identical DOM Trees
MEDIUMImplement a function that recursively compares two DOM trees and returns whether they are structurally equal.
25 minIntuitPractice - JavaScriptCoding exercise
IntersectionObserver Polyfill
MEDIUMImplement a scroll/resize-driven fallback that reports when observed elements enter the viewport.
25 minPractice - JavaScriptCoding exercise
jQuery Class Manipulation
MEDIUMImplement chainable addClass, removeClass, toggleClass, and hasClass helpers on a DOM element wrapper.
25 minPractice - JavaScriptCoding exercise
JSON Path Query
MEDIUMResolve a dotted path with array indices and a wildcard against a nested object, returning matches.
25 minPractice - JavaScriptCoding exercise
JSX Runtime
MEDIUMImplement the jsx() factory (type, props, children) that a JSX transform compiles to.
25 minPractice - JavaScriptCoding exercise
Lazy Load Images
MEDIUMSwap each image's data-src into src as it nears the viewport, using an IntersectionObserver.
25 minPractice - JavaScriptCoding exercise
LRU Cache
MEDIUMImplement a fixed-capacity least-recently-used cache with O(1) get and put via a map plus a linked list.
25 minAmazon · Google · LinkedIn +3Practice - JavaScriptCoding exercise
Markdown Parser
MEDIUMParse a subset of Markdown (headings, bold, italics, links, code) into an HTML string.
25 minPractice - JavaScriptCoding exercise
Mini Template Engine
MEDIUMImplement a string template engine with {{ variable }} interpolation and nested-path lookup.
25 minPractice - JavaScriptCoding exercise
Mutation Observer Mini
MEDIUMBuild a mini MutationObserver that diffs a subtree on demand and reports added and removed nodes.
25 minPractice - JavaScriptCoding exercise
Node Registry
MEDIUMImplement a registry that associates values with DOM nodes without leaking memory once nodes are gone.
25 minMetaPractice - UI / FrameworksUI challenge4 variants
Notification Center
MEDIUMBuild a notification center with an unread badge, mark-as-read, and dismiss.
25 minPractice - JavaScriptCoding exercise
Observable Store
MEDIUMBuild a tiny state store with getState, setState, and subscribe that notifies listeners on change.
25 minPractice - UI / FrameworksUI challenge4 variants
OTP Input
MEDIUMBuild a one-time-code input of separate boxes with auto-advance, backspace, and paste handling.
25 minPractice - UI / FrameworksUI challenge4 variants
Pixel Art
MEDIUMBuild a pixel art editor where you pick a color from a palette and paint individual cells on a grid canvas.
25 minPractice - JavaScriptCoding exercise
Portal
MEDIUMImplement a React Portal that owns a body host or borrows a caller-provided container with safe cleanup.
25 minPractice - JavaScriptCoding exercise
PubSub with Wildcards
MEDIUMImplement an event bus whose subscriptions support wildcard segments matching any single topic level.
25 minPractice - JavaScriptCoding exercise
Query Selector All
MEDIUMImplement querySelectorAll for descendant-combinator selectors, returning matches in document order.
25 minPractice - JavaScriptCoding exercise
Resize Observer Mini
MEDIUMBuild a polling-based ResizeObserver that reports elements whose content-box size has changed.
25 minPractice - JavaScriptCoding exercise
Tagged Template HTML
MEDIUMImplement an html tagged-template function that interpolates values safely into a DOM fragment.
25 minPractice - JavaScriptCoding exercise
Two-Way Binding
MEDIUMWire an input and a model object so edits to either side stay in sync via events and a setter.
25 minPractice - JavaScriptCoding exercise
useBeforeUnload
MEDIUMImplement a hook that warns before leaving a page while unsaved work exists.
25 minPractice - JavaScriptCoding exercise
useBreakpoint
MEDIUMImplement a hook that returns the active responsive breakpoint name derived from the current window width.
25 minPractice - JavaScriptCoding exercise
useBroadcastChannel
MEDIUMImplement a hook that opens a named BroadcastChannel, delivers messages to the latest callback, posts data, and closes cleanly.
25 minPractice - JavaScriptCoding exercise
useClickOutside
MEDIUMImplement a hook that fires a callback when a pointer event lands outside a referenced element.
25 minPractice - JavaScriptCoding exercise
useDarkMode
MEDIUMImplement a hook that tracks the system dark-color-scheme preference through matchMedia and updates when it changes.
25 minPractice - JavaScriptCoding exercise
useDropArea
MEDIUMImplement a hook that turns any element into a drop zone for files, text, and links, tracking drag-over state.
25 minPractice - JavaScriptCoding exercise
useElementBounding
MEDIUMImplement a hook that tracks an element's size and position, staying correct across scroll, resize, and content changes.
25 minPractice - JavaScriptCoding exercise
useEventListener
MEDIUMImplement a hook that attaches and cleans up a browser event listener on a target element or window.
25 minPractice - JavaScriptCoding exercise
useFocusTrap
MEDIUMImplement a hook that traps keyboard focus inside a container while it is active and restores it on release.
25 minPractice - JavaScriptCoding exercise
useFocusWithin
MEDIUMImplement a hook that reports whether keyboard focus is anywhere inside a container, without flickering as focus moves between children.
25 minPractice - JavaScriptCoding exercise
useFullscreen
MEDIUMImplement a hook that enters, exits, and tracks fullscreen mode for a referenced element through the Fullscreen API.
25 minPractice - JavaScriptCoding exercise
useGeolocation
MEDIUMImplement a hook wrapping the Geolocation API to expose position, error, and loading state.
25 minPractice - JavaScriptCoding exercise
useHotkeys
MEDIUMImplement a hook that binds a shortcut like ctrl+k, matching modifiers exactly and ignoring typing in inputs.
25 minPractice - JavaScriptCoding exercise
useImageOnLoad
MEDIUMImplement a hook that tracks an image's loading, loaded, and error state, handling images already in cache.
25 minPractice - JavaScriptCoding exercise
useIntersectionObserver
MEDIUMImplement a hook that reports whether a ref'd element is intersecting the viewport via IntersectionObserver.
25 minPractice - JavaScriptCoding exercise
useLockBodyScroll
MEDIUMImplement a hook that freezes page scrolling while a modal or drawer is open, coordinating nested locks.
25 minPractice - JavaScriptCoding exercise
useLongPress
MEDIUMImplement a hook that fires a callback after a pointer is held down past a delay, cancelling on early release or move.
25 minPractice - JavaScriptCoding exercise
useMediaQuery
MEDIUMImplement a hook that returns whether a media query currently matches and updates on changes.
25 minPractice - JavaScriptCoding exercise
useNetworkState
MEDIUMImplement a hook that reports online/offline status and connection info from the Network Information API.
25 minPractice - JavaScriptCoding exercise
useNotification
MEDIUMImplement a hook that tracks notification permission and safely requests and displays browser notifications.
25 minPractice - JavaScriptCoding exercise
useOrientation
MEDIUMImplement a hook that reports the screen orientation type and angle and updates when the Screen Orientation API changes.
25 minPractice - JavaScriptCoding exercise
usePageVisibility
MEDIUMImplement a hook that reports whether the document is visible or hidden and updates on visibilitychange.
25 minPractice - JavaScriptCoding exercise
usePermission
MEDIUMImplement a hook that queries a browser permission, tracks changes, and handles unsupported or failed queries.
25 minPractice - JavaScriptCoding exercise
usePreferredLanguage
MEDIUMImplement a hook that reports the browser's primary preferred language and updates when the preference changes.
25 minPractice - JavaScriptCoding exercise
usePrefersReducedMotion
MEDIUMImplement a hook that tracks the system reduced-motion accessibility preference through matchMedia and updates when it changes.
25 minPractice - JavaScriptCoding exercise
useRovingTabIndex
MEDIUMImplement a hook that gives a widget arrow-key navigation, keeping exactly one item in the tab order at a time.
25 minPractice - JavaScriptCoding exercise
useScript
MEDIUMImplement a hook that injects an external script tag and reports its loading status, deduping repeated sources.
25 minPractice - JavaScriptCoding exercise
useScrollDirection
MEDIUMImplement a hook that reports whether the user is scrolling up or down, ignoring jitter below a threshold.
25 minPractice - JavaScriptCoding exercise
useScrollPosition
MEDIUMImplement a hook that tracks the window scroll x/y position with a passive listener, throttled with rAF.
25 minPractice - JavaScriptCoding exercise
useSwipe
MEDIUMImplement a hook that detects swipe gestures on an element, reporting direction once a drag passes a threshold.
25 minPractice - JavaScriptCoding exercise
useTextareaAutosize
MEDIUMImplement a React hook that grows and shrinks a textarea to fit its content as the user types.
25 minPractice - JavaScriptCoding exercise
useTextSelection
MEDIUMImplement a hook that reports the user's current text selection as live, plain state, updating as the selection changes.
25 minPractice - JavaScriptCoding exercise
useVibrate
MEDIUMImplement a hook that detects the Vibration API and exposes stable methods to start a pattern or cancel it.
25 minPractice - JavaScriptCoding exercise
useWakeLock
MEDIUMImplement a hook that requests, releases, and tracks a screen wake lock, including browser-initiated release.
25 minPractice - JavaScriptCoding exercise
useWebShare
MEDIUMImplement a hook that detects Web Share support, validates share data when possible, and invokes the native share sheet.
25 minPractice - JavaScriptCoding exercise
Virtual DOM Diff
MEDIUMImplement a diff that patches real DOM from an old vnode tree to a new one, minimizing changes.
25 minPractice - JavaScriptCoding exercise
Virtual DOM: createElement + render
MEDIUMImplement createElement to build a virtual DOM tree and render to turn it into real DOM nodes.
25 minPractice - JavaScriptCoding exercise
Async Event Emitter
HARDBuild an emitter whose emit awaits async listeners, with once, off, and serial or parallel dispatch.
40 minPremium questionPractice - JavaScriptCoding exercise
Drag & Drop Sortable
HARDReorder a list by pointer drag, computing the target index from the cursor over item midpoints.
40 minPremium questionPractice - UI / FrameworksUI challenge4 variants
Gantt Chart
HARDBuild a Gantt chart that renders tasks as bars positioned across a timeline by start and duration.
40 minPremium questionPractice - JavaScriptCoding exercise
getElementsByTagNameHierarchy
HARDImplement a function that finds all DOM elements matching an ancestor-to-descendant tag-name hierarchy.
40 minDropbox · GooglePractice - JavaScriptCoding exercise
HTML Tokenizer & Parser
HARDTokenize an HTML string and build a nested node tree, handling attributes, void, and nested tags.
40 minPremium questionPractice - JavaScriptCoding exercise
Idle Task Scheduler
HARDRun a queue of tasks in time-sliced batches, yielding between slices to keep the frame responsive.
40 minPremium questionPractice - UI / FrameworksUI challenge4 variants
Image Cropper
HARDBuild an image cropper with a draggable, resizable crop region over an image.
40 minPremium questionPractice - JavaScriptCoding exercise
Keyed DOM Reconcile
HARDReconcile two keyed child lists into a minimal set of DOM inserts, moves, and removals.
40 minPremium questionPractice - JavaScriptCoding exercise
Lowest Hiding Element
HARDImplement a function that finds the deepest common ancestor whose hiding would conceal every target element.
40 minPremium questionPractice - JavaScriptCoding exercise
Reactive Proxy Signals
HARDBuild reactive state with a Proxy that tracks reads and re-runs registered effects on write.
40 minPremium questionPractice - UI / FrameworksUI challenge4 variants
Rich Text Editor
HARDBuild a contenteditable rich-text editor with bold/italic/list formatting and a live toolbar state.
40 minPremium questionPractice - UI / FrameworksUI challenge4 variants
Selectable Cells
HARDBuild a grid where you click and drag across cells to select a rectangular range of them.
40 minPremium questionPractice - UI / FrameworksUI challenge4 variants
Spreadsheet Grid
HARDBuild a grid of cells with formula evaluation and dependent-cell recalculation.
40 minPremium questionPractice - JavaScriptCoding exercise
Table of Contents
HARDImplement a function that walks an HTML document's headings and builds a nested table of contents.
40 minGooglePractice - JavaScriptCoding exercise
Text Between Nodes
HARDImplement a function that gathers the text content lying between two DOM nodes in document order.
40 minPremium questionMetaPractice - JavaScriptCoding exercise
Tooltip Positioning Engine
HARDCompute a tooltip's position around an anchor, flipping and shifting to stay inside the viewport.
40 minPremium questionPractice - JavaScriptCoding exercise
useDraggable
HARDImplement a pointer-based drag hook that tracks an element's x/y offset with start/move/end handlers.
40 minPremium questionPractice - JavaScriptCoding exercise
useInfiniteScroll
HARDImplement a hook that loads more pages when a sentinel element scrolls into view, guarding against duplicate loads.
40 minPremium questionPractice - JavaScriptCoding exercise
useResizeObserver
HARDImplement a hook that reports a ref'd element's content-box size via ResizeObserver.
40 minPremium questionPractice - JavaScriptCoding exercise
useVirtualList
HARDImplement a windowing hook that renders only the visible rows of a long list, with correct spacer offsets.
40 minPremium questionPractice - JavaScriptCoding exercise
Virtual Scroll List
HARDCompute the visible slice and spacer offsets to render only on-screen rows of a huge list.
40 minPremium questionPractice - UI / FrameworksUI challenge4 variants
Virtualized List
HARDBuild a windowed list that renders only the visible rows of a large dataset for smooth scrolling.
40 minPremium questionMeta · TekionPractice