Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptgenerator return throw protocolSingle-choice MCQ

What does this code log, considering how .throw() interacts with a generator that catches the injected exception and then yields?

function* g() { try { yield 1; } catch (e) { yield 'caught'; } yield 2; } const it = g(); it.next(); console.log(it.throw('boom')); console.log(it.next());