Prototype: implement async generator fromIterable(iterable), yielding each source value in order and awaiting promised values. Keep object identity and propagate failure.

Final: implement async generator batchStream(source, size). Accept an async or sync iterable. size is a positive safe integer or throws RangeError when consumed. Yield fresh arrays of at most size values; emit a final partial batch only on normal completion. Read no further while a yielded batch awaits consumer demand. Close the source on consumer break; if source fails, propagate it without flushing a partial batch.

Complete the exported stubs in exercise.mjs. The prototype and final stages have separate checks.

Shell
node main.mjs --stage prototype
node main.mjs --stage final

Use Node.js 20+ locally, or the website's browser worker. Tests are standard-library only and check the documented behavior; they do not prove performance or force garbage collection.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.