Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptgarbage collection and leaksSingle-choice MCQ

Why can a closure unexpectedly retain a large object even when the inner function never references that object by name?

function makeHandler() { const huge = new Array(1e6).fill(0); const id = huge.length; return function () { return id; }; } const h = makeHandler();