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

Inside a single function call, the catch binding holds a large error. Why might that large object be retained longer than expected by a closure created in the try block?

function setup() { let cb; try { cb = () => 1; throw new Error('x'.repeat(10_000_000)); } catch (e) { return { cb, get: () => 'ok' }; } }