This blog post is outdated. Please read chapter “Generators” in “Exploring ES6”.
This blog post is part of a series on iteration in ES6:
Generators, a new feature of ECMAScript 6 , are functions that can be paused and resumed. This helps with many applications: iterators, asynchronous programming, etc. This blog post explains how generators work and gives an overview of their applications.
The following GitHub repository contains the example code: generator-examples