Introduction One of the most exciting features introduced in ES6 is generators. Their primary use case is in representing lazy (possibly infinite) sequences. For example, the following function returns the first n positive integers. function count(n){ var res = [] for (var x = 0; x < n; x++) { res.push(x) } return res } for (var x of count(5)) { console.log(x) } We can write a very similar functio