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

A consumer calls .return(7) on outer() while it is suspended at a yield* that delegates to inner(), where inner() has a try/finally. What does the protocol do?

function* inner() { try { yield 'a'; } finally { console.log('inner finally'); } } function* outer() { yield* inner(); } const it = outer(); it.next(); // suspended inside inner at yield 'a' it.return(7);