Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active April 26, 2017 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ibro/e3c056b21f68312d47a257dd47457921 to your computer and use it in GitHub Desktop.
Save Ibro/e3c056b21f68312d47a257dd47457921 to your computer and use it in GitHub Desktop.
JavaScript Generators - Simple generator function - Coding Blast - www.codingblast.com
function* simpleGenerator() {
yield 1;
yield 4;
}
let iterator = simpleGenerator();
let iteratorResult;
do {
iteratorResult = iterator.next();
console.log(iteratorResult);
} while (!iteratorResult.done);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment