Skip to content

Instantly share code, notes, and snippets.

@todgru todgru/iterator.js
Created Jul 24, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.