Skip to content

Instantly share code, notes, and snippets.

@devmobasa
Last active April 26, 2017 04:57
Show Gist options
  • Select an option

  • Save devmobasa/948e74edf2f02a3c2774e7d9f2a9c103 to your computer and use it in GitHub Desktop.

Select an option

Save devmobasa/948e74edf2f02a3c2774e7d9f2a9c103 to your computer and use it in GitHub Desktop.
Iterators - string - Coding Blast - www.codingblast.com
let someText = 'code';
let iterator = someText[Symbol.iterator]();
console.log(iterator.next()); // { value: "c", done: false }
console.log(iterator.next()); // { value: "o", done: false }
console.log(iterator.next()); // { value: "d", done: false }
console.log(iterator.next()); // { value: "e", done: false }
console.log(iterator.next()); // { value: undefined, done: true }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment