Easy frontend interview questions
152 questions at easy difficulty. Build the muscle for real frontend interviews with a runnable editor and explained solutions.
152 questions
- UI / FrameworksUI challenge4 variants
Accordion
EASYBuild an accordion component with stacked sections whose content panels expand and collapse on click.
20 minAdobe · Amazon · Google +4Practice - JavaScriptCoding exercise
Array findLast / findLastIndex
EASYImplement findLast and findLastIndex — scan an array from the end for the last element matching a predicate.
15 minPractice - JavaScriptCoding exercise
Array XOR (Symmetric Difference)
EASYImplement lodash xor — return the values that appear in exactly one of the given arrays, with duplicates removed.
20 minPractice - JavaScriptCoding exercise
Array.prototype.at
EASYImplement Array.prototype.myAt — return the element at a given index, supporting negative offsets from the end.
15 minPractice - JavaScriptCoding exercise
Array.prototype.every
EASYImplement Array.prototype.every — return false as soon as an element fails the predicate, true when empty.
15 minPractice - JavaScriptCoding exercise
Array.prototype.filter
EASYImplement Array.prototype.filter from scratch as a method on the array prototype.
15 minAmazon · Apple · Canva +1Practice - JavaScriptCoding exercise
Array.prototype.flat
EASYImplement Array.prototype.flat — flatten nested arrays to a given depth (default 1, Infinity for all levels), dropping holes.
15 minPractice - JavaScriptCoding exercise
Array.prototype.forEach
EASYImplement Array.prototype.forEach — run a callback on each element as (value, index, array), skipping sparse holes.
15 minPractice - JavaScriptCoding exercise
Array.prototype.includes
EASYImplement Array.prototype.includes — test membership with SameValueZero so NaN matches, honoring negative fromIndex.
15 minPractice - JavaScriptCoding exercise
Array.prototype.indexOf
EASYImplement Array.prototype.indexOf — first index of a value by strict equality, supporting a negative fromIndex.
15 minPractice - JavaScriptCoding exercise
Array.prototype.some
EASYImplement Array.prototype.some — return true as soon as any element passes the predicate, false when empty.
15 minPractice - JavaScriptCoding exercise
Array.prototype.square
EASYImplement a custom Array.prototype.square method that returns a new array with each value squared.
15 minByteDance · LinkedIn · UberPractice - JavaScriptCoding exercise
Async CountDown Latch
EASYImplement a countdown latch whose wait resolves once countDown has been called the required number of times.
15 minPractice - UI / FrameworksUI challenge4 variants
Avatar Group
EASYBuild a row of overlapping avatars that collapses the overflow into a plus-N badge.
15 minPractice - AlgorithmsCoding exercise
Balanced Brackets
EASYImplement a function that checks whether a string of brackets is properly opened and closed in order.
15 minPractice - UI / FrameworksUI challenge4 variants
Basic Autocomplete
EASYBuild an autocomplete input that filters a static list and lets you pick a suggestion.
15 minPractice - AlgorithmsCoding exercise
Binary Tree Equal
EASYImplement a function that returns whether two binary trees have identical structure and node values.
15 minPractice - AlgorithmsCoding exercise
Binary Tree Maximum Depth
EASYImplement a function that returns the maximum depth from root to leaf in a binary tree.
15 minPractice - AlgorithmsCoding exercise
Bit Reversal
EASYImplement a function that reverses the order of the bits in the binary representation of a number.
15 minPractice - UI / FrameworksUI challenge4 variants
Breadcrumbs
EASYBuild a breadcrumb trail from a path array, separating crumbs and marking the current page.
15 minPractice - AlgorithmsCoding exercise
Bubble Sort
EASYImplement bubble sort, repeatedly swapping adjacent out-of-order pairs until the array is sorted.
15 minPractice - JavaScriptCoding exercise
Cancellable Interval
EASYImplement a setInterval wrapper that returns a function which stops the interval when invoked.
15 minCoinbasePractice - JavaScriptCoding exercise
Cancellable Timeout
EASYImplement a setTimeout wrapper that returns a function you can call to cancel the pending callback.
15 minPractice - UI / FrameworksUI challenge4 variants
Character Counter Textarea
EASYBuild a textarea with a live character counter that warns as it nears a maximum length.
15 minPractice - JavaScriptCoding exercise
Chunk
EASYImplement a function that splits an array into groups of a given size, with the last group holding the remainder.
15 minPractice - JavaScriptCoding exercise
Clamp
EASYImplement a function that constrains a number to lie within an inclusive minimum and maximum range.
15 minPractice - UI / FrameworksUI challenge4 variants
Color Swatch Picker
EASYBuild a swatch color picker where clicking a swatch selects it and previews the chosen color.
15 minPractice - AlgorithmsCoding exercise
Combine Two Sorted Linked Lists
EASYImplement a function that merges two sorted linked lists into a single sorted linked list.
15 minPractice - JavaScriptCoding exercise
Compact
EASYImplement a function that returns a new array with every falsy value stripped out.
15 minPractice - JavaScriptCoding exercise
Compose
EASYImplement a function that composes functions right-to-left so the output of each feeds into the next.
15 minPractice - UI / FrameworksUI challenge4 variants
Contact Form
EASYBuild a contact form that posts the user's name, email, and message to a backend endpoint.
15 minAmazon · Lyft · OpenAI +3Practice - 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 - AlgorithmsCoding exercise
Count Set Bits in a Binary Number
EASYImplement a function that counts the number of 1 bits in the binary representation of an integer.
15 minPractice - UI / FrameworksUI challenge4 variants
Countdown Timer
EASYBuild a countdown timer that ticks down from a start time and can start, pause, and reset.
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
Cursor Pagination Fetcher
EASYFetch successive pages with an opaque cursor, accumulating items and tracking whether more remain.
15 minPractice - JavaScriptCoding exercise
Cycle
EASYImplement a function that, given several values, returns a function that yields each one in turn and loops forever.
15 minUberPractice - JavaScriptCoding exercise
Data Merging
EASYImplement a function that consolidates rows sharing the same user into a single grouped record.
15 minCoinbase · Meta · OpenAI +3Practice - JavaScriptCoding exercise
Debounce
EASYImplement a function that delays invoking another function until a specified period of inactivity has passed.
15 minAdobe · Airbnb · Amazon +26Practice - 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
Difference
EASYImplement a function that returns the elements from the first array that do not appear in the second.
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
Drop Right While
EASYImplement a function that drops trailing array elements as long as a predicate keeps returning truthy.
15 minPractice - JavaScriptCoding exercise
Drop While
EASYImplement a function that drops leading array elements as long as a predicate keeps returning truthy.
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
Fill
EASYImplement a function that replaces array elements with a given value between an optional start and end index.
15 minPractice - AlgorithmsCoding exercise
Find Duplicates in Array
EASYImplement a function that checks whether an array contains any duplicate numbers.
15 minPractice - JavaScriptCoding exercise
Find Index
EASYImplement a function that returns the index of the first array element matching a predicate, or -1 if none match.
15 minPractice - JavaScriptCoding exercise
Find Last Index
EASYImplement a function that returns the index of the last array element matching a predicate, or -1 if none match.
15 minPractice - AlgorithmsCoding exercise
Find Missing Number in Sequence
EASYImplement a function that returns the single missing number from a sorted sequence of integers.
15 minPractice - AlgorithmsCoding exercise
First Bad Version
EASYFind the first failing version among 1..n where a monotonic isBad check flips from false to true — a boundary binary search using the fewest checks.
15 minPractice - UI / FrameworksUI challenge4 variants
Flight Booker
EASYBuild a small form that books either a one-way or return flight, with validation tying the two date fields together.
15 minOpenAI · RedditPractice - AlgorithmsCoding exercise
Flip Binary Tree
EASYImplement a function that mirrors a binary tree by swapping the left and right children of every node.
15 minPractice - JavaScriptCoding exercise
From Pairs
EASYImplement a function that builds an object from an array of [key, value] pair tuples.
15 minPractice - JavaScriptCoding exercise
Function Length
EASYImplement a function that returns the number of declared parameters of a given function.
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 - UI / FrameworksUI challenge4 variants
Generate Table
EASYBuild a component that renders a table of sequential numbers given a row count and a column count.
15 minGooglePractice - 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 - UI / FrameworksUI challenge4 variants
Holy Grail
EASYBuild the classic holy grail page layout with a header, footer, and three columns of content.
15 minAtlassian · DropboxPractice - JavaScriptCoding exercise
In Range
EASYImplement a function that checks whether a number lies within a half-open range, swapping bounds when needed.
15 minPractice - AlgorithmsCoding exercise
Insertion Sort
EASYImplement insertion sort by building the sorted portion one element at a time from the input.
15 minPractice - JavaScriptCoding exercise
Intersection
EASYImplement a function that returns the unique values present in every input array.
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
Key By
EASYImplement lodash keyBy — index a collection into an object keyed by an iteratee's return, keeping the last item for each key.
15 minPractice - UI / FrameworksUI challenge4 variants
Like Button
EASYBuild a Like button that toggles between liked and unliked states with matching visual feedback.
15 minAmazon · Coinbase · OpenAIPractice - AlgorithmsCoding exercise
Linked List Reversal
EASYImplement a function that reverses a singly linked list in place and returns the new head.
15 minPractice - JavaScriptCoding exercise
List Format
EASYImplement a function that joins an array of strings into a grammatical list with commas and a conjunction.
15 minDropboxPractice - JavaScriptCoding exercise
Make Counter
EASYImplement a factory that takes a starting integer and returns a function that returns the next value on each call.
15 minAmazon · Robinhood · RobloxPractice - JavaScriptCoding exercise
Map.groupBy
EASYImplement Map.groupBy — group an iterable into a Map whose keys can be any value, preserving key insertion order.
15 minPractice - JavaScriptCoding exercise
Max By
EASYImplement a function that returns the array element producing the largest value when run through an iteratee.
15 minPractice - JavaScriptCoding exercise
Mean
EASYImplement a function that computes the arithmetic mean of the numbers in an array.
15 minPractice - AlgorithmsCoding exercise
Meeting Calendar
EASYImplement a function that determines whether a person can attend every meeting given their time intervals.
15 minPractice - JavaScriptCoding exercise
Min By
EASYImplement a function that returns the array element producing the smallest value when run through an iteratee.
15 minPractice - UI / FrameworksUI challenge4 variants
Modal Dialog
EASYBuild a reusable modal dialog component that you can open from a trigger and close with a button.
15 minAmazon · PayPal · Shopify +1Practice - UI / FrameworksUI challenge4 variants
Mortgage Calculator
EASYBuild a calculator that computes the monthly payment for a loan based on principal, rate, and term inputs.
15 minOpenAI · RedditPractice - AlgorithmsCoding exercise
Move Zeroes
EASYMove all zeroes to the end of an array in place while keeping the non-zero elements in their original order.
20 minGoogle · MetaPractice - 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 - JavaScriptCoding exercise
nth
EASYImplement nth — return the element at index n, counting from the end when n is negative, so head is nth(0) and last is nth(-1).
15 minPractice - JavaScriptCoding exercise
Number of Arguments
EASYImplement a function that returns the count of arguments passed to it at call time.
15 minPractice - JavaScriptCoding exercise
Object Map
EASYImplement a function that returns a new object with every value transformed by a mapper callback.
15 minPractice - JavaScriptCoding exercise
Object.entries
EASYImplement Object.entries — return an object's own enumerable string-keyed [key, value] pairs in insertion order.
15 minPractice - JavaScriptCoding exercise
Object.fromEntries
EASYImplement Object.fromEntries — build an object from any iterable of [key, value] pairs, with later keys winning.
15 minPractice - JavaScriptCoding exercise
Object.is
EASYImplement Object.is — same-value equality that treats NaN as equal to itself and keeps +0 distinct from -0.
15 minPractice - JavaScriptCoding exercise
Once
EASYImplement a function that wraps a callback so it runs at most one time and reuses that result thereafter.
15 minAmazonPractice - AlgorithmsCoding exercise
Optimal Stock Trading
EASYImplement a function that computes the maximum profit obtainable from one buy and one sell of a stock.
15 minPractice - UI / FrameworksUI challenge4 variants
Pagination UI
EASYBuild pagination controls with previous/next and numbered pages that report the current page.
15 minPractice - AlgorithmsCoding exercise
Pair Sum
EASYImplement a function that finds two numbers in an array that add up to a given target.
15 minPractice - UI / FrameworksUI challenge4 variants
Password Strength Meter
EASYBuild a password field with a live strength meter that scores the input as you type.
15 minPractice - UI / FrameworksUI challenge4 variants
Progress Bar
EASYBuild a progress bar component that visualizes the percentage completion of an operation.
15 minAmazon · Dropbox · Google +3Practice - UI / FrameworksUI challenge4 variants
Progress Bars
EASYBuild a component that renders a list of progress bars which animate from empty to full as they mount.
15 minUberPractice - JavaScriptCoding exercise
Promise Waterfall
EASYRun async tasks in sequence, feeding each result into the next, stopping the chain on the first rejection.
15 minPractice - JavaScriptCoding exercise
Promise.race
EASYImplement Promise.race so it settles with the outcome of whichever input promise settles first.
15 minGoogle · RobloxPractice - JavaScriptCoding exercise
Promise.reject
EASYImplement a function that returns a Promise already rejected with the given reason.
15 minByteDance · Google · Meta +1Practice - AlgorithmsCoding exercise
Queue
EASYBuild a queue data structure supporting enqueue, dequeue, peek, and size in FIFO order.
15 minPractice - JavaScriptCoding exercise
Range
EASYImplement a function that builds an array of numbers from start up to end, stepping by a given increment.
15 minPractice - JavaScriptCoding exercise
Range Right
EASYImplement a function that builds an array of numbers from end down to start in descending order.
15 minPractice - AlgorithmsCoding exercise
Roman to Integer
EASYConvert a Roman numeral string to its integer value, handling subtractive pairs like IV and IX.
15 minAdobe · Amazon · MicrosoftPractice - UI / FrameworksUI challenge4 variants
Segmented Control
EASYBuild a segmented control where clicking a segment selects it and highlights the active option.
15 minPractice - AlgorithmsCoding exercise
Selection Sort
EASYImplement selection sort to order an array by repeatedly picking the smallest remaining element.
15 minPractice - JavaScriptCoding exercise
Size
EASYImplement a function that returns the element count of any collection — array, string, object, Map, or Set.
15 minPractice - JavaScriptCoding exercise
Sleep
EASYImplement a function that returns a promise resolving after the specified number of milliseconds.
15 minAmazon · LinkedIn · NetflixPractice - JavaScriptCoding exercise
Sliding TTL Cache
EASYImplement a cache whose entries expire a fixed time after their last access, not after being set.
15 minPractice - AlgorithmsCoding exercise
Stack
EASYBuild a stack data structure that supports the standard push, pop, peek, and size operations.
15 minAmazonPractice - AlgorithmsCoding exercise
Staircase Climbing Combinations
EASYImplement a function that counts the distinct ways to climb to the top of a staircase taking one or two steps.
15 minPractice - AlgorithmsCoding exercise
String Anagram
EASYImplement a function that determines whether two strings are anagrams of each other.
15 minPractice - AlgorithmsCoding exercise
String Palindrome
EASYImplement a function that returns whether a string reads the same forwards and backwards.
15 minPractice - JavaScriptCoding exercise
String.prototype.padStart
EASYImplement String.prototype.padStart — pad a string to a target length on the left, truncating a multi-char pad.
15 minPractice - JavaScriptCoding exercise
String.prototype.repeat
EASYImplement String.prototype.repeat — join a string n times, throwing RangeError on a negative or infinite count.
15 minPractice - JavaScriptCoding exercise
String.prototype.trim
EASYImplement String.prototype.trim — strip leading and trailing whitespace, including Unicode whitespace, from a string.
15 minPractice - JavaScriptCoding exercise
Sum By / Mean By
EASYImplement lodash sumBy and meanBy — total and average an array by an iteratee that maps each element to a number.
15 minPractice - JavaScriptCoding exercise
takeWhile
EASYImplement take and takeWhile — grab the leading n elements, or the leading run that satisfies a predicate.
15 minPractice - UI / FrameworksUI challenge4 variants
Temperature Converter
EASYBuild a widget that converts between Celsius and Fahrenheit, updating either field as the other changes.
15 minPractice - JavaScriptCoding exercise
Text Search
EASYImplement a function that wraps occurrences of a search term within a string in highlight markup.
15 minAnthropic · Google · Meta +1Practice - JavaScriptCoding exercise
times
EASYImplement times — invoke a function n times and collect the results into an array.
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
Toggle Switch
EASYBuild an on/off toggle switch that flips state on click and slides its knob to reflect it.
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 - UI / FrameworksUI challenge4 variants
Traffic Light
EASYBuild a traffic light that cycles green to yellow to red on a timer and loops indefinitely.
15 minRoblox · Snowflake · Spotify +1Practice - JavaScriptCoding exercise
Traverse DOM (BFS)
EASYImplement a breadth-first traversal of a DOM tree, returning elements level by level.
15 minPractice - UI / FrameworksUI challenge4 variants
Tweet
EASYBuild a static tweet component that mirrors the layout of a single post on Twitter.
15 minPractice - JavaScriptCoding exercise
Type Utilities
EASYImplement a set of helper functions that report the primitive type of any JavaScript value.
15 minPractice - JavaScriptCoding exercise
Typewriter Pacer
EASYBuffer bursty streamed text and emit it one character at a time at a steady cadence, with flush and stop controls.
18 minPractice - JavaScriptCoding exercise
Unique Array
EASYImplement a function that returns a new array with duplicate values removed while preserving original order.
15 minPractice - JavaScriptCoding exercise
useBoolean
EASYImplement a hook that exposes a boolean value alongside setTrue, setFalse, and toggle helpers.
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
useCounter
EASYImplement a hook that exposes a numeric count along with increment, decrement, and reset helpers.
15 minPractice - JavaScriptCoding exercise
useCounter II
EASYRewrite useCounter so the returned helpers keep stable identities across renders.
15 minPractice - JavaScriptCoding exercise
useCycle
EASYImplement a hook that returns the current value of a sequence and advances to the next on demand.
15 minPractice - JavaScriptCoding exercise
useCycleList
EASYImplement a hook that steps through an array with wraparound, exposing the current item and next/prev/set.
15 minPractice - JavaScriptCoding exercise
useDefault
EASYImplement a hook that falls back to a default value whenever the underlying state becomes null or undefined.
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
useEffectOnce
EASYImplement a hook that runs the given effect a single time after mount, regardless of subsequent renders.
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
useIsFirstRender
EASYImplement a hook that returns true only on the first render and false on every render after.
15 minPractice - JavaScriptCoding exercise
useIsMounted
EASYImplement a hook returning a function that reports whether the component is still mounted, to guard async setState.
15 minPractice - JavaScriptCoding exercise
useLatest
EASYImplement a hook that returns a ref always holding the newest value, so callbacks and effects can read it without going stale.
15 minPractice - JavaScriptCoding exercise
useLocalStorage
EASYImplement a useState-like hook that persists to localStorage, with SSR-safe init and cross-tab sync.
15 minPractice - JavaScriptCoding exercise
useObject
EASYImplement a hook that holds an object in state and exposes helpers to merge updates or reset its value.
15 minPractice - JavaScriptCoding exercise
usePrevious
EASYImplement a hook that remembers and returns the value a state held on the previous render.
15 minPractice - JavaScriptCoding exercise
useRenderCount
EASYImplement a hook that counts how many times a component has rendered, without causing extra renders.
15 minPractice - JavaScriptCoding exercise
useSessionStorage
EASYImplement a useState-like hook backed by sessionStorage, with a graceful fallback when it is unavailable.
15 minPractice - JavaScriptCoding exercise
useSet
EASYImplement a hook that stores a Set in state and exposes add, delete, has, and clear helpers.
15 minPractice - JavaScriptCoding exercise
useStateWithReset
EASYImplement a useState-like hook that also returns a reset function which restores the initial value.
15 minPractice - JavaScriptCoding exercise
useToggle
EASYImplement a hook that holds a boolean and returns a stable toggle function to flip its value.
15 minPractice - JavaScriptCoding exercise
useUpdateEffect
EASYImplement a useEffect variant that skips the first render and fires only on subsequent updates.
15 minPractice - JavaScriptCoding exercise
useWindowSize
EASYImplement a hook that returns the current window width and height, updating on resize.
15 minPractice - JavaScriptCoding exercise
without
EASYImplement without — return a copy of an array with the given values excluded, matched by SameValueZero.
15 minPractice