javascript - Is there something in ES6 to collect iterator including the final return value? -



javascript - Is there something in ES6 to collect iterator including the final return value? -

if have next generator:

function* generate() { yield 1; yield 2; homecoming 3; }

is there built in in es6 [1, 2] , 3 out of (without doing next manually)? if needed 1 , 2 utilize for(of), want 3 well.

generators not designed work way. if want values @ once, hardly see point of using generators. if must, can -

function* generate() { yield 1; yield 2; homecoming 3; } var arr = [], k, = generate(); { k = it.next(); arr.push(k.value); } while (!k.done); console.log(arr);

javascript generator ecmascript-6

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -