Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generators Simple pause resume - Coding Blast - www.codingblast.com
function* print() {
let a = 5 - (yield 3);
console.log('a:', a);
}
let generator = print();
let iteratorResult = generator.next(); // sending value in next here gets ignored during first next
console.log(iteratorResult);
iteratorResult = generator.next(1);
console.log(iteratorResult);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.