Help me wrap my head around this example:
function* genFuncWithReturn() {
yield 'a';
yield 'b';
return 'The result';
}
function* logReturned(genObj) {
const result = yield* genObj;
console.log(result); // (A)
}
Results in:
> [...logReturned(genFuncWithReturn())]
The result
[ 'a', 'b' ]
So, my question is why and how result of return statement is produced first and recursive generator statement second?