Skip to content

Instantly share code, notes, and snippets.

@miensol
Created June 14, 2014 06:50
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 miensol/9cf18bc90b2021018403 to your computer and use it in GitHub Desktop.
Save miensol/9cf18bc90b2021018403 to your computer and use it in GitHub Desktop.
a simple es6 generator
var sequence = function *() {
yield 1;
yield 2;
};
var sequenceGenerator = sequence();
var current = null;
current = sequenceGenerator.next();
console.log(current);
current = sequenceGenerator.next();
console.log(current);
current = sequenceGenerator.next();
console.log(current);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment