function*
gen() {
var
result1 =
yield
"hello";
var
result2 =
yield
"world";
return
result1 +
result2;
}
var
g =
gen();
// g.next(1);
//{value : 'hello', done : false}
// g.next(2);
//{value : 'world', done : false}
// g.next();
//{value : 3, done: true}
// g.next();
//{value : undefined, done: true}
console.
log(
g.
next(
1));