Skip to content

Instantly share code, notes, and snippets.

@nivrith
Created November 20, 2020 06:07
Show Gist options
  • Select an option

  • Save nivrith/10feb75aedaf057dd8dd0c5b49cd84b8 to your computer and use it in GitHub Desktop.

Select an option

Save nivrith/10feb75aedaf057dd8dd0c5b49cd84b8 to your computer and use it in GitHub Desktop.
Make your own iterable
const queue = new Queue(10);
queue.add(1);
queue.add(2);
queue.add(3);
queue.add(4);
for(let item of queue) {
console.log(item);
}
// 4
// 3
// 2
// 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment