Interview Prep
JavaScript
250 questions across 21 categories
50 of 50 questions
| # | Category | Question | Answer | ★ |
|---|---|---|---|---|
| 1 | Event Loop | Explain the JavaScript event loop, call stack, task queue, and microtask queue. What is the order of execution? | Click row to expand | |
| 2 | Event Loop | What is the difference between setTimeout(fn, 0), setImmediate, queueMicrotask, and process.nextTick in Node.js? | Click row to expand | |
| 3 | Event Loop | What are Web Workers? How do they communicate with the main thread, and what are their limitations? | Click row to expand | |
| 4 | Closures & Scope | What is a closure? Explain the classic loop closure bug and its solutions. | Click row to expand | |
| 5 | Closures & Scope | Explain the temporal dead zone (TDZ) for let and const. How does hoisting differ for var, let, const, and function declarations? | Click row to expand | |
| 6 | Closures & Scope | What is the module pattern? Compare CommonJS, AMD, UMD, and ES Modules. What are the key differences? | Click row to expand | |
| 7 | Closures & Scope | Explain prototype chain and prototypal inheritance. How does Object.create differ from the class syntax? | Click row to expand | |
| 8 | Async Patterns | How does async/await work internally? What is it desugared to? What are the error-handling pitfalls? | Click row to expand | |
| 9 | Async Patterns | What are the differences between Promise.all, Promise.allSettled, Promise.race, and Promise.any? | Click row to expand | |
| 10 | Async Patterns | Explain generators and iterators in JavaScript. How are they used to implement async flow control and lazy sequences? | Click row to expand | |
| 11 | ES6+ Features | Explain Proxy and Reflect in JavaScript. What are practical use cases? | Click row to expand | |
| 12 | ES6+ Features | What are WeakMap and WeakSet? How do they differ from Map and Set, and what problems do they solve? | Click row to expand | |
| 13 | ES6+ Features | What is the difference between == and ===? Explain abstract equality coercion rules for key type pairs. | Click row to expand | |
| 14 | Performance & Memory | What causes memory leaks in browser JavaScript? How do you detect and fix them? | Click row to expand | |
| 15 | Performance & Memory | Explain JavaScript engine optimizations: hidden classes, inline caching, and deoptimization. How should you write optimizable code? | Click row to expand | |
| 16 | Performance & Memory | What is throttling vs debouncing? When should you use each? Implement both from scratch. | Click row to expand | |
| 17 | ES6+ Features | What is the difference between shallow and deep cloning in JavaScript? What are the tradeoffs of structuredClone, JSON.parse/stringify, and spread operator? | Click row to expand | |
| 18 | Patterns | Explain the Observer pattern and how it relates to EventEmitter, RxJS Observables, and the DOM event system. | Click row to expand | |
| 19 | Patterns | What is memoization? How do you implement it for single and multiple arguments? What are the tradeoffs? | Click row to expand | |
| 20 | Performance & Memory | What is CORS? Explain preflight requests, the same-origin policy, and how to configure CORS correctly on the server. | Click row to expand | |
| 21 | Security | What is XSS (Cross-Site Scripting)? What are the types and how do you prevent them in JavaScript applications? | Click row to expand | |
| 22 | Security | What is the difference between sessionStorage, localStorage, and cookies? When would you use each for auth? | Click row to expand | |
| 23 | Patterns | What is functional programming in JavaScript? Explain pure functions, immutability, currying, and function composition. | Click row to expand | |
| 24 | ES6+ Features | Explain Symbol in JavaScript. What are the well-known symbols and how are they used? | Click row to expand | |
| 25 | Patterns | What is the difference between imperative and declarative programming? Provide JavaScript examples of common transformation from imperative to declarative. | Click row to expand | |
| 26 | Event Loop | How does requestAnimationFrame work? When should you use it instead of setTimeout for animations? | Click row to expand | |
| 27 | ES6+ Features | What are tagged template literals? How are they used for safe SQL queries, styled-components, and internationalization? | Click row to expand | |
| 28 | Async Patterns | What is the AbortController API? How does it enable cancellation for fetch requests and async operations? | Click row to expand | |
| 29 | Patterns | Explain the difference between call, apply, and bind. How does 'this' binding work in different contexts? | Click row to expand | |
| 30 | Security | What is CSRF (Cross-Site Request Forgery)? How do SameSite cookies and CSRF tokens prevent it? | Click row to expand | |
| 31 | ES6+ Features | What are Iterators and the Iterable protocol? How can you create a custom iterable data structure? | Click row to expand | |
| 32 | Patterns | What is the difference between deep equality checking and reference equality in JavaScript? How do you implement structural equality? | Click row to expand | |
| 33 | ES6+ Features | Explain async generators and async iterators. What problem do they solve for streaming data? | Click row to expand | |
| 34 | Performance & Memory | What is tree shaking? How does it work, and what code patterns prevent it? | Click row to expand | |
| 35 | Patterns | What is the difference between composition and inheritance in JavaScript? Why does the composition over inheritance principle matter? | Click row to expand | |
| 36 | ES6+ Features | What is optional chaining (?.) and nullish coalescing (??)? How do they differ from || for falsy checks? | Click row to expand | |
| 37 | Performance & Memory | What is the difference between synchronous and asynchronous module loading? How does dynamic import() work? | Click row to expand | |
| 38 | Patterns | Explain the Repository pattern and how to implement it in JavaScript with dependency injection. | Click row to expand | |
| 39 | ES6+ Features | What is destructuring? Explain default values, renaming, nested destructuring, and rest patterns. | Click row to expand | |
| 40 | Patterns | What are the core principles of clean API design in JavaScript? How do you design backward-compatible APIs? | Click row to expand | |
| 41 | ES6+ Features | Explain the Temporal API (TC39 Stage 3). How does it improve on the Date object? | Click row to expand | |
| 42 | Performance & Memory | What is the critical rendering path? How do JavaScript execution and render-blocking scripts affect page performance? | Click row to expand | |
| 43 | Patterns | What is the pub/sub pattern? How does it differ from the Observer pattern, and how do you implement a typed event bus? | Click row to expand | |
| 44 | Security | What is Content Security Policy (CSP)? How do you implement a strict CSP while supporting a React SPA? | Click row to expand | |
| 45 | Patterns | What is the Strategy pattern in JavaScript? How do you implement runtime algorithm selection without if/else chains? | Click row to expand | |
| 46 | ES6+ Features | What are the key changes in ES2022 and ES2023? Explain Array at(), Object.hasOwn, Error.cause, and top-level await. | Click row to expand | |
| 47 | Event Loop | What is long task detection? How do you break up long JavaScript tasks to keep the UI responsive? | Click row to expand | |
| 48 | Patterns | What is lazy loading? Explain patterns for lazy initialization of objects, modules, and UI components. | Click row to expand | |
| 49 | Patterns | What is dependency injection in JavaScript? How do you implement a simple DI container without a framework? | Click row to expand | |
| 50 | Performance & Memory | What is the Intersection Observer API? What rendering performance problems does it solve compared to scroll event listeners? | Click row to expand |