Skip to content

Instantly share code, notes, and snippets.

@Poltergeist
Created February 18, 2014 08:54
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 Poltergeist/9067138 to your computer and use it in GitHub Desktop.
Save Poltergeist/9067138 to your computer and use it in GitHub Desktop.
/* jshint esnext: true */
var array = [1337, 1553, 1224],
i = 0,
l = list(),
item = l.next();
function *list() {
for (var c = 0; c < array.length; c++) {
yield array[c];
}
}
while (!item.done) {
console.log(item.value);
if (i % 2 === 0) {
array.push(i);
}
item = l.next();
i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment