Skip to content

Instantly share code, notes, and snippets.

@todgru
Created July 24, 2019 22:22
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 todgru/58c020d2f9490251da3ffe7358fa693c to your computer and use it in GitHub Desktop.
Save todgru/58c020d2f9490251da3ffe7358fa693c to your computer and use it in GitHub Desktop.
const arr = [1, 2, 3, 4, 5, 6];
const iter = arr[Symbol.iterator]();
const foo = i => {
const v = i.next();
if (v.done) return "done!";
console.log("next!", v.value);
return foo(i);
};
foo(iter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment