Standard built-ins
Generator.prototype.next()
Resumes a suspended generator, optionally providing the result of its previous yield. The first input is ignored.
Formal Syntax & Structure
javascript syntaxjavascript
generator.next([value])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | any | Input or completion/exception value; optional. |
Return Value
object
Iterator result object.
Working Example
Example Snippetjavascript
function* g(){yield 4;return 5;}const i=g();console.log(i.next().value,i.next().done);