Node.js interview warm-up
Event loop, closures, async concurrency and the Node.js practicals interviewers love.
- var in a Loop with setTimeout Why every callback sees the same `i`.
- Microtasks vs Macrotasks Order of sync code, promise callbacks, await continuations and timers.
- Type Coercion Surprises `+` vs `-` with strings, loose equality and typeof quirks.
- Implement debounce() Delay a function until calls stop for `wait` ms; support cancel() and keep `this`.
- Run Async Tasks with a Concurrency Limit Map over items with at most `limit` promises in flight, keeping result order.
- Build an EventEmitter Implement on, off, once and emit like Node's EventEmitter.
- Two Sum Find the indices of the two numbers that add up to a target.
- LRU Cache A fixed-capacity cache that evicts the least recently used key, with O(1) get and put.
- Retry with Exponential Backoff Retry a failing operation with exponential delays, but never retry non-retryable errors.