The `yield *` expression actually *evaluates* to the final value of the
delegated generator (i.e., the final value when *done* is *true*).

In other words, if you modified your second generator in your example to
the following:

    function* b() {
        const result = yield* a();
        console.log('THE RESULT', result);
    }

...you will see that `result` is equal to "end". So, to reiterate (pun not
intended, but intentionally left intact), the final returned value of the
delegated generator is not yielded from the parent generator, but is
instead used as the value of the `yield *` expression itself.

Hope that helps!

On Sun, May 6, 2018 at 11:44 AM, Vic99999 <[email protected]> wrote:

> >or it need to return {value: {value: "end", done: true}, done: true}
>
> this case is supported, seems, if to use:
>
> function* b() {
>         return yield* a()
> }
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Jeremy Martin
661.312.3853
@jmar777 <https://twitter.com/jmar777> / @j <https://stream.live/j>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to