Skip to content

Instantly share code, notes, and snippets.

@ltciro
Last active October 29, 2018 07:47
Show Gist options
  • Save ltciro/adc5f47667d24ac5086d9f83b18e2393 to your computer and use it in GitHub Desktop.
Save ltciro/adc5f47667d24ac5086d9f83b18e2393 to your computer and use it in GitHub Desktop.
const arr = [1,2,4][Symbol.iterator]()
console.log('Next in array_as_iterable 1', arr.next())
// Next in array_as_iterable 1
// {value: 1, done: false }
console.log('Next in array_as_iterable 2', arr.next())
// Next in array_as_iterable 2
// {value: 2, done: false }
console.log('Next in array_as_iterable 4', arr.next())
// Next in array_as_iterable 4
// {value: 4, done: false }
console.log('Next in array_as_iterable?', arr.next())
// Next in array_as_iterable?
// {value: undefined, done: true }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment