Specification concepts
IteratorClose
Specification operation used by consumers to request early iterator cleanup through its optional return method. Handles abrupt completions according to the relevant algorithm. Not a JavaScript-callable function.
Formal Syntax & Structure
javascript syntaxjavascript
IteratorClose(iteratorRecord, completion) (specification notation)Working Example
Example Snippetjavascript
function* g(){try{yield 1;}finally{console.log("close");}}for(const x of g())break;