The generator.next() method

Brendan Eich brendan at mozilla.com
Fri Aug 23 01:48:57 PDT 2013


No .value anywhere, though.

/be

Forbes Lindesay wrote:
> It already is dealt with via destructuring assignments:
>
> ```js
> function* gen() {
>    var {x, y, z} = yield [1, 2, 3]
>    return x&&  y || z
> }
> var g = gen()
> var [a, b, c] = g.next().value
> assert(a === 1)
> assert(b === 2)
> assert(c === 3)
> var res = g.send({x: true, y: false, z: true}).value
> assert(res === true)
> ```
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list