ECMAScript 2015 Iterators Revisited

added by Robert Greyling
5/5/2015 12:00:00 AM

370 Views

In an earlier post, we saw how to work with iterators at a low level and use an iterator’s next method to move from one item to the next item. What’s interesting about iterators in JavaScript is how the consumer of an iterator can influence the internal state of the iterator by passing a parameter to the next method. As an example, let’s look at the following range method which you can use to generate a sequence of numbers from start to end.


0 comments