Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptclosures and memory retentionSingle-choice MCQ

Multiple closures created in the same scope share a single underlying context object in V8, not one copy per closure. What memory consequence does this shared-context design create?

function init() { const cache = makeHugeThing(); const used = () => doSomething(); const leaky = () => cache; return { used }; // leaky not returned } const api = init();