Small challenges. Real code. Pick a question and learn by building, at your own pace.
Start coding without an account. Sign in to save your work.
197 questions matching your filters
Choose a challenge. Make it work.
Write flatten(values): take an array that can contain other arrays and return a new array containing every non-array value, in its original left-to-right order.
Implement debounce(fn, wait). Delay invoking fn until wait milliseconds have passed since the most recent call.
Implement throttle(fn, wait). Invoke immediately when idle, then at most once per wait milliseconds, retaining the latest call for trailing execution.
Implement useQuery(url, onChange?) as a framework-independent function that fetches JSON and returns the current data, loading, and error states. This is a plain JavaScript/TypeScript function, not a React Hook or a TanStack Query clone. Open usage-examples.md in the editor for JavaScript, TypeScript, React, Vue, and Angular usage examples.
Implement arrayMap to recreate the core behavior of Array.prototype.map using a loop. Work with a standalone function that receives the array as its first argument.
Implement arrayFilter to recreate the core behavior of Array.prototype.filter using a loop. Work with a standalone function that receives the array as its first argument.
Implement arrayReduce to recreate the core behavior of Array.prototype.reduce using a loop. Work with a standalone function that receives the array as its first argument.
Implement flattenObject(object). Convert nested object properties into a new flat object whose keys are dot-separated paths. Preserve each leaf value without changing the input. For example, { user: { name: "Ada" } } becomes { "user.name": "Ada" }. Arrays are leaf values in this exercise; use Flatten Array for array flattening.
Implement debounce(fn, wait) with cancel() and flush() methods. Repeated calls postpone execution until wait milliseconds after the most recent call. Users must be able to discard a delayed invocation or run it immediately. This extends the Debounce challenge with explicit control over pending work.
Implement classNames(...values) , a utility that joins CSS class names conditionally. Accept class strings, non-zero numbers, conditional objects, and nested arrays, then return one class-name string in traversal order. Objects contribute their enabled keys, arrays recursively contribute their contents, and falsy values contribute nothing. The returned string must have no leading or trailing whitespace.
20 of 197 questions loaded