Interview Question Breakdowns
Learn the reasoning, implementation details, and common follow-ups behind each question.
Implement a Deep Clone in JavaScript
Define a finite clone contract, then implement deepClone with a source-to-copy WeakMap so cycles, shared references, Map, Set, and supported built-ins remain consistent. Learn when structuredClone is the safer choice.
Implement an Event Emitter in JavaScript
Derive a JavaScript EventEmitter from an explicit contract, handling duplicate registrations, listener mutation during dispatch, reentrant once listeners, and error propagation, then verify the semantics with boundary cases.
How Do You Implement Promise.all with Correct Ordering and Failure Semantics?
Derive a Promise.all implementation from the iterable contract, covering plain values, thenables, empty input, ordered results, and fail-fast rejection, then validate it with boundary cases.