Algorithms and Data StructuresHTML JavaScript CSSJavaScriptJavaScript Interview

JavaScript Technical Interview – List of 100 technical tasks / coding puzzles for JavaScript developer interviews from basic to advanced

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.


🟢 Section 1: JavaScript Basics (Syntax, Logic, and Types)

  1. Reverse a string without using built-in .reverse().
  2. Check if a string is a palindrome.
  3. Count vowels in a string.
  4. Find the longest word in a sentence.
  5. Remove duplicates from an array.
  6. Flatten a nested array [1, [2, [3]]] → [1,2,3].
  7. Find the second largest number in an array.
  8. Sort numbers in ascending and descending order.
  9. Implement your own version of Array.prototype.map().
  10. Implement Array.prototype.filter() manually.
  11. Implement Array.prototype.reduce() manually.
  12. Write a function to find the factorial of a number.
  13. Check if two strings are anagrams.
  14. Find the intersection of two arrays.
  15. Find the difference between two arrays.
  16. Find the most frequent element in an array.
  17. Write a function that returns unique characters of a string.
  18. Sum all numbers in an array (iteratively and with reduce).
  19. Check if an object is empty.
  20. Deep clone an object without using structuredClone or lodash.

🟡 Section 2: Functions, Closures, and Scopes

  1. Explain and demonstrate closure with an example.
  2. Write a counter function using closure (makeCounter()).
  3. Write a function once(fn) that runs only once.
  4. Implement a memoization wrapper for a slow function.
  5. Demonstrate variable hoisting behavior.
  6. Explain the difference between var, let, and const.
  7. Write an example showing lexical scope.
  8. Create a debounce function.
  9. Create a throttle function.
  10. Write a function that delays execution by N milliseconds (sleep).

🟠 Section 3: ES6+ Features

  1. Use destructuring to extract nested properties.
  2. Use spread/rest operator in objects and arrays.
  3. Convert a callback-based function to return a Promise.
  4. Demonstrate usage of Set and Map.
  5. Implement a custom iterable object.
  6. Use Proxy to log all property reads and writes.
  7. Explain Symbol and give a use case.
  8. Use template literals for dynamic string generation.
  9. Explain difference between for...in and for...of.
  10. Implement a tagged template literal function.

🔵 Section 4: Asynchronous JavaScript

  1. Write a function that fetches data from an API using fetch.
  2. Create a retry mechanism for failed API calls.
  3. Execute multiple promises in parallel and return results (Promise.all).
  4. Implement your own version of Promise.all().
  5. Implement your own version of Promise.race().
  6. Explain event loop and microtask queue order with an example.
  7. Chain multiple promises together.
  8. Convert an async function to callback-based one.
  9. Create a simple queue with async/await.
  10. Write a timeout wrapper for a Promise (cancel after X ms).

🟣 Section 5: DOM and Browser

  1. Create a function that toggles a CSS class on click.
  2. Implement drag and drop of elements.
  3. Create a simple to-do app using vanilla JS and localStorage.
  4. Write code to count clicks and display them on screen.
  5. Implement a live character counter for a textarea.
  6. Detect scroll position and show “Back to top” button.
  7. Lazy-load images as they enter viewport.
  8. Implement a light/dark mode toggle with localStorage.
  9. Create a simple modal component.
  10. Build a dropdown menu without libraries.

🟤 Section 6: Algorithms and Data Structures (JS Implementation)

  1. Implement a binary search algorithm.
  2. Implement bubble sort.
  3. Implement quicksort.
  4. Implement merge sort.
  5. Find all pairs in an array that sum to a target.
  6. Detect if a string has balanced parentheses.
  7. Implement a stack using an array.
  8. Implement a queue using two stacks.
  9. Implement a linked list with basic operations.
  10. Implement a simple hash map.
  11. Implement depth-first search (DFS).
  12. Implement breadth-first search (BFS).
  13. Find the maximum depth of a binary tree.
  14. Detect a cycle in a linked list.
  15. Check if a number is prime.
  16. Generate Fibonacci sequence up to N.
  17. Find GCD (greatest common divisor) of two numbers.
  18. Find LCM of two numbers.
  19. Implement binary search tree insert and search.
  20. Find all subsets (power set) of an array.

Section 7: React (Frontend JS Framework)

  1. Create a React component that fetches and displays data.
  2. Write a custom hook to handle form input.
  3. Explain controlled vs uncontrolled components.
  4. Implement a context provider for theme toggling.
  5. Memoize expensive computation using useMemo.
  6. Prevent unnecessary renders with React.memo.
  7. Explain reconciliation and virtual DOM diffing.
  8. Create a small counter app using useState and useEffect.
  9. Implement infinite scroll in React.
  10. Create a reusable modal using portals.

Section 8: Node.js / Backend

  1. Create a simple HTTP server with Node.js http module.
  2. Read and write a JSON file using fs.
  3. Implement a simple REST API (CRUD for users).
  4. Connect Node.js app to a MongoDB or PostgreSQL database.
  5. Create a middleware function in Express.
  6. Handle errors globally in Express.
  7. Use async/await properly inside an Express route.
  8. Implement JWT authentication.
  9. Write a Node script that parses CSV and outputs JSON.
  10. Build a simple CLI tool with process.argv.