Top 20 JavaScript Interview Questions
Master these essential concepts, practice in the built-in playground, and track your progress.
Progress0 / 20 solved
Premium · Lifetime access
Crack interviews with 200+ solved questions
JavaScript, React, Web Fundamentals, Machine Coding & System Design — with detailed solutions and a LeetCode-style playground. One-time ₹999.
Get Premium — ₹999Part 1
Foundations
Core JavaScript concepts every developer must know cold.
- 1How do closures work in JavaScript?EasyBe prepared to answer closure-based output questions and provide a real-life use case (like data privacy or function factories).→
- 2What is prototypal inheritance?EasyExplain this with a concrete example. Also, be ready to answer: What sits at the very top of the prototype chain?→
- 3What are map, filter, and reduce?EasyKnowing how to use them is basic; writing a polyfill for reduce proves you actually understand them.→
- 4What are call, bind, and apply?EasySimilar to the above, be prepared to write a polyfill for bind.→
- 5What are callbacks, promises, and async/await?EasyUnderstand the evolution of asynchronous JavaScript — from callback hell to promise chains, and finally to clean async/await syntax.→
- 6What is debouncing?EasyYou will likely be asked to write a polyfill for debounce. Understand the difference between debounce and throttle.→
- 7Flatten a nested arrayEasyA classic whiteboard problem. Example Input: [1, [2, 3, [4, 5], 6]] — Expected Output: [1, 2, 3, 4, 5, 6]→
Part 2
Stepping It Up
Intermediate patterns testing browser mechanics, async flow, and data structures.
- 8Implement a throttle functionMediumConstraint: Cover all edge cases. The naive approach found on basic tutorials often fails interview stress tests.→
- 9Implement a polyfill for PromiseMediumThis is a heavy hitter that deeply tests your understanding of asynchronous state management.→
- 10Write a curried version of a functionMediumImplement a generic curry utility that supports partial application.→
- 11How does JavaScript work under the hood?MediumExplain the Event Loop. You must clearly differentiate between the Macrotask queue and the Microtask queue.→
- 12How can you implement a retry mechanism for fetching data?MediumImplement a robust retry utility with configurable attempts and exponential backoff.→
- 13Implement a delayMediumWrite a function that waits for a given number of milliseconds using a Promise.→
- 14Deep clone an objectMediumConstraint: Your solution must accurately handle objects, arrays, null, and undefined.→
- 15Convert a nested object into a flat key-value pair dictionaryMediumFlatten using dot notation. Example: { a: { b: { c: 1 } } } → { 'a.b.c': 1 }→
- 16Explain inheritance in JavaScriptMediumHow do you implement it using ES5 syntax?→
- 17Implement an infinitely curried addition functionMediumExample: console.log(add(1)(2)(3)(4)) — Implement this both with and without extra empty parentheses at the end.→
Part 3
The Deep End
Heavy-hitter problems from Rippling, Uber, and Amazon interviews. Hints only — practice here.
- 18Design an LRU Cache for AutocompleteHardDesign a caching system for an autocomplete feature using a Least Recently Used (LRU) eviction policy. Minimize repetitive API calls by storing recent search queries. When full, remove the least recently accessed item before adding a new one.→
- 19DAG Task Scheduler with Concurrency LimitHardExecute async tasks in parallel while respecting two rules: (1) A task may only start once ALL prerequisite tasks have completed. (2) No more than N tasks can run simultaneously.→
- 20Implement Asynchronous Map with Concurrency Limit (mapLimit)HardWrite mapLimit(inputs, limit, iterateeFn, callback). Requirements: (1) Never exceed `limit` concurrent operations. (2) Output order must match input order. (3) As soon as one task finishes, the next must start immediately.→
Ready to Ace Your Interview?
Get personalised coaching from experienced engineers and fast-track your interview preparation.
Book a Session