Here’s a comprehensive list of 100 technical tasks / coding puzzles commonly used in JavaScript developer interviews, ranging from basic to advanced.
They cover core JS, DOM, ES6+, async programming, algorithms, data structures, React, Node.js, and system design — ideal for preparing or creating an interview test bank.
Contents
hide
🟢 Section 1: JavaScript Basics (Syntax, Logic, and Types)
- Reverse a string without using built-in
.reverse(). - Check if a string is a palindrome.
- Count vowels in a string.
- Find the longest word in a sentence.
- Remove duplicates from an array.
- Flatten a nested array
[1, [2, [3]]] → [1,2,3]. - Find the second largest number in an array.
- Sort numbers in ascending and descending order.
- Implement your own version of
Array.prototype.map(). - Implement
Array.prototype.filter()manually. - Implement
Array.prototype.reduce()manually. - Write a function to find the factorial of a number.
- Check if two strings are anagrams.
- Find the intersection of two arrays.
- Find the difference between two arrays.
- Find the most frequent element in an array.
- Write a function that returns unique characters of a string.
- Sum all numbers in an array (iteratively and with reduce).
- Check if an object is empty.
- Deep clone an object without using structuredClone or lodash.
🟡 Section 2: Functions, Closures, and Scopes
- Explain and demonstrate closure with an example.
- Write a counter function using closure (
makeCounter()). - Write a function
once(fn)that runs only once. - Implement a memoization wrapper for a slow function.
- Demonstrate variable hoisting behavior.
- Explain the difference between
var,let, andconst. - Write an example showing lexical scope.
- Create a debounce function.
- Create a throttle function.
- Write a function that delays execution by N milliseconds (
sleep).
🟠 Section 3: ES6+ Features
- Use destructuring to extract nested properties.
- Use spread/rest operator in objects and arrays.
- Convert a callback-based function to return a Promise.
- Demonstrate usage of
SetandMap. - Implement a custom iterable object.
- Use
Proxyto log all property reads and writes. - Explain
Symboland give a use case. - Use template literals for dynamic string generation.
- Explain difference between
for...inandfor...of. - Implement a tagged template literal function.
🔵 Section 4: Asynchronous JavaScript
- Write a function that fetches data from an API using
fetch. - Create a retry mechanism for failed API calls.
- Execute multiple promises in parallel and return results (
Promise.all). - Implement your own version of
Promise.all(). - Implement your own version of
Promise.race(). - Explain event loop and microtask queue order with an example.
- Chain multiple promises together.
- Convert an async function to callback-based one.
- Create a simple queue with async/await.
- Write a timeout wrapper for a Promise (cancel after X ms).
🟣 Section 5: DOM and Browser
- Create a function that toggles a CSS class on click.
- Implement drag and drop of elements.
- Create a simple to-do app using vanilla JS and localStorage.
- Write code to count clicks and display them on screen.
- Implement a live character counter for a textarea.
- Detect scroll position and show “Back to top” button.
- Lazy-load images as they enter viewport.
- Implement a light/dark mode toggle with localStorage.
- Create a simple modal component.
- Build a dropdown menu without libraries.
🟤 Section 6: Algorithms and Data Structures (JS Implementation)
- Implement a binary search algorithm.
- Implement bubble sort.
- Implement quicksort.
- Implement merge sort.
- Find all pairs in an array that sum to a target.
- Detect if a string has balanced parentheses.
- Implement a stack using an array.
- Implement a queue using two stacks.
- Implement a linked list with basic operations.
- Implement a simple hash map.
- Implement depth-first search (DFS).
- Implement breadth-first search (BFS).
- Find the maximum depth of a binary tree.
- Detect a cycle in a linked list.
- Check if a number is prime.
- Generate Fibonacci sequence up to N.
- Find GCD (greatest common divisor) of two numbers.
- Find LCM of two numbers.
- Implement binary search tree insert and search.
- Find all subsets (power set) of an array.
⚫ Section 7: React (Frontend JS Framework)
- Create a React component that fetches and displays data.
- Write a custom hook to handle form input.
- Explain controlled vs uncontrolled components.
- Implement a context provider for theme toggling.
- Memoize expensive computation using
useMemo. - Prevent unnecessary renders with
React.memo. - Explain reconciliation and virtual DOM diffing.
- Create a small counter app using useState and useEffect.
- Implement infinite scroll in React.
- Create a reusable modal using portals.
⚪ Section 8: Node.js / Backend
- Create a simple HTTP server with Node.js
httpmodule. - Read and write a JSON file using
fs. - Implement a simple REST API (CRUD for users).
- Connect Node.js app to a MongoDB or PostgreSQL database.
- Create a middleware function in Express.
- Handle errors globally in Express.
- Use async/await properly inside an Express route.
- Implement JWT authentication.
- Write a Node script that parses CSV and outputs JSON.
- Build a simple CLI tool with
process.argv.